Trait fuel_indexer_plugin::wasm::Entity
source · pub trait Entity<'a>: Sized + PartialEq + Eq + Debug {
const TYPE_ID: i64;
const JOIN_METADATA: Option<[Option<JoinMetadata<'a>>; 10]>;
// Required methods
fn from_row(vec: Vec<FtColumn>) -> Self;
fn to_row(&self) -> Vec<FtColumn>;
// Provided methods
fn type_id(&self) -> i64 { ... }
fn save_many_to_many(&self) { ... }
fn load(id: UID) -> Option<Self> { ... }
fn load_unsafe(id: UID) -> Option<Self> { ... }
fn find(filter: impl Into<SingleFilter<Self>>) -> Option<Self> { ... }
fn find_many(filter: impl Into<ManyFilter<Self>>) -> Vec<Self> { ... }
fn save(&self) { ... }
fn save_unsafe(&self) { ... }
}
Expand description
Trait for a type entity.
Any entity type that will be processed through a WASM indexer is required to implement this trait.
Required Associated Constants§
sourceconst JOIN_METADATA: Option<[Option<JoinMetadata<'a>>; 10]>
const JOIN_METADATA: Option<[Option<JoinMetadata<'a>>; 10]>
Necessary metadata for saving an entity’s list type fields.
Required Methods§
Provided Methods§
sourcefn save_many_to_many(&self)
fn save_many_to_many(&self)
Saves a record that contains a list of multiple elements.
sourcefn load_unsafe(id: UID) -> Option<Self>
fn load_unsafe(id: UID) -> Option<Self>
Loads a record through the FFI with the WASM runtime and checks for errors.
sourcefn find(filter: impl Into<SingleFilter<Self>>) -> Option<Self>
fn find(filter: impl Into<SingleFilter<Self>>) -> Option<Self>
Finds the first entity that satisfies the given constraints.
sourcefn find_many(filter: impl Into<ManyFilter<Self>>) -> Vec<Self>
fn find_many(filter: impl Into<ManyFilter<Self>>) -> Vec<Self>
Finds the entities that satisfy the given constraints.
sourcefn save_unsafe(&self)
fn save_unsafe(&self)
Saves a record through the FFI with the WASM runtime and checks for errors.
Object Safety§
This trait is not object safe.