Closed karel-rehor closed 2 months ago
Only as a reminder
werr := client.WriteDataWithOptions(context.Background(), &wopts, []interface{})
... throws error like...
error encoding point: cannot use []main.Nautilus as point
and
werr := client.WriteDataWithOptions(context.Background(), &wopts, []*interface{})
...throws error like...
error encoding point: cannot use []*main.Nautilus as point
Any update on this? Would love to have a batch write option.
@thulasirajkomminar thanks for clarify your interesting, we will prioritise this issue.
Is this something you would be willing to help with? All PR is welcome and we will be happy to review your submission.
@thulasirajkomminar thanks for clarify your interesting, we will prioritise this issue.
Is this something you would be willing to help with? All PR is welcome and we will be happy to review your submission.
I think @karel-rehor already made some commits for this https://github.com/InfluxCommunity/influxdb3-go/compare/feat/writeIfaceArray
User can use client.WriteData(ctx, points...)
when the collection of annotated structs is a []interface{}
slice. If there is a need to keep the points in strongly typed slice ([]T
), conversion to slice of interfaces is straightforward.
I'm for closing this with wontfix
label. Other opinions?
User can use
client.WriteData(ctx, points...)
when the collection of annotated structs is a[]interface{}
slice. If there is a need to keep the points in strongly typed slice ([]T
), conversion to slice of interfaces is straightforward.
@alespour nice hint 👍
I'm for closing this with
wontfix
label. Other opinions?
I agree
@bednar @alespour I created my own function to convert my custom slice to slice of any so I think the issue can be closed.
Use Case
Currently the Write API has the methods.
and
It would also be useful to be able to write batches/collections of a generic interface type.
Expected behavior
When I've a collection of objects of a local type, I would like to write them in one call using the
points ...inteface{}
idiom.Actual behavior
Currently this requires repeated calls, in a loop to one of the methods mentioned under Use Case
Additional info
I've made a simple sequential implementation of this locally.