pub struct RequestContext {
pub request_id: RequestId,
pub operation: Option<String>,
pub user_id: Option<String>,
pub org_id: Option<String>,
pub client_ip: Option<String>,
pub api_version: Option<String>,
}Expand description
Request context for structured logging and multi-tenancy.
Fields§
§request_id: RequestIdUnique request identifier
operation: Option<String>GraphQL operation name (query, mutation, subscription)
user_id: Option<String>User identifier (if authenticated)
org_id: Option<String>Organization ID for multi-tenancy enforcement
client_ip: Option<String>Client IP address
api_version: Option<String>API version
Implementations§
Source§impl RequestContext
impl RequestContext
Sourcepub fn with_operation(self, operation: String) -> Self
pub fn with_operation(self, operation: String) -> Self
Set operation name.
Sourcepub fn with_user_id(self, user_id: String) -> Self
pub fn with_user_id(self, user_id: String) -> Self
Set user ID.
Sourcepub fn with_org_id(self, org_id: String) -> Self
pub fn with_org_id(self, org_id: String) -> Self
Set organization ID for multi-tenancy.
Sourcepub fn with_client_ip(self, ip: String) -> Self
pub fn with_client_ip(self, ip: String) -> Self
Set client IP.
Sourcepub fn with_api_version(self, version: String) -> Self
pub fn with_api_version(self, version: String) -> Self
Set API version.
Trait Implementations§
Source§impl Clone for RequestContext
impl Clone for RequestContext
Source§fn clone(&self) -> RequestContext
fn clone(&self) -> RequestContext
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 Debug for RequestContext
impl Debug for RequestContext
Source§impl Default for RequestContext
impl Default for RequestContext
Source§impl<'de> Deserialize<'de> for RequestContext
impl<'de> Deserialize<'de> for RequestContext
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RequestContext
impl RefUnwindSafe for RequestContext
impl Send for RequestContext
impl Sync for RequestContext
impl Unpin for RequestContext
impl UnsafeUnpin for RequestContext
impl UnwindSafe for RequestContext
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