pub struct RuleViolation {
pub rule_name: String,
pub severity: RuleSeverity,
pub message: String,
pub position: Option<usize>,
}Expand description
单条规则违规报告
由 SqlRule::check 返回,描述一条 SQL 在某规则下的违规详情。
Fields§
§rule_name: String触发违规的规则名称
severity: RuleSeverity违规严重级别
message: String人类可读的违规说明
position: Option<usize>违规在 SQL 文本中的字节偏移(0-based),None 表示无法定位
Implementations§
Source§impl RuleViolation
impl RuleViolation
Sourcepub fn new(
rule_name: impl Into<String>,
severity: RuleSeverity,
message: impl Into<String>,
) -> Self
pub fn new( rule_name: impl Into<String>, severity: RuleSeverity, message: impl Into<String>, ) -> Self
创建一条无位置信息的违规
Sourcepub fn with_position(
rule_name: impl Into<String>,
severity: RuleSeverity,
message: impl Into<String>,
position: usize,
) -> Self
pub fn with_position( rule_name: impl Into<String>, severity: RuleSeverity, message: impl Into<String>, position: usize, ) -> Self
创建一条带位置信息的违规
Sourcepub fn is_blocking(&self) -> bool
pub fn is_blocking(&self) -> bool
违规是否为阻断级
Trait Implementations§
Source§impl Clone for RuleViolation
impl Clone for RuleViolation
Source§fn clone(&self) -> RuleViolation
fn clone(&self) -> RuleViolation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RuleViolation
impl Debug for RuleViolation
Source§impl Display for RuleViolation
impl Display for RuleViolation
impl Eq for RuleViolation
Source§impl PartialEq for RuleViolation
impl PartialEq for RuleViolation
impl StructuralPartialEq for RuleViolation
Auto Trait Implementations§
impl Freeze for RuleViolation
impl RefUnwindSafe for RuleViolation
impl Send for RuleViolation
impl Sync for RuleViolation
impl Unpin for RuleViolation
impl UnsafeUnpin for RuleViolation
impl UnwindSafe for RuleViolation
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