Skip to main content

CRUDRepository

Struct CRUDRepository 

Source
pub struct CRUDRepository<T: Entity = Row> { /* private fields */ }

Implementations§

Source§

impl CRUDRepository<Row>

Source

pub fn new( connection: Arc<dyn Connection>, options: CRUDRepositoryOptions, ) -> Result<Self>

Source§

impl<T: SchemaObject> CRUDRepository<T>

Source

pub fn new( connection: Arc<dyn Connection>, options: CRUDRepositoryOptions, ) -> Result<Self>

Source§

impl<T: Entity> CRUDRepository<T>

Source

pub fn with_write(self, write: Arc<dyn WriteEnrichmentStrategy<T>>) -> Self

Source

pub fn add_enriched<TRelated: Entity>( &mut self, enrichment: Enrichment, via: impl EnrichmentVia<TRelated>, strategy: Option<Arc<dyn ReadonlyEnrichmentStrategy<T, TRelated>>>, ) -> &mut Self

Source

pub fn add_linked<TRelated: Entity, TLink: Entity>( &mut self, enrichment: Enrichment, via: impl EnrichmentVia<TRelated>, link: Arc<dyn ICRUDRepository<TLink>>, strategy: Option<Arc<dyn ReadonlyEnrichmentStrategy<T, TRelated>>>, ) -> &mut Self

Source

pub fn add_middleware(&self, middleware: Arc<dyn CommandMiddleware>)

Source

pub async fn create(&self, item: T) -> Result<T>

Source

pub async fn update( &self, item: T, by_where: Option<&dyn IWhere>, ) -> Result<Response>

Source

pub async fn delete( &self, item: T, by_where: Option<&dyn IWhere>, ) -> Result<Response>

Source

pub async fn read_single_by_id(&self, id: &dyn IdKey) -> Result<Option<T>>

Methods from Deref<Target = ReadonlyRepository<T>>§

Source

pub fn schema(&self) -> &Schema

Source

pub fn add_enriched<TRelated: Entity>( &mut self, enrichment: Enrichment, via: impl EnrichmentVia<TRelated>, strategy: Option<Arc<dyn ReadonlyEnrichmentStrategy<T, TRelated>>>, ) -> &mut Self

Source

pub fn add_middleware(&mut self, middleware: Arc<dyn CommandMiddleware>)

Source

pub async fn read_single( &self, query: Option<&dyn Statement>, options: Option<&ReadonlyRepositoryMappingOptions>, ) -> Result<Option<T>>

Source

pub fn read<'a>( &'a self, query: Option<&'a dyn Statement>, options: Option<&'a ReadonlyRepositoryMappingOptions>, ) -> Pin<Box<dyn Stream<Item = Result<T>> + Send + 'a>>

Source

pub async fn read_single_where( &self, clause: &dyn IWhere, options: Option<&ReadonlyRepositoryMappingOptions>, ) -> Result<Option<T>>

Source

pub fn read_where<'a>( &'a self, clause: &'a dyn IWhere, options: Option<&'a ReadonlyRepositoryMappingOptions>, ) -> Pin<Box<dyn Stream<Item = Result<T>> + Send + 'a>>

Trait Implementations§

Source§

impl<T: Entity> Deref for CRUDRepository<T>

Source§

type Target = ReadonlyRepository<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: Entity> DerefMut for CRUDRepository<T>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T: Entity> ICRUDRepository<T> for CRUDRepository<T>

Source§

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

Source§

fn update<'life0, 'life1, 'async_trait>( &'life0 self, item: T, by_where: Option<&'life1 dyn IWhere>, ) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, item: T, by_where: Option<&'life1 dyn IWhere>, ) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn id_names(&self) -> Vec<String>

Source§

fn add_middleware(&self, middleware: Arc<dyn CommandMiddleware>)

Source§

fn read_single_by_id<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 dyn IdKey, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl<T: Entity> IReadonlyRepository<T> for CRUDRepository<T>

Source§

fn to_crud(self: Arc<Self>) -> Option<Arc<dyn ICRUDRepository<T>>>

Source§

fn read_single<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: Option<&'life1 dyn Statement>, options: Option<&'life2 ReadonlyRepositoryMappingOptions>, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn read<'a>( &'a self, query: Option<&'a dyn Statement>, options: Option<&'a ReadonlyRepositoryMappingOptions>, ) -> Pin<Box<dyn Stream<Item = Result<T>> + Send + 'a>>

Source§

fn read_single_where<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, clause: &'life1 dyn IWhere, options: Option<&'life2 ReadonlyRepositoryMappingOptions>, ) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn read_where<'a>( &'a self, clause: &'a dyn IWhere, options: Option<&'a ReadonlyRepositoryMappingOptions>, ) -> Pin<Box<dyn Stream<Item = Result<T>> + Send + 'a>>

Source§

fn is_schema_required(&self) -> bool

Source§

impl<T: Entity> IRepository for CRUDRepository<T>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.