Closed olablt closed 1 year ago
Unfortunately it is not possible to scan a DECIMAL
directly into a float64
value. You need to define price,bit,ask,qty
as Decimal
and than convert them manually to float64
.
var id int
var time time.Time
var price duckdb.Decimal
var bid duckdb.Decimal
var ask duckdb.Decimal
var qty duckdb.Decimal
var side string
err := rows.Scan(&id, &time, &price, &bid, &ask, &qty, &side)
if err != nil {
log.Fatal(err)
}
log.Println("ID:", id, "Time:", time, "Price:", price.Float64(), "Bid:", bid.Float64(), "Ask:", ask.Float64(), "Qty:", qty.Float64(), "Side:", side)
If I understand correctly, scan should convert duckdb.Decimal to float64 values?
I get the error:
my program: