Skip to content

Commit 8ee3256

Browse files
committed
Add const ColumnIndexStart and BindIndexStart
1 parent a7c25ba commit 8ee3256

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

incrementor.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package sqlite
22

3+
// BindIndexStart is the index of the first parameter when using the Stmt.Bind*
4+
// functions.
5+
const BindIndexStart = 1
6+
37
// BindIncrementor returns an Incrementor that starts on 1, the first index
48
// used in Stmt.Bind* functions. This is provided as syntactic sugar for
59
// binding parameter values to a Stmt. It allows for easily changing query
@@ -16,9 +20,13 @@ package sqlite
1620
// }
1721
// stmt.BindText(i(), c) // i() == 3
1822
func BindIncrementor() Incrementor {
19-
return NewIncrementor(1)
23+
return NewIncrementor(BindIndexStart)
2024
}
2125

26+
// ColumnIndexStart is the index of the first column when using the
27+
// Stmt.Column* functions.
28+
const ColumnIndexStart = 0
29+
2230
// ColumnIncrementor returns an Incrementor that starts on 0, the first index
2331
// used in Stmt.Column* functions. This is provided as syntactic sugar for
2432
// parsing column values from a Stmt. It allows for easily changing queried
@@ -31,7 +39,7 @@ func BindIncrementor() Incrementor {
3139
// b := stmt.ColumnInt64(i()) // i() == 2
3240
// c := stmt.ColumnText(i()) // i() == 3
3341
func ColumnIncrementor() Incrementor {
34-
return NewIncrementor(0)
42+
return NewIncrementor(ColumnIndexStart)
3543
}
3644

3745
// NewIncrementor returns an Incrementor that starts on start.

0 commit comments

Comments
 (0)