pub struct GenericGrpcService<E, C, U, S>where
E: Clone + Send + Sync + 'static,
C: Send + Sync + 'static,
U: Send + Sync + 'static,
S: GrpcCapableService<E, C, U>,{ /* private fields */ }Expand description
Generic gRPC service — mirrors BackboneCrudHandler for the gRPC transport.
Generated code emits a type alias:
ⓘ
// Generated (was ~300 lines of proto dispatch boilerplate):
pub type OrderGrpcService = GenericGrpcService<
Order, CreateOrderDto, UpdateOrderDto, OrderService
>;Custom extensions go in the // <<< CUSTOM decorator wrapper.
Implementations§
Source§impl<E, C, U, S> GenericGrpcService<E, C, U, S>
impl<E, C, U, S> GenericGrpcService<E, C, U, S>
pub fn new(service: Arc<S>) -> Self
pub fn service(&self) -> &Arc<S> ⓘ
pub async fn rpc_list(
&self,
page: u32,
limit: u32,
filters: HashMap<String, String>,
) -> GrpcResponse<GrpcListResponse<E>>where
E: Serialize + for<'de> Deserialize<'de>,
pub async fn rpc_create(&self, dto: C) -> GrpcResponse<E>where
E: Serialize + for<'de> Deserialize<'de>,
pub async fn rpc_get_by_id(&self, id: &str) -> GrpcResponse<Option<E>>where
E: Serialize + for<'de> Deserialize<'de>,
pub async fn rpc_update(&self, id: &str, dto: U) -> GrpcResponse<Option<E>>where
E: Serialize + for<'de> Deserialize<'de>,
pub async fn rpc_soft_delete(&self, id: &str) -> GrpcResponse<bool>
pub async fn rpc_restore(&self, id: &str) -> GrpcResponse<Option<E>>where
E: Serialize + for<'de> Deserialize<'de>,
pub async fn rpc_list_deleted(
&self,
page: u32,
limit: u32,
) -> GrpcResponse<GrpcListResponse<E>>where
E: Serialize + for<'de> Deserialize<'de>,
pub async fn rpc_empty_trash(&self) -> GrpcResponse<u64>
Auto Trait Implementations§
impl<E, C, U, S> Freeze for GenericGrpcService<E, C, U, S>
impl<E, C, U, S> RefUnwindSafe for GenericGrpcService<E, C, U, S>
impl<E, C, U, S> Send for GenericGrpcService<E, C, U, S>
impl<E, C, U, S> Sync for GenericGrpcService<E, C, U, S>
impl<E, C, U, S> Unpin for GenericGrpcService<E, C, U, S>
impl<E, C, U, S> UnsafeUnpin for GenericGrpcService<E, C, U, S>
impl<E, C, U, S> UnwindSafe for GenericGrpcService<E, C, U, S>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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