-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add more stream functions #24
base: master
Are you sure you want to change the base?
Conversation
a3ac3c4
to
79f0ca6
Compare
crates/sui-graphql-client/src/lib.rs
Outdated
after: Option<String>, | ||
before: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why require an owned string now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I did like this because I need to pass the event filter in the streams calls, so I needed to clone it. Maybe I can just pass a reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bmwill this is what I came up with, what do you think?
d17b3cc
to
8896fb3
Compare
8896fb3
to
5de3cc3
Compare
@stefan-mysten I wonder...this PR has quite a bit of repetitive code, would it be possible to generalize this and have a generic "stream" query function that can be reused everywhere? As in we have a function for issuing a generic graphql request, can we have something similar (with the constraint that we may have paging information that is standardized) that will be used as inputs into the query, we could then let anyone trivially run a pagable query as a stream |
@bmwill Interesting idea, yes, I can think we can try that. I'll give it a go and see if I can make it work! |
@bmwill I looked into this over the weekend. I think it's doable, the only issue is how to "rebuild" the query with a new set of variables (because the cursor changes and we need to re-run the query to fetch the next page with a different after condition) programmatically. I stumbled a bit over this and couldn't find a clean and straightforward way. |
No description provided.