Skip to main content

SqlRule

Trait SqlRule 

Source
pub trait SqlRule: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn severity(&self) -> RuleSeverity;
    fn check(&self, ctx: &RuleContext) -> Option<RuleViolation>;
}
Expand description

SQL 规则接口

实现者定义一条具体的检查逻辑。规则应为无状态且线程安全(Send + Sync), 以便在规则引擎中共享。

Required Methods§

Source

fn name(&self) -> &str

规则名称,需在引擎内唯一

Source

fn severity(&self) -> RuleSeverity

规则的默认严重级别

Source

fn check(&self, ctx: &RuleContext) -> Option<RuleViolation>

检查 SQL 上下文,返回 Some(violation) 表示违规,None 表示通过

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§