package nosqldb_sdk import ( "C" ) import ( "fmt" "nosql_db_sdk_ffi/util/ptrproxy" "strings" "unsafe" "github.com/oracle/nosql-go-sdk/nosqldb" "github.com/oracle/nosql-go-sdk/nosqldb/types" ) //export ffi_nosqldb_put_request_new func ffi_nosqldb_put_request_new() NosqldbPutRequest { ptrq := nosqldb.PutRequest{} return NosqldbPutRequest(ptrproxy.Ref(unsafe.Pointer(&ptrq))) } //export ffi_nosqldb_put_request_set_tablename func ffi_nosqldb_put_request_set_tablename(unsafe_nosqldb_put_request_ptr NosqldbPutRequest, tablename string) Error { nosqldb_put_request_tablename_ptr, ok := ptrproxy.Deref(unsafe.Pointer(unsafe_nosqldb_put_request_ptr)) if !ok { return C.CString("NosqldbPutRequestPtr cannot deref") } put_request := (*nosqldb.PutRequest)(nosqldb_put_request_tablename_ptr) put_request.TableName = strings.Clone(tablename) return nil } //export ffi_nosqldb_put_request_set_value func ffi_nosqldb_put_request_set_value(unsafe_nosqldb_put_request_ptr NosqldbPutRequest, value unsafe.Pointer) Error { nosqldb_put_request_value_ptr, ok := ptrproxy.Deref(unsafe.Pointer(unsafe_nosqldb_put_request_ptr)) if !ok { return C.CString("NosqldbPutRequestPtr cannot deref") } put_request := (*nosqldb.PutRequest)(nosqldb_put_request_value_ptr) map_value_ptr, ok := ptrproxy.Move(unsafe.Pointer(value)) if !ok { return C.CString("NosqldbPutRequestPtr cannot deref") } map_value := (*types.MapValue)(map_value_ptr) put_request.Value = map_value return nil } //export ffi_nosqldb_put_request_get_map func ffi_nosqldb_put_request_get_map(unsafe_nosqldb_put_request_ptr NosqldbPutRequest) (unsafe.Pointer, Error) { nosqldb_put_request_value_ptr, ok := ptrproxy.Deref(unsafe.Pointer(unsafe_nosqldb_put_request_ptr)) if !ok { return nil, C.CString("NosqldbPutRequestPtr cannot deref") } put_request := (*nosqldb.PutRequest)(nosqldb_put_request_value_ptr) map_value := types.NewMapValue(put_request.Value.Map()) return ptrproxy.Ref(unsafe.Pointer(map_value)), nil } //export ffi_nosqldb_put_request_clone func ffi_nosqldb_put_request_clone(unsafe_nosqldb_put_request_ptr NosqldbPutRequest) (NosqldbPutRequest, Error) { nosqldb_put_request_value_ptr, ok := ptrproxy.Deref(unsafe.Pointer(unsafe_nosqldb_put_request_ptr)) if !ok { return nil, C.CString("NosqldbPutRequestPtr cannot deref") } put_request := (*nosqldb.PutRequest)(nosqldb_put_request_value_ptr) copy := *put_request return NosqldbPutRequest(ptrproxy.Ref(unsafe.Pointer(©))), nil } //export ffi_nosqldb_put_request_success func ffi_nosqldb_put_request_success(unsafe_nosqldb_put_result_ptr NosqldbPutResult) (bool, Error) { nosqldb_put_result_value_ptr, ok := ptrproxy.Deref(unsafe.Pointer(unsafe_nosqldb_put_result_ptr)) if !ok { return false, C.CString("NosqldbPutResultPtr cannot deref") } put_result := (*nosqldb.PutResult)(nosqldb_put_result_value_ptr) return put_result.Success(), nil } //export ffi_nosqldb_put_request_debug func ffi_nosqldb_put_request_debug(unsafe_nosqldb_put_result_ptr NosqldbPutResult) (Error) { nosqldb_put_result_value_ptr, ok := ptrproxy.Deref(unsafe.Pointer(unsafe_nosqldb_put_result_ptr)) if !ok { return C.CString("NosqldbPutResultPtr cannot deref") } put_result := (*nosqldb.PutResult)(nosqldb_put_result_value_ptr) fmt.Printf("client: %v\n", put_result) return nil }