Replies: 1 comment 4 replies
-
hey, really like the syntax obviously, the fluent interface is familiar from many other ORMs. I was wondering if the following will be valid, or if you need to specify all query paramters up front: const userScoped = contract.table('delband').query({ scope: 'teamgreymass' });
await userScoped.query({ lower_bound: Name.from('foo') }).first();
await userScoped.query({ lower_bound: Name.from('bar') }).first(); (in this example loading the entire table might make more sense performance wise, but in other cases it might make more sense) I was also asking myself if it would be a good idea to align the syntax a bit more with the cdt: const tableAccessor = contract.table('delband', 'teamgreymass');
tableAccessor.all();
// or
tableAccessor.query({ lower_bound: Name.from('foo') }).all(); this would maybe also reduce the need for allowing |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I mentioned on today's call how I had been using the contract kit in a development version of unicove.com, and wanted to throw something together to highlight how one query has evolved for us through our apps.
We used eosjs in Anchor originally, then moved to eosio-core for Unicove, now Unicove to the contract kit. The sample below shows the syntax of all 3 for the same query we used to load delegated balances for an account.
Each of these async calls would go out to
get_table_rows
and make the same request.I'm hoping these 3 simple code samples side by side can help illustrate what this new syntax looks like and what to expect from the contract kit, at least for those of you who’d been in the trenches building against the get_table_rows APIs with us 😉
Any feedback on desirable syntax is very much welcome.
Beta Was this translation helpful? Give feedback.
All reactions