Documentation
¶
Index ¶
- Constants
- type Analyzer
- type Config
- type Context
- type Finding
- type Input
- type ParsedQuery
- type QueryKind
- type Report
- type Rule
- type RuleInefficientOrderBy
- type RuleLargeOffset
- type RuleMissingCompositeIndex
- type RuleMissingIndex
- type RuleMissingWhere
- type RulePotentialFullTableScan
- type RuleSequentialScan
- type Severity
Constants ¶
View Source
const DefaultLargeOffsetThreshold = 1000
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
func (*Analyzer) Inspect ¶ added in v0.4.0
func (a *Analyzer) Inspect(ctx context.Context, input orm.QueryAdvisorInput) (orm.QueryAdvisorReport, error)
Inspect adapts the analyzer to the ORM query advisor interface.
type Config ¶
type Config struct {
Rules []Rule
LargeOffsetThreshold int
Observability orm.ObservabilityConfig
}
type ParsedQuery ¶
type ParsedQuery struct {
SQL string
Kind QueryKind
Table string
WhereClause string
OrderByClause string
WhereColumns []string
OrderByCols []string
Offset int
HasOffset bool
HasWhere bool
HasJoin bool
}
func ParseSQL ¶
func ParseSQL(sqlText string) (ParsedQuery, error)
type Rule ¶
func DefaultRules ¶
func DefaultRules() []Rule
type RuleInefficientOrderBy ¶
type RuleInefficientOrderBy struct{}
func (RuleInefficientOrderBy) Apply ¶
func (RuleInefficientOrderBy) Apply(ctx Context) []Finding
func (RuleInefficientOrderBy) Name ¶
func (RuleInefficientOrderBy) Name() string
type RuleLargeOffset ¶
type RuleLargeOffset struct{}
func (RuleLargeOffset) Apply ¶
func (RuleLargeOffset) Apply(ctx Context) []Finding
func (RuleLargeOffset) Name ¶
func (RuleLargeOffset) Name() string
type RuleMissingCompositeIndex ¶
type RuleMissingCompositeIndex struct{}
func (RuleMissingCompositeIndex) Apply ¶
func (RuleMissingCompositeIndex) Apply(ctx Context) []Finding
func (RuleMissingCompositeIndex) Name ¶
func (RuleMissingCompositeIndex) Name() string
type RuleMissingIndex ¶
type RuleMissingIndex struct{}
func (RuleMissingIndex) Apply ¶
func (RuleMissingIndex) Apply(ctx Context) []Finding
func (RuleMissingIndex) Name ¶
func (RuleMissingIndex) Name() string
type RuleMissingWhere ¶
type RuleMissingWhere struct{}
func (RuleMissingWhere) Apply ¶
func (RuleMissingWhere) Apply(ctx Context) []Finding
func (RuleMissingWhere) Name ¶
func (RuleMissingWhere) Name() string
type RulePotentialFullTableScan ¶
type RulePotentialFullTableScan struct{}
func (RulePotentialFullTableScan) Apply ¶
func (RulePotentialFullTableScan) Apply(ctx Context) []Finding
func (RulePotentialFullTableScan) Name ¶
func (RulePotentialFullTableScan) Name() string
type RuleSequentialScan ¶
type RuleSequentialScan struct{}
func (RuleSequentialScan) Apply ¶
func (RuleSequentialScan) Apply(ctx Context) []Finding
func (RuleSequentialScan) Name ¶
func (RuleSequentialScan) Name() string
Click to show internal directories.
Click to hide internal directories.