Skip to content

Recommended way of working with the DECIMAL type #353

Discussion options

You must be logged in to vote

Hi @trading-peter, have a look at types_test.go. There is a test func TestDecimal(t *testing.T), including scanning the decimal type. In appender_test.go, you can find func TestAppenderDecimal(t *testing.T), which shows how to (bulk) insert decimals with the Appender. Hope this helps! ✌️

It is not yet possible to bind it to a statement (query("SELECT $1...", myDecimal). I'll try to get that in after the next release.

func (s *Stmt) bindValue(val driver.NamedValue, n int) (C.duckdb_state, error) {
	switch v := val.Value.(type) {
	case bool:
		return C.duckdb_bind_boolean(*s.stmt, C.idx_t(n+1), C.bool(v)), nil
// ...
	case Decimal:
		// FIXME: implement NamedValueChecker to support custom d…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by trading-peter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants