pub trait GrpcSimpleServiceLinked{
Show 23 associated items type LinkedResourceObject; type LinkedData; type LinkedRowData; type LinkedObject; type LinkedUpdateObject; type LinkedList; type LinkedRowDataList; type LinkedResponse; type ResourceObject; type Data; type OtherResourceObject; type OtherList; type OtherData; // Provided methods fn generic_get_by_id<'life0, 'async_trait>( &'life0 self, request: Request<Ids> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::LinkedObject>, Status>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn generic_search<'life0, 'async_trait>( &'life0 self, request: Request<AdvancedSearchFilter> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::LinkedRowDataList>, Status>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn generic_unlink<'life0, 'async_trait>( &'life0 self, request: Request<Id> ) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn generic_get_linked_ids<'life0, 'async_trait>( &'life0 self, request: Request<Id> ) -> Pin<Box<dyn Future<Output = Result<Response<IdList>, Status>> + Send + 'async_trait>> where Self: Send + 'async_trait + Sync, 'life0: 'async_trait { ... } fn generic_get_linked<'life0, 'async_trait>( &'life0 self, request: Request<Id> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::OtherList>, Status>> + Send + 'async_trait>> where Self: Send + 'async_trait + Sync, 'life0: 'async_trait { ... } fn _get_linked<'async_trait>( id: Id ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ArrErr>> + Send + 'async_trait>> where Self: Send + 'async_trait { ... } fn generic_insert<'life0, 'async_trait>( &'life0 self, request: Request<Self::LinkedRowData> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::LinkedResponse>, Status>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn generic_update<'life0, 'async_trait>( &'life0 self, request: Request<Self::LinkedUpdateObject> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::LinkedResponse>, Status>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn generic_delete<'life0, 'async_trait>( &'life0 self, request: Request<Ids> ) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn generic_is_ready<'life0, 'async_trait>( &'life0 self, _request: Request<ReadyRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<ReadyResponse>, Status>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

Generic gRPC object traits to provide wrappers for common Resource functions

T: ResourceObject<Data> combined resource Resource type U: Data combined resource Data type V: ResourceObject<super::Data> Resource type of ‘super’ resource being linked W: super::Data Data type of ‘super’ resource being linked

Required Associated Types§

source

type LinkedResourceObject

The type expected for the Self::ResourceObject<Self::Data> type of the linked resource. Must implement; ObjectType<Self::Data>, PsqlType, PsqlSearch, SimpleResourceLinked<Self::Data>, PsqlObjectType<Self::Data>, From<[Id]>, From<[Self::Data]>, From<[Self::UpdateObject]>, Clone, Sync, Send

source

type LinkedData

The type expected for the Data struct of the linked resource. Must implement; GrpcDataObjectType, TryFrom<[Row]>

source

type LinkedRowData

The type expected for the RowData struct of the linked resource. Must implement; TryFrom<[Row]>

source

type LinkedObject

The type expected for the Object struct of the linked resource. Must implement; From<[Self::LinkedResourceObject]>

source

type LinkedUpdateObject

The type expected for the UpdateObject struct of the linked resourceLinked. Must implement; Send

source

type LinkedList

The type expected for the List struct of the linked resource. Must implement; TryFrom<[Vec<Row>]>

source

type LinkedRowDataList

The type expected for the RowDataList struct of the linked resource. Must implement; TryFrom<[Vec<Row>]>

source

type LinkedResponse

The type expected for the Response struct of the linked resource. Must implement; TryFrom<[Vec<Row>]>

source

type ResourceObject

The type expected for the Self::ResourceObject<Self::Data> type of the ‘main’ resource. Must implement; ObjectType<Self::Data>, PsqlType, PsqlSearch, SimpleResource<Self::Data>, [PsqlObjectType<Self::Data>], From<[Id]>, From<[Self::Data]>, From<[Self::UpdateObject]>, Clone, Sync, Send

source

type Data

The type expected for the Data struct of the ‘main’ resource. Must implement; GrpcDataObjectType, TryFrom<[Row]>

source

type OtherResourceObject

The type expected for the Self::ResourceObject<Self::Data> type of the ‘other’ resource. Must implement; ObjectType<Self::Data>, PsqlType, PsqlSearch, SimpleResource<Self::Data>, [PsqlObjectType<Self::Data>], From<[Id]>, From<[Self::Data]>, From<[Self::UpdateObject]>, Clone, Sync, Send

source

type OtherList

The type expected for the List struct of the ‘other’ resource. Must implement; TryFrom<Vec<Row>>

source

type OtherData

The type expected for the Data struct of the ‘other’ resource. Must implement; GrpcDataObjectType, TryFrom<[Row]>

Provided Methods§

source

fn generic_get_by_id<'life0, 'async_trait>( &'life0 self, request: Request<Ids> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::LinkedObject>, Status>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Returns a tonic gRCP Response containing an object of provided type Self::LinkedObject. Self::Object will contain the record data found for the provided Ids.

Errors

Returns Status with Code::NotFound if no record is returned from the database.
Returns Status with Code::Internal if the provided Ids can not be converted to valid uuid::Uuids.
Returns Status with Code::Internal if the resulting [Row] data could not be converted into Self::LinkedObject.

Returns a tonic gRCP Response containing an object of provided type Self::LinkedRowDataList. Self::Object(TryFrom<Vec<Row>>) will contain all records found in the database using the the provided AdvancedSearchFilter.

This method supports paged results.

Errors

Returns Status with Code::Internal if any error is returned from the db search result.
Returns Status with Code::Internal if the resulting Vec<Row> data could not be converted into Self::LinkedObject.

Returns an empty tonic gRCP Response on success

Removes all entries from the link table for the given id. The existence of the provided resource id will be validated before unlink.

Errors

Returns Status with Code::NotFound if no record exists for the given id. Returns Status with Code::Internal if the provided Id can not be converted to valid uuid::Uuid.
Returns Status with Code::Internal if any error is returned from the db search result.

source

fn generic_get_linked_ids<'life0, 'async_trait>( &'life0 self, request: Request<Id> ) -> Pin<Box<dyn Future<Output = Result<Response<IdList>, Status>> + Send + 'async_trait>>
where Self: Send + 'async_trait + Sync, 'life0: 'async_trait,

Returns a tonic gRCP Response with IdList of found ids on success

The existence of the provided resource id will be validated first.

X: ResourceObject<other::Data> Resource type of ‘other’ resource being linked Y: other::Data Data type of ‘other’ resource being linked

Errors

Returns Status with Code::NotFound if no record exists for the given id. Returns Status with Code::Internal if the provided Id can not be converted to a uuid::Uuid.
Returns Status with Code::Internal if any error is returned from the db search result.

source

fn generic_get_linked<'life0, 'async_trait>( &'life0 self, request: Request<Id> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::OtherList>, Status>> + Send + 'async_trait>>
where Self: Send + 'async_trait + Sync, 'life0: 'async_trait,

Returns a tonic gRCP Response containing an object of provided type Self::OtherList.

The existence of the provided resource id will be validated first.

X: ResourceObject<other::Data> Resource type of ‘other’ resource being linked Y: other::Data Data type of ‘other’ resource being linked Z: other::List List type of ‘other’ resource being linked

Errors

Returns Status with Code::NotFound if no record exists for the given id. Returns Status with Code::Internal if the provided Id can not be converted to a uuid::Uuid.
Returns Status with Code::Internal if any error is returned from the db search result.

source

fn _get_linked<'async_trait>( id: Id ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ArrErr>> + Send + 'async_trait>>
where Self: Send + 'async_trait,

Internal function used for generic_get_linked_ids and generic_get_linked

source

fn generic_insert<'life0, 'async_trait>( &'life0 self, request: Request<Self::LinkedRowData> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::LinkedResponse>, Status>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Returns a tonic gRCP Response containing an object of provided type Self::LinkedResponse. Self::Response(From<GenericResourceResult<Self::LinkedResourceObject, Self::Data>>) will contain the inserted record after saving the provided data Self::LinkedRowData.

The given data will be validated before insert.
Any errors found during validation will be added to the ValidationResult.

Errors

Returns Status with Code::Internal if the Request doesn’t contain any data.
Returns Status with Code::Internal if any error is returned from a db call.

source

fn generic_update<'life0, 'async_trait>( &'life0 self, request: Request<Self::LinkedUpdateObject> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::LinkedResponse>, Status>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Returns a tonic gRCP Response containing an object of provided type Self::LinkedResourceObject. Self::Response(From<GenericResourceResult<Self::LinkedResourceObject, Self::Data>>) will contain the updated record after saving the provided data Self::LinkedUpdateObject.

The given data will be validated before insert. Any errors found during validation will be added to the ValidationResult. A field prost_types::FieldMask can be provided to restrict updates to specific fields.

Errors

Returns Status with Code::Cancelled if the Request doesn’t contain any data.
Returns Status with Code::Internal if any error is returned from a db call.
Returns Status with Code::Internal if the provided Ids can not be converted to valid uuid::Uuids.
Returns Status with Code::Internal if the resulting [Row] data could not be converted into Self::Data.

source

fn generic_delete<'life0, 'async_trait>( &'life0 self, request: Request<Ids> ) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Takes an Id to set the matching database record as deleted in the database.

Errors

Returns Status with Code::NotFound if no record is returned from the database.
Returns Status with Code::Internal if any error is returned from a db call.

source

fn generic_is_ready<'life0, 'async_trait>( &'life0 self, _request: Request<ReadyRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<ReadyResponse>, Status>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Returns ready:true when service is available

Object Safety§

This trait is not object safe.

Implementors§