EntityFetcher

Trait EntityFetcher 

Source
pub trait EntityFetcher: Send + Sync {
    // Required method
    fn fetch_as_json<'life0, 'life1, 'async_trait>(
        &'life0 self,
        entity_id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn get_sample_entity<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn list_as_json<'life0, 'async_trait>(
        &'life0 self,
        _limit: Option<i32>,
        _offset: Option<i32>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Value>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait for fetching entities dynamically

This allows the link system to enrich links with full entity data without knowing the concrete entity types at compile time.

Required Methods§

Source

fn fetch_as_json<'life0, 'life1, 'async_trait>( &'life0 self, entity_id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch an entity by ID and return it as JSON

§Arguments
  • entity_id - The unique ID of the entity to fetch
§Returns

The entity serialized as JSON, or an error if not found

Provided Methods§

Source

fn get_sample_entity<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get a sample entity for schema introspection

This method returns an entity with all fields populated (can be dummy data) to allow the GraphQL schema generator to discover the entity structure.

Default implementation returns an empty object.

Source

fn list_as_json<'life0, 'async_trait>( &'life0 self, _limit: Option<i32>, _offset: Option<i32>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Value>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List entities with pagination

§Arguments
  • limit - Maximum number of entities to return
  • offset - Number of entities to skip
§Returns

A vector of entities serialized as JSON

Default implementation returns an empty list.

Implementors§