Skip to content

Commit

Permalink
Document passing trino.Numeric to queries
Browse files Browse the repository at this point in the history
  • Loading branch information
nineinchnick authored and losipiuk committed Jul 21, 2022
1 parent 7410412 commit 93f1cff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 4 additions & 0 deletions trino/trino.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 93f1cff

Please sign in to comment.