Pointer-passing interfaces.

This commit is contained in:
Nuno Cruces
2023-11-07 00:50:43 +00:00
parent 24b965ac7e
commit 24c9b57c56
11 changed files with 191 additions and 2 deletions

14
pointer.go Normal file
View File

@@ -0,0 +1,14 @@
package sqlite3
// Pointer returns a pointer to a value
// that can be used as an argument to
// [database/sql.DB.Exec] and similar methods.
//
// https://www.sqlite.org/bindptr.html
func Pointer[T any](val T) any {
return pointer[T]{val}
}
type pointer[T any] struct{ val T }
func (p pointer[T]) Value() any { return p.val }