Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1852,6 +1852,11 @@ func (d *Decimal) Scan(value interface{}) error {
*d = NewFromUint64(v)
return nil

case Decimal:
// while clickhouse return type Decimal
*d = v
return nil

default:
// default is trying to interpret value stored as string
str, err := unquoteIfQuoted(v)
Expand Down
5 changes: 5 additions & 0 deletions decimal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2465,6 +2465,11 @@ func TestDecimal_Scan(t *testing.T) {
scanHelper(t, dbvalueStr, expected)
scanHelper(t, valueStr, expected)

// also test decimal
dbvalueDecimal := New(2, 3)
expected = New(2, 3)
scanHelper(t, dbvalueDecimal, expected)

type foo struct{}
a := Decimal{}
err = a.Scan(foo{})
Expand Down