pub struct TenantAuditContext {
pub tenant_id: i64,
pub operation: TenantAuditOperation,
pub timestamp: i64,
pub result: AuditResult,
pub detail: String,
}Expand description
多租户审计上下文
审计日志含租户 ID + 操作 + 时间 + 结果,日志不可篡改(追加写入)。
Fields§
§tenant_id: i64租户 ID
operation: TenantAuditOperation操作类型
timestamp: i64时间戳(Unix 秒)
result: AuditResult结果(成功/拒绝)
detail: String详情(如被拒绝的表名、被脱敏的列名等)
Implementations§
Source§impl TenantAuditContext
impl TenantAuditContext
Sourcepub fn new(
tenant_id: i64,
operation: TenantAuditOperation,
result: AuditResult,
detail: impl Into<String>,
) -> Self
pub fn new( tenant_id: i64, operation: TenantAuditOperation, result: AuditResult, detail: impl Into<String>, ) -> Self
创建新的审计上下文
Sourcepub fn log_to(&self, auditor: &SqlAuditor)
pub fn log_to(&self, auditor: &SqlAuditor)
记入审计日志(调用既有 SqlAuditor::log)
Trait Implementations§
Source§impl Clone for TenantAuditContext
impl Clone for TenantAuditContext
Source§fn clone(&self) -> TenantAuditContext
fn clone(&self) -> TenantAuditContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TenantAuditContext
impl RefUnwindSafe for TenantAuditContext
impl Send for TenantAuditContext
impl Sync for TenantAuditContext
impl Unpin for TenantAuditContext
impl UnsafeUnpin for TenantAuditContext
impl UnwindSafe for TenantAuditContext
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> 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