From 93f1cff2a1cea964aaa9af6ccf3cf04afce2cd63 Mon Sep 17 00:00:00 2001 From: Jan Was Date: Mon, 18 Jul 2022 12:49:43 +0200 Subject: [PATCH] Document passing trino.Numeric to queries --- README.md | 1 + trino/trino.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 6e3383b..b774ad5 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,7 @@ When passing arguments to queries, the driver supports the following Go data typ * `bool` * `string` * slices +* `trino.Numeric` - a string representation of a number It's not yet possible to pass: * `nil` diff --git a/trino/trino.go b/trino/trino.go index 0e998ee..e87d91a 100644 --- a/trino/trino.go +++ b/trino/trino.go @@ -588,6 +588,10 @@ func (st *driverStmt) ExecContext(ctx context.Context, args []driver.NamedValue) } func (st *driverStmt) CheckNamedValue(arg *driver.NamedValue) error { + _, ok := arg.Value.(Numeric) + if ok { + return nil + } if reflect.TypeOf(arg.Value).Kind() == reflect.Slice { return nil }