diff --git a/api/call.go b/api/call.go index 377a8c1..3625968 100644 --- a/api/call.go +++ b/api/call.go @@ -29,10 +29,10 @@ import ( "github.com/apache/arrow/go/v9/arrow/memory" ) -type CallApi interface { +type Bridge interface { FromChunks(arrays []arrow.Array) (int, error) } -type ArrowBridge struct { +type CommonParameter struct { GoAllocator *memory.GoAllocator } diff --git a/ffi/rust/call.go b/ffi/rust/call.go index 47a9c6f..cfca63e 100644 --- a/ffi/rust/call.go +++ b/ffi/rust/call.go @@ -57,11 +57,11 @@ func Info(s string) { ) } -type GoBridge struct { - api.ArrowBridge +type Bridge struct { + api.CommonParameter } -func (goBridge GoBridge) FromChunks(arrays []arrow.Array) (int, error) { +func (b Bridge) FromChunks(arrays []arrow.Array) (int, error) { var Cschemas []cdata.CArrowSchema var Carrays []cdata.CArrowArray diff --git a/main.go b/main.go index 7fe1b57..c400f56 100644 --- a/main.go +++ b/main.go @@ -58,7 +58,10 @@ func buildAndAppend(mem *memory.GoAllocator, values [][]int32) ([]*array.Int32Bu } func main() { - goBridge := rust.GoBridge{api.ArrowBridge{memory.NewGoAllocator()}} + mem := memory.NewGoAllocator() + + var b api.Bridge + b = rust.Bridge{api.CommonParameter{mem}} values := [][]int32{ {1, 2, 3, -4}, @@ -66,13 +69,13 @@ func main() { {3, 4, 5, 6}, } - builders, arrays := buildAndAppend(goBridge.GoAllocator, values) + builders, arrays := buildAndAppend(mem, values) for idx := 0; idx < len(arrays); idx++ { defer builders[idx].Release() defer arrays[idx].Release() } - ret, err := goBridge.FromChunks(arrays) + ret, err := b.FromChunks(arrays) if nil != err { fmt.Println(err)