pub struct SqlAuditor { /* private fields */ }Implementations§
Source§impl SqlAuditor
impl SqlAuditor
pub fn new() -> Self
Sourcepub fn log(&self, ctx: &SqlAuditContext)
pub fn log(&self, ctx: &SqlAuditContext)
Log an audit entry. The SQL is masked for sensitive keywords before being stored in the in-memory buffer.
Sourcepub fn get_logs(&self) -> Vec<SqlAuditContext>
pub fn get_logs(&self) -> Vec<SqlAuditContext>
Return a snapshot of all stored audit entries.
Sourcepub fn flush(&self, path: &str) -> Result<usize, String>
pub fn flush(&self, path: &str) -> Result<usize, String>
Flush all stored audit entries to a JSON file at path.
Returns the number of entries written.
Sourcepub fn mask_sensitive(&self, sql: &str) -> String
pub fn mask_sensitive(&self, sql: &str) -> String
Mask all sensitive keywords in sql with ******. Matching is
case-insensitive.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SqlAuditor
impl RefUnwindSafe for SqlAuditor
impl Send for SqlAuditor
impl Sync for SqlAuditor
impl Unpin for SqlAuditor
impl UnsafeUnpin for SqlAuditor
impl UnwindSafe for SqlAuditor
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