-
Notifications
You must be signed in to change notification settings - Fork 178
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
Organizing/modeling Views #32
Comments
Hi Felix, to iterate over all key-value pairs of a table, we use And yes, we do have plans to extend the docs. Have you checked this blog post? We should probably link it in the README at some point. |
Hi, thanks for your reply. I think |
Hey @felixbecker, we just merged #33. This gives you access to an iterator that iterates over the whole view. Let me know if any issues arise. Example assuming string values: state, err = view.Iterator()
if err != nil {
log.Fatalf("error getting iterator: %v", err)
}
defer state.Release()
for state.Next() {
key := state.Key()
val, err := state.Value()
if err != nil {
log.Fatalf("error getting value from iterator: %v", err)
}
log.Printf("key: %s, value: %s", string(key), val.(string))
} |
Hi,
I have a question regarding the example-2 which pobpulates an rest api so one can access the number of clicks for a given user-id as key.
How would I implement a list of users with their number of clicks? ( basically a View.all() if this would even make sense ).
Or Would this be something I have to manage in a processor function? Like a slice of users with their id and clicks? Or is there a way to iterate over the keys? What would be the recommended way?
Any plans to extend the docs or examples for more advanced scenarios covering Lookup, Join, Loopback, etc?
Thanks for your feedback in advance.
The text was updated successfully, but these errors were encountered: