package nosqldb_sdk import ( "C" ) import ( "unsafe" "github.com/oracle/nosql-go-sdk/nosqldb" "nosql_db_sdk_ffi/util/ptrproxy" ) //export ffi_nosqldb_table_limits_new func ffi_nosqldb_table_limits_new() NosqldbTableLimits { tlmts := nosqldb.TableLimits{} return NosqldbTableLimits(ptrproxy.Ref(unsafe.Pointer(&tlmts))) } const ( readunits = iota writeunits storagegb ) //export ffi_nosqldb_table_limits_set func ffi_nosqldb_table_limits_set(unsafe_nosqldb_table_limits_ptr NosqldbTableLimits, key C.uint, value C.uint) Error { nosqldb_table_limits_ptr, ok := ptrproxy.Deref(unsafe.Pointer(unsafe_nosqldb_table_limits_ptr)) if !ok { return C.CString("NosqldbTableLimitsPtr cannot deref") } table_limits := (*nosqldb.TableLimits)(nosqldb_table_limits_ptr) switch key { case readunits: table_limits.ReadUnits = uint(value) //println("ReadUnits:", table_limits.ReadUnits) case writeunits: table_limits.WriteUnits = uint(value) //println("WriteUnits:", table_limits.WriteUnits) case storagegb: table_limits.StorageGB = uint(value) //println("StorageGB:", table_limits.StorageGB) default: return C.CString("invalid key") } return nil }