Versions in this module Expand all Collapse all v0 v0.1.0 Jun 8, 2026 Changes in this version + func Fingerprint(sql string) string + func IsMultiStatement(sql string) bool + func ParseIgnoreComment(text string) (all bool, rules map[string]bool, found bool) + func Redact(sql string) string + func Register(spec RuleSpec) + func RuleNames() []string + type Analyzer struct + func Default() *Analyzer + func DefaultWithProfile(p Profile) *Analyzer + func New(rules ...Rule) *Analyzer + func (a *Analyzer) Analyze(query string) []Result + func (a *Analyzer) PrepareQuery(raw string) (display, fingerprint string) + func (a *Analyzer) WithParser(p Parser) *Analyzer + func (a *Analyzer) WithRawQuery() *Analyzer + type FallbackParser struct + func NewFallbackParser() *FallbackParser + func (p *FallbackParser) Parse(sql string) (*Statement, error) + type Parser interface + Parse func(sql string) (*Statement, error) + type Profile struct + Disabled map[string]bool + Only map[string]bool + RawQuery bool + Settings map[string]Settings + Severity map[string]Severity + type Result struct + File string + Fingerprint string + Line int + Message string + Query string + RuleName string + Severity Severity + Suggestion string + func CheckAddNotNullWithoutDefault(s *Statement) (Result, bool) + func CheckCartesianJoin(s *Statement) (Result, bool) + func CheckDeleteWithoutWhere(s *Statement) (Result, bool) + func CheckImplicitJoin(s *Statement) (Result, bool) + func CheckInListTooLarge(s *Statement) (Result, bool) + func CheckInsertWithoutColumns(s *Statement) (Result, bool) + func CheckLargeOffset(s *Statement) (Result, bool) + func CheckLeadingWildcard(s *Statement) (Result, bool) + func CheckNonSargablePredicate(s *Statement) (Result, bool) + func CheckOrderByWithoutLimit(s *Statement) (Result, bool) + func CheckSelectDistinct(s *Statement) (Result, bool) + func CheckSelectStar(s *Statement) (Result, bool) + func CheckSelectWithoutLimit(s *Statement) (Result, bool) + func CheckUpdateWithoutWhere(s *Statement) (Result, bool) + type Rule func(s *Statement) (Result, bool) + type RuleSpec struct + DefaultSeverity Severity + Factory func(Settings) Rule + Name string + type Settings map[string]any + func (s Settings) Bool(key string, def bool) bool + func (s Settings) Duration(key string, def time.Duration) time.Duration + func (s Settings) Int(key string, def int) int + func (s Settings) String(key, def string) string + type Severity int + const SeverityCritical + const SeverityInfo + const SeverityWarning + func (s Severity) String() string + type Statement struct + AddNotNullNoDefault bool + CartesianJoin bool + Exact bool + HasFrom bool + HasLimit bool + HasOrderBy bool + HasWhere bool + ImplicitCommaJoin bool + InsertColumnsListed bool + Kind StmtKind + LeadingWildcardLike bool + LeadingWildcardTermLen int + MaxInListLen int + NonSargablePredicate bool + OffsetValue int + Raw string + SelectDistinct bool + SelectStar bool + type StmtKind int + const StmtDelete + const StmtInsert + const StmtOther + const StmtSelect + const StmtUnknown + const StmtUpdate