Skip to content

Commit 1b2931a

Browse files
authored
Add mapping of untyped nil args to BindNull to exec docs (#122)
1 parent e5fb837 commit 1b2931a

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

sqlitex/exec.go

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ type ExecOptions struct {
3535
//
3636
// Basic reflection on Args is used to map:
3737
//
38-
// integers to BindInt64
39-
// floats to BindFloat
40-
// []byte to BindBytes
41-
// string to BindText
42-
// bool to BindBool
38+
// - integers to BindInt64
39+
// - floats to BindFloat
40+
// - []byte to BindBytes
41+
// - string to BindText
42+
// - bool to BindBool
43+
// - untyped nil to BindNull
4344
//
44-
// All other kinds are printed using fmt.Sprint(v) and passed to BindText.
45+
// All other kinds are printed using [fmt.Sprint] and passed to BindText.
4546
Args []any
4647

4748
// Named is the set of named arguments to bind to the statement. Keys must
@@ -50,13 +51,14 @@ type ExecOptions struct {
5051
//
5152
// Basic reflection on Named is used to map:
5253
//
53-
// integers to BindInt64
54-
// floats to BindFloat
55-
// []byte to BindBytes
56-
// string to BindText
57-
// bool to BindBool
54+
// - integers to BindInt64
55+
// - floats to BindFloat
56+
// - []byte to BindBytes
57+
// - string to BindText
58+
// - bool to BindBool
59+
// - untyped nil to BindNull
5860
//
59-
// All other kinds are printed using fmt.Sprint(v) and passed to BindText.
61+
// All other kinds are printed using [fmt.Sprint] and passed to BindText.
6062
Named map[string]any
6163

6264
// ResultFunc is called for each result row.
@@ -76,14 +78,14 @@ type ExecOptions struct {
7678
// query using the [sqlite.Stmt] Bind* methods. Basic reflection on args is used
7779
// to map:
7880
//
79-
// integers to BindInt64
80-
// floats to BindFloat
81-
// []byte to BindBytes
82-
// string to BindText
83-
// bool to BindBool
81+
// - integers to BindInt64
82+
// - floats to BindFloat
83+
// - []byte to BindBytes
84+
// - string to BindText
85+
// - bool to BindBool
86+
// - untyped nil to BindNull
8487
//
85-
// All other kinds are printed using fmt.Sprintf("%v", v) and passed
86-
// to BindText.
88+
// All other kinds are printed using [fmt.Sprint] and passed to BindText.
8789
//
8890
// Exec is implemented using the Stmt prepare mechanism which allows
8991
// better interactions with Go's type system and avoids pitfalls of

0 commit comments

Comments
 (0)