Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryIterator: add method to return stream or container of Point objects #61

Open
karel-rehor opened this issue Feb 9, 2024 · 0 comments
Assignees

Comments

@karel-rehor
Copy link
Contributor

Use Case

It seems that a common idiom in some implementations is translating from a local type to Point and vice versa.

e.g.

func (w *Widget)ToPoint(measurement string) *influxdb3.Point {...}
...
func WidgetFromPoint(point *influxdb3.Point) *Widget {...}

And this would apply as well to containers or streams of local objects. The Downsampling example encourages the use of PointValues when dealing with query results, however sticking to translations between just Point and LocalType is semantically simpler and cleaner. Since downsampling involves writing data back to the server and the write API uses Points, it would be handy to work directly with Points from query results, without exposing underlying PointValues.

Granted such a method could entail a slight performance hit, so this is not to suggest that the current approach should be entirely replaced.

Expected behavior

Since the Point type is preferred in the Write API it should also be easy to work with in the QueryAPI and this would include containers or streams of Point.

Actual behavior

The Query API's QueryIterator has a method AsPoints that returns *PointValues. This of course is not a Point container or stream. Furthermore it gives precedent to the PointValue type, which in the WriteAPI is hidden within Point

Additional info

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant