We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi all,
I'm kinda stuck on using the Get() function.
My result should return three DB entries which I try to retrieve like this: result, err := txn.Get("foobar", "RefType", refType)
result, err := txn.Get("foobar", "RefType", refType)
How do I go over the results one by one?
Thanks!
The text was updated successfully, but these errors were encountered:
Hi @bobvanluijt you call .Next() on it to iterate through the items - see https://github.com/hashicorp/go-memdb/blob/master/txn_test.go#L451-L467 for an example. You have to call .Next() one time to get the first item, and it will return nil when the iterator is exhausted, so you can also do:
.Next()
nil
result, err := txn.Get("foobar", "RefType", refType) if err != nil { return err } for item := result.Next(); item != nil; item = result.Next() { // handle each item }
Hope that helps!
Sorry, something went wrong.
Ooo, thanks for that!
You should put it in the README, very useful ! I was also stuck !
No branches or pull requests
Hi all,
I'm kinda stuck on using the Get() function.
My result should return three DB entries which I try to retrieve like this:
result, err := txn.Get("foobar", "RefType", refType)
How do I go over the results one by one?
Thanks!
The text was updated successfully, but these errors were encountered: