File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
18
18
that take in an ` ExecOptions ` struct.
19
19
([ #5 ] ( https://github.com/zombiezen/go-sqlite/issues/5 ) )
20
20
- New method ` sqlite.ResultCode.ToError ` to create error values.
21
+ - New methods ` ColumnBool ` and ` GetBool ` on ` *sqlite.Stmt `
22
+ ([ #37 ] ( https://github.com/zombiezen/go-sqlite/issues/37 ) ).
21
23
22
24
### Changed
23
25
Original file line number Diff line number Diff line change @@ -1026,6 +1026,15 @@ func (stmt *Stmt) ColumnInt64(col int) int64 {
1026
1026
return lib .Xsqlite3_column_int64 (stmt .conn .tls , stmt .stmt , int32 (col ))
1027
1027
}
1028
1028
1029
+ // ColumnBool reports whether a query result value is non-zero.
1030
+ //
1031
+ // Column indices start at 0.
1032
+ //
1033
+ // https://www.sqlite.org/c3ref/column_blob.html
1034
+ func (stmt * Stmt ) ColumnBool (col int ) bool {
1035
+ return stmt .ColumnInt64 (col ) != 0
1036
+ }
1037
+
1029
1038
// ColumnBytes reads a query result into buf.
1030
1039
// It reports the number of bytes read.
1031
1040
//
@@ -1165,6 +1174,11 @@ func (stmt *Stmt) GetInt64(colName string) int64 {
1165
1174
return stmt .ColumnInt64 (col )
1166
1175
}
1167
1176
1177
+ // GetBool reports whether the query result value for colName is non-zero.
1178
+ func (stmt * Stmt ) GetBool (colName string ) bool {
1179
+ return stmt .GetInt64 (colName ) != 0
1180
+ }
1181
+
1168
1182
// GetBytes reads a query result for colName into buf.
1169
1183
// It reports the number of bytes read.
1170
1184
func (stmt * Stmt ) GetBytes (colName string , buf []byte ) int {
You can’t perform that action at this time.
0 commit comments