Closed chlenc closed 11 months ago
Found solution here https://github.com/FuelLabs/fuel-indexer/blob/fefbf2c1f8addb952bb78cb95f28ee2cee041d4e/packages/fuel-indexer-tests/indexers/fuel-indexer-test/src/lib.rs#L597
this code works for me
let entity = OrderEntity::find(OrderEntity::id().eq(id));
But there is no .delete method
We generate functions for each field in each entity. Entity::field_name() -> Field<u32, Entity> And Field has impl gt, eq, and so on. There’s also asc() and desc() and limit() for use with find_many
I just faced a problem
when I try to find an entity by id
let entity = OrderEntity::find(OrderEntity::id().eq(id));
indexer fails with error from screenshot during deployment
and print this message in fuel-indexer
service
Failed to get WASM module toolchain version: Error while importing "env"."ff_find_many": incompatible import type. Expected Function(FunctionType { params: [I64, I32, I32], results: [I32] }) but received Function(FunctionType { params: [I64, I64, I32, I32], results: [I32] })
@chlenc
For now I made active: bool
instead of deleting, I but thanks for supporting this, I'll use it in future versions of the spark indexer.
How to find and remove entity by id?
Hi frens, in my indexer I have
AccountBalance
data, and to avoid excessive loops on the sway side we decided to remove zero AccountBalances, after removingAccountBalance
on sway I gonna getOption::None
on the indexer and want to find and remove that data by idlet id = uid([event.trader.to_string(), event.token.to_string()].concat());
Can you help me to do that?
My toolchain