Versions in this module Expand all Collapse all v1 v1.0.0 Sep 14, 2026 Changes in this version + var ErrInvalidPrepared = errors.New("sqlguard: invalid prepared value") + type Engine struct + func NewEngine(options EngineOptions, rules ...Rule) (*Engine, error) + func (e *Engine) Prepare(ctx context.Context, sql string) (Prepared, error) + func (e *Engine) Validate(ctx context.Context, sql string) error + func (e *Engine) ValidatePrepared(ctx context.Context, prepared Prepared) error + type EngineOptions struct + Logger Logger + Metrics Metrics + type Kind string + type Logger interface + LogValidation func(event ValidationEvent) error + type Metrics interface + RecordValidation func(event ValidationEvent) error + type Node struct + func (n Node) Bool(name string) (bool, bool) + func (n Node) Bytes(name string) ([]byte, bool) + func (n Node) Child(name string) (Node, bool) + func (n Node) Children(name string) []Node + func (n Node) Enum(name string) (string, bool) + func (n Node) Float(name string) (float64, bool) + func (n Node) Int(name string) (int64, bool) + func (n Node) Kind() Kind + func (n Node) String(name string) (string, bool) + func (n Node) Uint(name string) (uint64, bool) + func (n Node) Walk(visit func(Node) bool) + type ParseError struct + func (*ParseError) Error() string + func (e *ParseError) Category() ParseErrorCategory + type ParseErrorCategory string + const ParseErrorSyntax + const ParseErrorUnknown + type Prepared struct + type Rule interface + Evaluate func(ctx context.Context, statement Statement) RuleResult + ID func() string + type RuleResult struct + func Allow() RuleResult + func Reject() RuleResult + func (r RuleResult) Rejected() bool + type Statement struct + func (s Statement) Kind() Kind + func (s Statement) Root() Node + func (s Statement) Walk(visit func(Node) bool) + type ValidationEvent struct + func (e ValidationEvent) Mode() ValidationMode + func (e ValidationEvent) Outcome() ValidationOutcome + func (e ValidationEvent) RuleID() string + type ValidationMode string + const ValidationModeEnforce + type ValidationOutcome string + const ValidationOutcomeAllowed + const ValidationOutcomeCanceled + const ValidationOutcomeInvalidPrepared + const ValidationOutcomeParserFailure + const ValidationOutcomePolicyViolation + type Validator interface + Validate func(ctx context.Context, sql string) error + type Violation struct + func (*Violation) Error() string + func (e *Violation) RuleID() string