pub trait RelationAPI: ThingAPI + Clone + Into<Relation> {
    // Provided methods
    fn add_role_player<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        role_type: RoleType,
        player: Thing
    ) -> BoxPromise<'tx, Result> { ... }
    fn remove_role_player<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        role_type: RoleType,
        player: Thing
    ) -> BoxPromise<'tx, Result> { ... }
    fn get_players_by_role_type<'tx>(
        &self,
        transaction: &'tx Transaction<'_>,
        role_types: Vec<RoleType>
    ) -> Result<BoxStream<'tx, Result<Thing>>> { ... }
    fn get_role_players<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> Result<BoxStream<'tx, Result<(RoleType, Thing)>>> { ... }
    fn get_relating<'tx>(
        &self,
        transaction: &'tx Transaction<'_>
    ) -> Result<BoxStream<'tx, Result<RoleType>>> { ... }
}

Provided Methods§

source

fn add_role_player<'tx>( &self, transaction: &'tx Transaction<'_>, role_type: RoleType, player: Thing ) -> BoxPromise<'tx, Result>

Adds a new role player to play the given role in this Relation.

Arguments
  • transaction – The current transaction
  • role_type – The role to be played by the player
  • player – The thing to play the role
Examples
relation.add_role_player(transaction, role_type, player).await;
source

fn remove_role_player<'tx>( &self, transaction: &'tx Transaction<'_>, role_type: RoleType, player: Thing ) -> BoxPromise<'tx, Result>

Removes the association of the given instance that plays the given role in this Relation.

Arguments
  • transaction – The current transaction
  • role_type – The role to no longer be played by the thing in this Relation
  • player – The instance to no longer play the role in this Relation
Examples
relation.remove_role_player(transaction, role_type, player).await;
source

fn get_players_by_role_type<'tx>( &self, transaction: &'tx Transaction<'_>, role_types: Vec<RoleType> ) -> Result<BoxStream<'tx, Result<Thing>>>

Retrieves all role players of this Relation, optionally filtered by given role types.

Arguments
  • transaction – The current transaction
  • role_types – 0 or more role types
Examples
relation.get_players_by_role_type(transaction, role_types);
source

fn get_role_players<'tx>( &self, transaction: &'tx Transaction<'_> ) -> Result<BoxStream<'tx, Result<(RoleType, Thing)>>>

Retrieves a mapping of all instances involved in the Relation and the role each play.

Arguments
  • transaction – The current transaction
Examples
relation.get_role_players(transaction)
source

fn get_relating<'tx>( &self, transaction: &'tx Transaction<'_> ) -> Result<BoxStream<'tx, Result<RoleType>>>

Retrieves all role types currently played in this Relation.

Arguments
  • transaction – The current transaction
Examples
relation.get_relating(transaction)

Object Safety§

This trait is not object safe.

Implementors§