Trait svc_storage::grpc::GrpcSimpleServiceLinked
source · pub trait GrpcSimpleServiceLinkedwhere
Self::LinkedResourceObject: ObjectType<Self::LinkedData> + PsqlType + PsqlSearch + SimpleResourceLinked<Self::LinkedData> + PsqlObjectType<Self::LinkedData> + From<Ids> + From<Self::LinkedData> + From<Self::LinkedUpdateObject> + From<Self::LinkedRowData> + Clone + Sync + Send,
Self::LinkedData: GrpcDataObjectType + TryFrom<Row>,
Self::LinkedRowData: GrpcDataObjectType + TryFrom<Row>,
Self::LinkedList: TryFrom<Vec<Row>>,
Self::LinkedRowDataList: TryFrom<Vec<Row>>,
Self::LinkedObject: From<Self::LinkedResourceObject>,
Self::LinkedUpdateObject: Send,
Self::LinkedResponse: From<GenericResourceResult<Self::LinkedResourceObject, Self::LinkedData>>,
Self::ResourceObject: ObjectType<Self::Data> + PsqlType + PsqlSearch + SimpleResource<Self::Data> + PsqlObjectType<Self::Data> + From<Id> + From<Self::Data> + Clone + Sync + Send,
Self::Data: GrpcDataObjectType + TryFrom<Row>,
Self::OtherResourceObject: ObjectType<Self::OtherData> + PsqlType + PsqlSearch + SimpleResource<Self::OtherData> + PsqlObjectType<Self::OtherData> + From<Id> + From<Self::OtherData> + Clone + Sync + Send,
Self::OtherData: GrpcDataObjectType + TryFrom<Row>,
Self::OtherList: TryFrom<Vec<Row>>,
Status: From<<Self::LinkedData as TryFrom<Row>>::Error> + From<<Self::LinkedRowDataList as TryFrom<Vec<Row>>>::Error> + From<<Self::OtherList as TryFrom<Vec<Row>>>::Error>,{
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§
sourcetype LinkedResourceObject
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
sourcetype LinkedData
type LinkedData
The type expected for the Data struct of the linked resource.
Must implement; GrpcDataObjectType, TryFrom<[Row]>
sourcetype LinkedRowData
type LinkedRowData
The type expected for the RowData struct of the linked resource.
Must implement; TryFrom<[Row]>
sourcetype LinkedObject
type LinkedObject
The type expected for the Object struct of the linked resource.
Must implement; From<[Self::LinkedResourceObject]>
sourcetype LinkedUpdateObject
type LinkedUpdateObject
The type expected for the UpdateObject struct of the linked resourceLinked.
Must implement; Send
sourcetype LinkedList
type LinkedList
The type expected for the List struct of the linked resource.
Must implement; TryFrom<[Vec<Row>]>
sourcetype LinkedRowDataList
type LinkedRowDataList
The type expected for the RowDataList struct of the linked resource.
Must implement; TryFrom<[Vec<Row>]>
sourcetype LinkedResponse
type LinkedResponse
The type expected for the Response struct of the linked resource.
Must implement; TryFrom<[Vec<Row>]>
sourcetype ResourceObject
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
sourcetype Data
type Data
The type expected for the Data struct of the ‘main’ resource.
Must implement; GrpcDataObjectType, TryFrom<[Row]>
sourcetype OtherResourceObject
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
sourcetype OtherList
type OtherList
The type expected for the List struct of the ‘other’ resource.
Must implement; TryFrom<Vec<Row>>
sourcetype OtherData
type OtherData
The type expected for the Data struct of the ‘other’ resource.
Must implement; GrpcDataObjectType, TryFrom<[Row]>
Provided Methods§
sourcefn 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_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.
sourcefn 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_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,
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.
sourcefn 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_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,
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.
sourcefn generic_get_linked_ids<'life0, 'async_trait>(
&'life0 self,
request: Request<Id>
) -> Pin<Box<dyn Future<Output = Result<Response<IdList>, Status>> + Send + '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>>
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.
sourcefn generic_get_linked<'life0, 'async_trait>(
&'life0 self,
request: Request<Id>
) -> Pin<Box<dyn Future<Output = Result<Response<Self::OtherList>, Status>> + Send + '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>>
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.
sourcefn _get_linked<'async_trait>(
id: Id
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ArrErr>> + Send + 'async_trait>>where
Self: Send + '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,
Internal function used for generic_get_linked_ids and generic_get_linked
sourcefn 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_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.
sourcefn 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_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.
sourcefn 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_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.
sourcefn 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,
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