-
Notifications
You must be signed in to change notification settings - Fork 458
Add filter to Accounts entity to allow searching in account.asset field #3990
Comments
@lsilvs Would it be possible to provide a way for bApp developers to dynamically define new filters like this one? I think it could add a lot of flexibility to the sdk :) |
I agree. It's not straightforward but we should work on it. |
I did a quick research and one option would be create two extra filters for the asset_contains
Assuming we have the following accounts: aliceAccount.asset = { "name": "Alice", "company": "Acme Corp" };
bobAccount.asset = { "name": "Bob", "company": "Acme Corp" }; The following calls will return storage.entities.Account.get({ asset_contains: '{ "name": "Alice", "company": "Acme Corp" }' });
storage.entities.Account.get({ asset_contains: '{ "name": "Alice"' }); The following calls will return storage.entities.Account.get({ asset_contains: '{ "name": "Bob", "company": "Acme Corp" }' });
storage.entities.Account.get({ asset_contains: '{ "name": "Bob"' }); The following call will return storage.entities.Account.get({ asset_contains: '{ "company": "Acme Corp" }' }); asset_exists
Assuming we have the following accounts: aliceAccount.asset = { "name": "Alice", "height": "1.79" };
bobAccount.asset = { "name": "Bob", "weight": "74" }; The following call will return storage.entities.Account.get({ asset_exists: 'height' }); The following call will return storage.entities.Account.get({ asset_exists: 'weight' }); The following call will return storage.entities.Account.get({ asset_exists: 'name' }); Note that we can only assert for exact value. In order to allow searches with |
…ebased Add filter to Accounts entity to allow searching in account.asset field - Closes #3990
Expected behavior
I should be able to search in asset (jsonb) field.
Example:
The filter name could be something else like
asset_matches
etc.Actual behavior
We don't have a filter at the moment.
Steps to reproduce
Which version(s) does this affect? (Environment, OS, etc...)
2.1.0+
The text was updated successfully, but these errors were encountered: