pub struct HookContext<'a> { /* private fields */ }Expand description
Context shared with one generated lifecycle hook.
Pre-hooks receive a mutable context and may add metadata for post-hooks. The generated input is present for insert, put, and update. Delete supplies an IID but has no generated create value. The operation timestamp and metadata remain stable across its pre- and post-hook phases.
Implementations§
Source§impl<'a> HookContext<'a>
impl<'a> HookContext<'a>
Sourcepub const fn type_id_json(&self) -> &'static str
pub const fn type_id_json(&self) -> &'static str
Canonical generated type identity JSON.
Sourcepub const fn type_name(&self) -> &str
pub const fn type_name(&self) -> &str
Provider type label resolved from the generated identity.
Sourcepub const fn model_kind(&self) -> ModelKind
pub const fn model_kind(&self) -> ModelKind
Whether the model is an entity or relation.
Sourcepub const fn operation(&self) -> CrudOperation
pub const fn operation(&self) -> CrudOperation
CRUD operation being performed.
Sourcepub const fn input(&self) -> Option<&EncodedCreate>
pub const fn input(&self) -> Option<&EncodedCreate>
Generated create value for insert, put, or update.
Sourcepub const fn timestamp(&self) -> &SystemTime
pub const fn timestamp(&self) -> &SystemTime
Time at which pre-hook processing for this operation began.
Sourcepub fn metadata(&self) -> &BTreeMap<String, Value>
pub fn metadata(&self) -> &BTreeMap<String, Value>
Read application metadata accumulated by earlier pre-hooks.
Sourcepub fn metadata_mut(&mut self) -> &mut BTreeMap<String, Value>
pub fn metadata_mut(&mut self) -> &mut BTreeMap<String, Value>
Add or change application metadata passed to later and post hooks.
Auto Trait Implementations§
impl<'a> !UnwindSafe for HookContext<'a>
impl<'a> Freeze for HookContext<'a>
impl<'a> RefUnwindSafe for HookContext<'a>
impl<'a> Send for HookContext<'a>
impl<'a> Sync for HookContext<'a>
impl<'a> Unpin for HookContext<'a>
impl<'a> UnsafeUnpin for HookContext<'a>
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request