pub struct PostgresDatabase<TR, TA, CA, C> { /* private fields */ }Trait Implementations§
Source§impl<TR: Clone, TA: Clone, CA: Clone, C: Clone> Clone for PostgresDatabase<TR, TA, CA, C>
impl<TR: Clone, TA: Clone, CA: Clone, C: Clone> Clone for PostgresDatabase<TR, TA, CA, C>
Source§fn clone(&self) -> PostgresDatabase<TR, TA, CA, C>
fn clone(&self) -> PostgresDatabase<TR, TA, CA, C>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<TR, TA, CA, C> Database for PostgresDatabase<TR, TA, CA, C>where
TR: TransformRequest + Send + Sync + for<'a> Deserialize<'a> + Serialize,
TA: TransformAttempt<TransformRequestIdentifier = TR::Identifier, CallArgsType = TR::Input, ReturnType = TR::Output> + Send + Sync + DeserializeOwned + Serialize,
CA: ConsumeAttempt<TransformRequestIdentifier = TR::Identifier, TransformAttemptIdentifier = TA::Identifier, ConsumeVal = TR::Output> + Send + Sync + DeserializeOwned + Serialize,
C: Config<KeyType = String, ValueType = Vec<u8>>,
TR::Input: Serialize + DeserializeOwned,
TR::Output: Serialize + DeserializeOwned,
CA::Identifier: Serialize + DeserializeOwned,
CA::ReturnCtx: Serialize + DeserializeOwned,
TR::Identifier: Serialize + DeserializeOwned,
TA::Identifier: Serialize + DeserializeOwned,
TA::ReturnPackage: Serialize + DeserializeOwned,
To create a custom table based on your requirements
For example: The input struct is
impl<TR, TA, CA, C> Database for PostgresDatabase<TR, TA, CA, C>where
TR: TransformRequest + Send + Sync + for<'a> Deserialize<'a> + Serialize,
TA: TransformAttempt<TransformRequestIdentifier = TR::Identifier, CallArgsType = TR::Input, ReturnType = TR::Output> + Send + Sync + DeserializeOwned + Serialize,
CA: ConsumeAttempt<TransformRequestIdentifier = TR::Identifier, TransformAttemptIdentifier = TA::Identifier, ConsumeVal = TR::Output> + Send + Sync + DeserializeOwned + Serialize,
C: Config<KeyType = String, ValueType = Vec<u8>>,
TR::Input: Serialize + DeserializeOwned,
TR::Output: Serialize + DeserializeOwned,
CA::Identifier: Serialize + DeserializeOwned,
CA::ReturnCtx: Serialize + DeserializeOwned,
TR::Identifier: Serialize + DeserializeOwned,
TA::Identifier: Serialize + DeserializeOwned,
TA::ReturnPackage: Serialize + DeserializeOwned,
To create a custom table based on your requirements For example: The input struct is
struct Person {
name: String,
address: String,
phone: String,
}
pub trait PersonTrait {
fn get_name(&self) -> String;
fn get_address(&self) -> String;
fn get_phone(&self) -> String;
}
impl Database for PostgresDatabase
where
TR::Input: PersonTrait
...
{
}
You can do the sane to output, transform attempt, transform request and consume attempt
And, store the relevant things to the database.type Config = C
type ConsumeAttempt = CA
type DatabaseError = PostgresDatabaseError
type Input = <TR as TransformRequest>::Input
type Output = <TR as TransformRequest>::Output
type TransformAttempt = TA
type TransformRequest = TR
fn new<'async_trait>(
ctx: Arc<Mutex<Self::Config>>,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn get_dyn_configs<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Vec<(<Self::Config as Config>::KeyType, <Self::Config as Config>::ValueType)>, Self::DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register_transform_request<'life0, 'life1, 'async_trait>(
&'life0 mut self,
request: &'life1 Self::TransformRequest,
) -> Pin<Box<dyn Future<Output = Result<(), Self::DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn register_transform_attempt<'life0, 'life1, 'async_trait>(
&'life0 mut self,
attempt: &'life1 Self::TransformAttempt,
) -> Pin<Box<dyn Future<Output = Result<(), Self::DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_transform_attempt<'life0, 'life1, 'async_trait>(
&'life0 mut self,
attempt: &'life1 WorkerManagerResult<Self::TransformAttempt>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn register_consume_attempt<'life0, 'life1, 'async_trait>(
&'life0 mut self,
attempt: &'life1 Self::ConsumeAttempt,
) -> Pin<Box<dyn Future<Output = Result<(), Self::DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_consume_attempt<'life0, 'async_trait>(
&'life0 mut self,
attempt: ConsumeAttemptResult<Self::ConsumeAttempt>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn archive_request_with_id<'life0, 'life1, 'async_trait>(
&'life0 mut self,
request_id: &'life1 <Self::TransformRequest as TransformRequest>::Identifier,
) -> Pin<Box<dyn Future<Output = Result<(), Self::DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl<TR, TA, CA, C> Freeze for PostgresDatabase<TR, TA, CA, C>
impl<TR, TA, CA, C> !RefUnwindSafe for PostgresDatabase<TR, TA, CA, C>
impl<TR, TA, CA, C> Send for PostgresDatabase<TR, TA, CA, C>
impl<TR, TA, CA, C> Sync for PostgresDatabase<TR, TA, CA, C>
impl<TR, TA, CA, C> Unpin for PostgresDatabase<TR, TA, CA, C>
impl<TR, TA, CA, C> UnsafeUnpin for PostgresDatabase<TR, TA, CA, C>
impl<TR, TA, CA, C> !UnwindSafe for PostgresDatabase<TR, TA, CA, C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more