diff options
author | Jordan <me@jordan.im> | 2022-09-30 11:52:44 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2022-09-30 11:52:44 -0700 |
commit | 0192a4e3f1c90df255e44831a579d9b0f611a543 (patch) | |
tree | 52c6bfa35b5491560af253a5e5ba90ed8a729871 /vendor/github.com/mattn/go-sqlite3/callback.go | |
parent | 66bfe530b4fd5cb9755337ce718df26ee81f1b77 (diff) | |
download | keep-0192a4e3f1c90df255e44831a579d9b0f611a543.tar.gz keep-0192a4e3f1c90df255e44831a579d9b0f611a543.zip |
go.mod: bump discordgo, go-sqlite3, x/net
Diffstat (limited to 'vendor/github.com/mattn/go-sqlite3/callback.go')
-rw-r--r-- | vendor/github.com/mattn/go-sqlite3/callback.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/github.com/mattn/go-sqlite3/callback.go b/vendor/github.com/mattn/go-sqlite3/callback.go index b020fe3..d305691 100644 --- a/vendor/github.com/mattn/go-sqlite3/callback.go +++ b/vendor/github.com/mattn/go-sqlite3/callback.go @@ -353,6 +353,20 @@ func callbackRetNil(ctx *C.sqlite3_context, v reflect.Value) error { return nil } +func callbackRetGeneric(ctx *C.sqlite3_context, v reflect.Value) error { + if v.IsNil() { + C.sqlite3_result_null(ctx) + return nil + } + + cb, err := callbackRet(v.Elem().Type()) + if err != nil { + return err + } + + return cb(ctx, v.Elem()) +} + func callbackRet(typ reflect.Type) (callbackRetConverter, error) { switch typ.Kind() { case reflect.Interface: @@ -360,6 +374,11 @@ func callbackRet(typ reflect.Type) (callbackRetConverter, error) { if typ.Implements(errorInterface) { return callbackRetNil, nil } + + if typ.NumMethod() == 0 { + return callbackRetGeneric, nil + } + fallthrough case reflect.Slice: if typ.Elem().Kind() != reflect.Uint8 { |