// UserData returns the user data for functions. // (See http://sqlite.org/c3ref/user_data.html) func (c *FunctionContext) UserData() interface{} { udf := (*sqliteFunction)(C.sqlite3_user_data(c.sc)) return udf.pApp }
//export doneTrampoline func doneTrampoline(ctx *C.sqlite3_context) { handle := uintptr(C.sqlite3_user_data(ctx)) ai := lookupHandle(handle).(*aggInfo) ai.Done(ctx) }
//export stepTrampoline func stepTrampoline(ctx *C.sqlite3_context, argc C.int, argv **C.sqlite3_value) { args := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.sqlite3_value)(nil))]*C.sqlite3_value)(unsafe.Pointer(argv))[:int(argc):int(argc)] ai := lookupHandle(uintptr(C.sqlite3_user_data(ctx))).(*aggInfo) ai.Step(ctx, args) }
//export callbackTrampoline func callbackTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) { args := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.sqlite3_value)(nil))]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc] fi := lookupHandle(uintptr(C.sqlite3_user_data(ctx))).(*functionInfo) fi.Call(ctx, args) }
//export doneTrampoline func doneTrampoline(ctx *C.sqlite3_context) { ai := (*aggInfo)(unsafe.Pointer(C.sqlite3_user_data(ctx))) ai.Done(ctx) }
//export stepTrampoline func stepTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) { args := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.sqlite3_value)(nil))]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc] ai := (*aggInfo)(unsafe.Pointer(C.sqlite3_user_data(ctx))) ai.Step(ctx, args) }