Skip to main content

FilterBuilder

Struct FilterBuilder 

Source
pub struct FilterBuilder { /* private fields */ }
Expand description

链式构建组合过滤器。

所有条件以 AND 语义组合,调用 build 生成 Filter

§示例

use dm_database_parser_sqllog::FilterBuilder;

let filter = FilterBuilder::new()
    .ts_contains("2024-06")
    .exec_time_gt(100.0)
    .sql_contains("SELECT")
    .build();

Implementations§

Source§

impl FilterBuilder

Source

pub fn new() -> Self

创建一个空的 FilterBuilder(无任何谓词)。

Source

pub fn build(self) -> Filter

消费 builder,产出可复用的 Filter

Source

pub fn ts_contains(self, pattern: impl Into<String>) -> Self

时间戳包含指定子串(FILTER-01)。

Source

pub fn ts_eq(self, value: impl Into<String>) -> Self

时间戳等于指定值(FILTER-01)。

Source

pub fn ts_starts_with(self, prefix: impl Into<String>) -> Self

时间戳以指定前缀开头(FILTER-01)。

Source

pub fn ts_ends_with(self, suffix: impl Into<String>) -> Self

时间戳以指定后缀结尾(FILTER-01)。

Source

pub fn tag_is_some(self) -> Self

tag 字段不为 None(FILTER-02)。

Source

pub fn tag_is_none(self) -> Self

tag 字段为 None(FILTER-02)。

Source

pub fn tag_eq(self, value: impl Into<String>) -> Self

tag 字段等于指定值(FILTER-02)。

Source

pub fn tag_contains(self, pattern: impl Into<String>) -> Self

tag 字段包含指定子串(FILTER-02)。

Source

pub fn ep_eq(self, value: u8) -> Self

EP 等于指定值(FILTER-03)。

Source

pub fn ep_gt(self, value: u8) -> Self

EP 大于指定值(FILTER-03)。

Source

pub fn ep_lt(self, value: u8) -> Self

EP 小于指定值(FILTER-03)。

Source

pub fn ep_between(self, min: u8, max: u8) -> Self

EP 在闭区间 [min, max] 内(FILTER-03)。

§Panics

min > max 时 panic。

Source

pub fn sess_id_contains(self, pattern: impl Into<String>) -> Self

sess_id 包含指定子串(FILTER-04)。

Source

pub fn sess_id_eq(self, value: impl Into<String>) -> Self

sess_id 等于指定值(FILTER-04)。

Source

pub fn sess_id_starts_with(self, prefix: impl Into<String>) -> Self

sess_id 以指定前缀开头(FILTER-04)。

Source

pub fn sess_id_ends_with(self, suffix: impl Into<String>) -> Self

sess_id 以指定后缀结尾(FILTER-04)。

Source

pub fn thrd_id_contains(self, pattern: impl Into<String>) -> Self

thrd_id 包含指定子串(FILTER-04)。

Source

pub fn thrd_id_eq(self, value: impl Into<String>) -> Self

thrd_id 等于指定值(FILTER-04)。

Source

pub fn thrd_id_starts_with(self, prefix: impl Into<String>) -> Self

thrd_id 以指定前缀开头(FILTER-04)。

Source

pub fn thrd_id_ends_with(self, suffix: impl Into<String>) -> Self

thrd_id 以指定后缀结尾(FILTER-04)。

Source

pub fn username_contains(self, pattern: impl Into<String>) -> Self

username 包含指定子串(FILTER-04)。

Source

pub fn username_eq(self, value: impl Into<String>) -> Self

username 等于指定值(FILTER-04)。

Source

pub fn username_starts_with(self, prefix: impl Into<String>) -> Self

username 以指定前缀开头(FILTER-04)。

Source

pub fn username_ends_with(self, suffix: impl Into<String>) -> Self

username 以指定后缀结尾(FILTER-04)。

Source

pub fn trxid_contains(self, pattern: impl Into<String>) -> Self

trxid 包含指定子串(FILTER-04)。

Source

pub fn trxid_eq(self, value: impl Into<String>) -> Self

trxid 等于指定值(FILTER-04)。

Source

pub fn trxid_starts_with(self, prefix: impl Into<String>) -> Self

trxid 以指定前缀开头(FILTER-04)。

Source

pub fn trxid_ends_with(self, suffix: impl Into<String>) -> Self

trxid 以指定后缀结尾(FILTER-04)。

Source

pub fn statement_contains(self, pattern: impl Into<String>) -> Self

statement 包含指定子串(FILTER-04)。

Source

pub fn statement_eq(self, value: impl Into<String>) -> Self

statement 等于指定值(FILTER-04)。

Source

pub fn statement_starts_with(self, prefix: impl Into<String>) -> Self

statement 以指定前缀开头(FILTER-04)。

Source

pub fn statement_ends_with(self, suffix: impl Into<String>) -> Self

statement 以指定后缀结尾(FILTER-04)。

Source

pub fn appname_contains(self, pattern: impl Into<String>) -> Self

appname 包含指定子串(FILTER-04)。

Source

pub fn appname_eq(self, value: impl Into<String>) -> Self

appname 等于指定值(FILTER-04)。

Source

pub fn appname_starts_with(self, prefix: impl Into<String>) -> Self

appname 以指定前缀开头(FILTER-04)。

Source

pub fn appname_ends_with(self, suffix: impl Into<String>) -> Self

appname 以指定后缀结尾(FILTER-04)。

Source

pub fn client_ip_contains(self, pattern: impl Into<String>) -> Self

client_ip 包含指定子串(FILTER-04)。

Source

pub fn client_ip_eq(self, value: impl Into<String>) -> Self

client_ip 等于指定值(FILTER-04)。

Source

pub fn client_ip_starts_with(self, prefix: impl Into<String>) -> Self

client_ip 以指定前缀开头(FILTER-04)。

Source

pub fn client_ip_ends_with(self, suffix: impl Into<String>) -> Self

client_ip 以指定后缀结尾(FILTER-04)。

Source

pub fn sql_contains(self, pattern: impl Into<String>) -> Self

SQL 语句包含指定子串(FILTER-05)。

Source

pub fn sql_eq(self, value: impl Into<String>) -> Self

SQL 语句等于指定值(FILTER-05)。

Source

pub fn sql_starts_with(self, prefix: impl Into<String>) -> Self

SQL 语句以指定前缀开头(FILTER-05)。

Source

pub fn sql_ends_with(self, suffix: impl Into<String>) -> Self

SQL 语句以指定后缀结尾(FILTER-05)。

Source

pub fn exec_time_gt(self, min_ms: f32) -> Self

执行时间大于 min_ms 毫秒(严格不等,FILTER-06)。

参数单位为毫秒;f32 精度约 7 位有效数字,不提供 exec_time_eq 方法以避免误用。

Source

pub fn exec_time_gte(self, min_ms: f32) -> Self

执行时间大于等于 min_ms 毫秒(含边界,FILTER-06)。

与 [LogIterator::filter_by_exec_time] 语义一致(>=)。 参数单位为毫秒;f32 精度约 7 位有效数字。

Source

pub fn exec_time_lt(self, max_ms: f32) -> Self

执行时间小于 max_ms 毫秒(FILTER-06)。

参数单位为毫秒;f32 精度约 7 位有效数字,不提供 exec_time_eq 方法以避免误用。

Source

pub fn exec_time_between(self, min_ms: f32, max_ms: f32) -> Self

执行时间在闭区间 [min_ms, max_ms] 毫秒内(FILTER-06)。

参数单位为毫秒;f32 精度约 7 位有效数字,不提供 exec_time_eq 方法以避免误用。

§Panics

min_ms > max_ms 时 panic。

Source

pub fn rowcount_eq(self, value: u32) -> Self

影响行数等于指定值(FILTER-07)。

Source

pub fn rowcount_gt(self, value: u32) -> Self

影响行数大于指定值(FILTER-07)。

Source

pub fn rowcount_lt(self, value: u32) -> Self

影响行数小于指定值(FILTER-07)。

Source

pub fn rowcount_between(self, min: u32, max: u32) -> Self

影响行数在闭区间 [min, max] 内(FILTER-07)。

§Panics

min > max 时 panic。

Source

pub fn exec_id_eq(self, value: i64) -> Self

执行 ID 等于指定值(FILTER-08)。

Source

pub fn exec_id_gt(self, value: i64) -> Self

执行 ID 大于指定值(FILTER-08)。

Source

pub fn exec_id_lt(self, value: i64) -> Self

执行 ID 小于指定值(FILTER-08)。

Source

pub fn exec_id_between(self, min: i64, max: i64) -> Self

执行 ID 在闭区间 [min, max] 内(FILTER-08)。

§Panics

min > max 时 panic。

Trait Implementations§

Source§

impl Default for FilterBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.