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§
Sourcefn severity(&self) -> RuleSeverity
fn severity(&self) -> RuleSeverity
规则的默认严重级别
Sourcefn check(&self, ctx: &RuleContext) -> Option<RuleViolation>
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".