RelationEntity

Trait RelationEntity 

Source
pub trait RelationEntity:
    FieldSet
    + TryFrom<Relation>
    + TryFrom<UnboundedRelation> {
    type Id: RelationId<T = Self>;

    // Required method
    fn identifier(&self) -> Self::Id;

    // Provided methods
    fn into_identifier(self) -> Self::Id { ... }
    fn create<S: NodeEntity, E: NodeEntity>(
        &self,
        start: RelationBound<'_, S>,
        end: RelationBound<'_, E>,
    ) -> Query { ... }
    fn update(&self) -> Query { ... }
    fn update_from<T: NodeId>(&self, from: &T) -> Query { ... }
    fn update_between<S: NodeId, E: NodeId>(&self, start: &S, end: &E) -> Query { ... }
}
Expand description

A relationship entity.

Required Associated Types§

Source

type Id: RelationId<T = Self>

Required Methods§

Source

fn identifier(&self) -> Self::Id

Get the RelationId for this entity.

This is less efficient than using self.into(), but is useful when you don’t want to consume the entity.

The implementation in derive will clone the individual ID fields as necessary.

Provided Methods§

Source

fn into_identifier(self) -> Self::Id

Convenience method for self.into().

Source

fn create<S: NodeEntity, E: NodeEntity>( &self, start: RelationBound<'_, S>, end: RelationBound<'_, E>, ) -> Query

Source

fn update(&self) -> Query

Use only for relations that have one or more ID fields, otherwise use the other update_ methods.

This will update all relations of the same type if FieldSet::field_names() is empty.

Treats the current values as the desired values and does a merge update (SET r += ...).

NOTE: Does not support changing the identifier fields.

Source

fn update_from<T: NodeId>(&self, from: &T) -> Query

Treats the current values as the desired values and does a merge update (SET r += ...).

NOTE: Does not support changing the identifier fields.

Source

fn update_between<S: NodeId, E: NodeId>(&self, start: &S, end: &E) -> Query

Treats the current values as the desired values and does a merge update (SET r += ...).

NOTE: Does not support changing the identifier fields.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§