tarantool/go-tarantool

crud: typed batches

a1div0 opened this issue · 2 comments

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

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.

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