MCPcopy Create free account
hub / github.com/mattn/go-sqlite3 / callbackArgBytes

Function callbackArgBytes

callback.go:235–248  ·  view source on GitHub ↗
(v *C.sqlite3_value)

Source from the content-addressed store, hash-verified

233}
234
235func callbackArgBytes(v *C.sqlite3_value) (reflect.Value, error) {
236 switch C.sqlite3_value_type(v) {
237 case C.SQLITE_BLOB:
238 l := C.sqlite3_value_bytes(v)
239 p := C.sqlite3_value_blob(v)
240 return reflect.ValueOf(C.GoBytes(p, l)), nil
241 case C.SQLITE_TEXT:
242 l := C.sqlite3_value_bytes(v)
243 c := unsafe.Pointer(C.sqlite3_value_text(v))
244 return reflect.ValueOf(C.GoBytes(c, l)), nil
245 default:
246 return reflect.Value{}, fmt.Errorf("argument must be BLOB or TEXT")
247 }
248}
249
250func callbackArgString(v *C.sqlite3_value) (reflect.Value, error) {
251 switch C.sqlite3_value_type(v) {

Callers 1

callbackArgGenericFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected