pub struct AuditRules { /* private fields */ }Expand description
Audit rules: allow/deny lists used to decide whether a given SQL statement should be recorded in the audit log.
Rule evaluation order:
- If the SQL matches any pattern in the deny list → not recorded
- If the allow list is empty → record all SQL not denied
- If the allow list is non-empty → record only SQL that matches the allow list
Implementations§
Source§impl AuditRules
impl AuditRules
pub fn new() -> Self
Sourcepub fn allow(self, pattern: impl Into<String>) -> Self
pub fn allow(self, pattern: impl Into<String>) -> Self
Add an allow pattern (case-insensitive substring match)
Sourcepub fn deny(self, pattern: impl Into<String>) -> Self
pub fn deny(self, pattern: impl Into<String>) -> Self
Add a deny pattern (case-insensitive substring match)
Sourcepub fn should_audit(&self, sql: &str) -> bool
pub fn should_audit(&self, sql: &str) -> bool
Determine whether the given SQL should be audit-recorded
Sourcepub fn allow_count(&self) -> usize
pub fn allow_count(&self) -> usize
Return the number of allow patterns
Sourcepub fn deny_count(&self) -> usize
pub fn deny_count(&self) -> usize
Return the number of deny patterns
Trait Implementations§
Source§impl Clone for AuditRules
impl Clone for AuditRules
Source§fn clone(&self) -> AuditRules
fn clone(&self) -> AuditRules
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 moreSource§impl Debug for AuditRules
impl Debug for AuditRules
Source§impl Default for AuditRules
impl Default for AuditRules
Source§fn default() -> AuditRules
fn default() -> AuditRules
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AuditRules
impl RefUnwindSafe for AuditRules
impl Send for AuditRules
impl Sync for AuditRules
impl Unpin for AuditRules
impl UnsafeUnpin for AuditRules
impl UnwindSafe for AuditRules
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