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 should not panic on error #79

Open
alespour opened this issue Apr 9, 2024 · 2 comments · May be fixed by #131
Open

QueryIterator should not panic on error #79

alespour opened this issue Apr 9, 2024 · 2 comments · May be fixed by #131
Assignees
Labels
bug Something isn't working

Comments

@alespour
Copy link
Contributor

alespour commented Apr 9, 2024

Specifications

  • Package Version: 0.6.0
  • InfluxDB Version: Cloud

Code sample to reproduce problem

When result contains unsupported data type, the following calls may cause panic.

ok := iterator.Next()
// or
pv := iterator.AsPoints()


Expected behavior

Next() and AsPoints() should not panic, but somehow return error.

Next methods could be changed according to these iterator guidelines and AsPoints similarly. ie

func (i *QueryIterator) Next() (map[string]interface{}, error) // how about adding a new type (or alias) for the value?
func (i *QueryIterator) AsPoints() (*PointValues, error)

This renders Value method useless, btw.

So perhaps adding a new iterator type designed according to the guidelines, and deprecating the existing one would be a better solution.

Actual behavior

panic may occur

Additional info

No response

@alespour alespour added the bug Something isn't working label Apr 9, 2024
@NguyenHoangSon96
Copy link

Hi @alespour 😊
I will take care of this ticket, but I have a question
func (i *QueryIterator) Next() (map[string]interface{}, error) // how about adding a new type (or alias) for the value?
It already has PointValues to prepresent a row. So... Can you clarify this?

@alespour
Copy link
Contributor Author

Hi @NguyenHoangSon96 I missed that there already is such a type, the comment can be ignored then. Thanks :)

@NguyenHoangSon96 NguyenHoangSon96 self-assigned this Jan 20, 2025
@NguyenHoangSon96 NguyenHoangSon96 linked a pull request Jan 20, 2025 that will close this issue
6 tasks
@NguyenHoangSon96 NguyenHoangSon96 linked a pull request Jan 20, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants