pub struct AuditEntry {Show 14 fields
pub id: Option<i64>,
pub timestamp: DateTime<Utc>,
pub level: AuditLevel,
pub user_id: i64,
pub tenant_id: i64,
pub operation: String,
pub query: String,
pub variables: Value,
pub ip_address: String,
pub user_agent: String,
pub error: Option<String>,
pub duration_ms: Option<i32>,
pub previous_hash: Option<String>,
pub integrity_hash: Option<String>,
}Expand description
Audit log entry with integrity protection
Fields§
§id: Option<i64>Entry ID (None for new entries)
timestamp: DateTime<Utc>Timestamp
level: AuditLevelLog level
user_id: i64User ID
tenant_id: i64Tenant ID
operation: StringOperation type (query, mutation)
query: StringGraphQL query string
variables: ValueQuery variables (JSONB)
ip_address: StringClient IP address
user_agent: StringClient user agent
error: Option<String>Error message (if any)
duration_ms: Option<i32>Query duration in milliseconds (optional)
previous_hash: Option<String>SHA256 hash of previous entry (for integrity chain)
integrity_hash: Option<String>SHA256 hash of this entry (for integrity verification)
Implementations§
Source§impl AuditEntry
impl AuditEntry
Sourcepub fn calculate_hash(&self) -> String
pub fn calculate_hash(&self) -> String
Calculate SHA256 hash for this entry (for integrity chain)
Hashes: user_id | timestamp | operation | query to create a tamper-proof chain
Sourcepub fn verify_integrity(&self) -> bool
pub fn verify_integrity(&self) -> bool
Verify integrity of this entry against its stored hash
Trait Implementations§
Source§impl Clone for AuditEntry
impl Clone for AuditEntry
Source§fn clone(&self) -> AuditEntry
fn clone(&self) -> AuditEntry
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 AuditEntry
impl Debug for AuditEntry
Source§impl<'de> Deserialize<'de> for AuditEntry
impl<'de> Deserialize<'de> for AuditEntry
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 AuditEntry
impl RefUnwindSafe for AuditEntry
impl Send for AuditEntry
impl Sync for AuditEntry
impl Unpin for AuditEntry
impl UnsafeUnpin for AuditEntry
impl UnwindSafe for AuditEntry
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