tarantool / go-tarantool

Tarantool 1.10+ client for Go language
https://pkg.go.dev/github.com/tarantool/go-tarantool/v2
BSD 2-Clause "Simplified" License
180 stars 58 forks source link

crud: typed batches #365

Closed a1div0 closed 8 months ago

a1div0 commented 10 months ago

Improvement suggested. Let's say I set the following line:

enter Row struct {
   _msgpack struct{} `msgpack:",asArray"` //nolint: structcheck,unused
   Identifier uint `msgpack:"id"`
   BucketId *uint `msgpack:"bucket_id"`
   Too uint `msgpack:"too"`
   Foo string `msgpack:"foo"`
}

Make an improvement so that you can pass data in this structure in batches, for example to a method

// Row --> batch --> and ..
req := crud.MakeInsertObjectManyRequest("test").Objects(batches[i]) // <-- here
oleg-jukovec commented 10 months ago

The problem: it is unable to use a batch of tuples as an Objects argument. The possible solution: Objects should accept interface{} as an arguments instead of []crud.Object.

oleg-jukovec commented 8 months ago

You although will need to use MakeInsertManyRequest to insert tuples as arrays, MakeInsertObjectManyRequest for tuples as maps. See new examples from #375 .