package sqlite3import ()// Value is any value that can be stored in a database table.//// https://sqlite.org/c3ref/value.htmltypeValuestruct { c *Conn handle ptr_t}// Dup makes a copy of the SQL value and returns a pointer to that copy.//// https://sqlite.org/c3ref/value_dup.htmlfunc ( Value) () *Value { := ptr_t(.c.call("sqlite3_value_dup", stk_t(.handle)))return &Value{c: .c,handle: , }}// Close frees an SQL value previously obtained by [Value.Dup].//// https://sqlite.org/c3ref/value_dup.htmlfunc ( *Value) () error { .c.call("sqlite3_value_free", stk_t(.handle)) .handle = 0returnnil}// Type returns the initial datatype of the value.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () Datatype {returnDatatype(.c.call("sqlite3_value_type", stk_t(.handle)))}// Subtype returns the subtype of the value.//// https://sqlite.org/c3ref/value_subtype.htmlfunc ( Value) () uint {returnuint(uint32(.c.call("sqlite3_value_subtype", stk_t(.handle))))}// NumericType returns the numeric datatype of the value.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () Datatype {returnDatatype(.c.call("sqlite3_value_numeric_type", stk_t(.handle)))}// Bool returns the value as a bool.// SQLite does not have a separate boolean storage class.// Instead, boolean values are retrieved as numbers,// with 0 converted to false and any other value to true.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () bool {return .Float() != 0}// Int returns the value as an int.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () int {returnint(.Int64())}// Int64 returns the value as an int64.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () int64 {returnint64(.c.call("sqlite3_value_int64", stk_t(.handle)))}// Float returns the value as a float64.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () float64 { := uint64(.c.call("sqlite3_value_double", stk_t(.handle)))returnmath.Float64frombits()}// Time returns the value as a [time.Time].//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) ( TimeFormat) time.Time {varanyswitch .Type() {caseINTEGER: = .Int64()caseFLOAT: = .Float()caseTEXT, BLOB: = .Text()caseNULL:returntime.Time{}default:panic(util.AssertErr()) } , := .Decode()return}// Text returns the value as a string.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () string {returnstring(.RawText())}// Blob appends to buf and returns// the value as a []byte.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) ( []byte) []byte {returnappend(, .RawBlob()...)}// RawText returns the value as a []byte.// The []byte is owned by SQLite and may be invalidated by// subsequent calls to [Value] methods.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () []byte { := ptr_t(.c.call("sqlite3_value_text", stk_t(.handle)))return .rawBytes(, 1)}// RawBlob returns the value as a []byte.// The []byte is owned by SQLite and may be invalidated by// subsequent calls to [Value] methods.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () []byte { := ptr_t(.c.call("sqlite3_value_blob", stk_t(.handle)))return .rawBytes(, 0)}func ( Value) ( ptr_t, int32) []byte {if == 0 {returnnil } := int32(.c.call("sqlite3_value_bytes", stk_t(.handle)))returnutil.View(.c.mod, , int64(+))[:]}// Pointer gets the pointer associated with this value,// or nil if it has no associated pointer.func ( Value) () any { := ptr_t(.c.call("sqlite3_value_pointer_go", stk_t(.handle)))returnutil.GetHandle(.c.ctx, )}// NoChange returns true if and only if the value is unchanged// in a virtual table update operatiom.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () bool { := int32(.c.call("sqlite3_value_nochange", stk_t(.handle)))return != 0}// FromBind returns true if value originated from a bound parameter.//// https://sqlite.org/c3ref/value_blob.htmlfunc ( Value) () bool { := int32(.c.call("sqlite3_value_frombind", stk_t(.handle)))return != 0}// InFirst returns the first element// on the right-hand side of an IN constraint.//// https://sqlite.org/c3ref/vtab_in_first.htmlfunc ( Value) () (Value, error) {defer .c.arena.mark()() := .c.arena.new(ptrlen) := res_t(.c.call("sqlite3_vtab_in_first", stk_t(.handle), stk_t()))if := .c.error(); != nil {returnValue{}, }returnValue{c: .c,handle: util.Read32[ptr_t](.c.mod, ), }, nil}// InNext returns the next element// on the right-hand side of an IN constraint.//// https://sqlite.org/c3ref/vtab_in_first.htmlfunc ( Value) () (Value, error) {defer .c.arena.mark()() := .c.arena.new(ptrlen) := res_t(.c.call("sqlite3_vtab_in_next", stk_t(.handle), stk_t()))if := .c.error(); != nil {returnValue{}, }returnValue{c: .c,handle: util.Read32[ptr_t](.c.mod, ), }, nil}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.