Internal JSON and pointer wrappers.

This commit is contained in:
Nuno Cruces
2023-12-29 11:37:50 +00:00
parent 7e5a143214
commit 16b5d80ef7
5 changed files with 58 additions and 51 deletions

View File

@@ -1,14 +1,12 @@
package sqlite3
import "github.com/ncruces/go-sqlite3/internal/util"
// Pointer returns a pointer to a value that can be used as an argument to
// [database/sql.DB.Exec] and similar methods.
// Pointer should NOT be used with [BindPointer] or [ResultPointer].
//
// https://sqlite.org/bindptr.html
func Pointer[T any](val T) any {
return pointer[T]{val}
func Pointer[T any](value T) any {
return util.Pointer[T]{Value: value}
}
type pointer[T any] struct{ val T }
func (p pointer[T]) Pointer() any { return p.val }