From 1ebdeed5657b5eb98e4534793c003f412443b3ab Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Fri, 22 Dec 2023 02:45:26 +0000 Subject: [PATCH] Documentation, issue #45. --- ext/array/array.go | 5 +++-- ext/blobio/blob.go | 3 ++- json.go | 1 + pointer.go | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ext/array/array.go b/ext/array/array.go index 921aa1b..9e23ba6 100644 --- a/ext/array/array.go +++ b/ext/array/array.go @@ -12,8 +12,9 @@ import ( ) // Register registers the array single-argument, table-valued SQL function. -// The argument must be an [sqlite3.Pointer] to a Go slice or array -// of ints, floats, bools, strings or blobs. +// The argument must be bound to a Go slice or array of +// ints, floats, bools, strings or byte slices, +// using [sqlite3.BindPointer] or [sqlite3.Pointer]. func Register(db *sqlite3.Conn) { sqlite3.CreateModule[array](db, "array", nil, func(db *sqlite3.Conn, _, _, _ string, _ ...string) (array, error) { diff --git a/ext/blobio/blob.go b/ext/blobio/blob.go index 1a06d2d..a9a9c26 100644 --- a/ext/blobio/blob.go +++ b/ext/blobio/blob.go @@ -23,7 +23,8 @@ import ( // // Opens blobs for reading or writing. // The callback is invoked for each open blob, -// and must be an [sqlite3.Pointer] to an [OpenCallback]. +// and must be bound to an [OpenCallback], +// using [sqlite3.BindPointer] or [sqlite3.Pointer]. // The optional args will be passed to the callback, // along with the [sqlite3.Blob] handle. // diff --git a/json.go b/json.go index c0086ea..37039fc 100644 --- a/json.go +++ b/json.go @@ -12,6 +12,7 @@ import ( // JSON returns a value that can be used as an argument to // [database/sql.DB.Exec], [database/sql.Row.Scan] and similar methods to // store value as JSON, or decode JSON into value. +// JSON should NOT be used with [BindJSON] or [ResultJSON]. func JSON(value any) any { return jsonValue{value} } diff --git a/pointer.go b/pointer.go index dba1e44..9647f67 100644 --- a/pointer.go +++ b/pointer.go @@ -1,8 +1,8 @@ package sqlite3 -// Pointer returns a pointer to a value -// that can be used as an argument to +// 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 {