package advsql import "context" func QueryOne[T any](db *Database, query string, decoder func(v *T, decode DecodeFunc) error) QueryOneFunc[T] { ctxfunc := QueryOneContext(db, query, decoder) return func(args ...interface{}) *T { return ctxfunc(context.Background(), args...) } } func QueryOneContext[T any](db *Database, query string, decoder func(v *T, decode DecodeFunc) error) QueryOneContextFunc[T] { manyfunc := QueryManyContext(db, query, decoder) return func(ctx context.Context, args ...interface{}) *T { nctx, cancel := context.WithCancel(ctx) defer cancel() return <-manyfunc(nctx, args...) } }