pub struct Sqllog<'a> {
pub ts: Cow<'a, str>,
pub meta_raw: Cow<'a, str>,
pub content_raw: Cow<'a, [u8]>,
pub tag: Option<Cow<'a, str>>,
/* private fields */
}Expand description
SQL 日志记录
表示一条完整的 SQL 日志记录,包含时间戳、元数据、SQL 语句体和可选的性能指标。
Fields§
§ts: Cow<'a, str>时间戳,格式为 “YYYY-MM-DD HH:MM:SS.mmm”
meta_raw: Cow<'a, str>原始元数据字节(延迟解析)
content_raw: Cow<'a, [u8]>原始内容(包含 Body 和 Indicators),延迟分割和解析
tag: Option<Cow<'a, str>>提取出的方括号标签(例如 [SEL]、[ORA]),若无则为 None
Implementations§
Source§impl<'a> Sqllog<'a>
impl<'a> Sqllog<'a>
Sourcepub fn body_bytes(&self) -> &[u8] ⓘ
pub fn body_bytes(&self) -> &[u8] ⓘ
获取 SQL 语句体的原始字节切片(不分配)
Sourcepub fn indicators_raw(&self) -> Option<Cow<'a, str>>
pub fn indicators_raw(&self) -> Option<Cow<'a, str>>
获取原始性能指标字符串(延迟分割)
Sourcepub fn parse_indicators(&self) -> Option<PerformanceMetrics<'static>>
pub fn parse_indicators(&self) -> Option<PerformanceMetrics<'static>>
解析性能指标(sql 字段为空字符串)
Sourcepub fn parse_performance_metrics(&self) -> PerformanceMetrics<'a>
pub fn parse_performance_metrics(&self) -> PerformanceMetrics<'a>
解析性能指标和 SQL 语句
返回包含 EXECTIME、ROWCOUNT、EXEC_ID 和 SQL 语句的 PerformanceMetrics。
当 tag 为 "ORA" 时,SQL 语句开头可能带有 ": ",本方法会自动去除。
§实现说明
仅调用一次 find_indicators_split(),body 解码与 indicators 解析均在同一
次遍历中完成,Cow::Borrowed 路径全程零分配。
Sourcepub fn parse_meta(&self) -> MetaParts<'a>
pub fn parse_meta(&self) -> MetaParts<'a>
解析元数据
Trait Implementations§
impl<'a> StructuralPartialEq for Sqllog<'a>
Auto Trait Implementations§
impl<'a> Freeze for Sqllog<'a>
impl<'a> RefUnwindSafe for Sqllog<'a>
impl<'a> Send for Sqllog<'a>
impl<'a> Sync for Sqllog<'a>
impl<'a> Unpin for Sqllog<'a>
impl<'a> UnsafeUnpin for Sqllog<'a>
impl<'a> UnwindSafe for Sqllog<'a>
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> 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