Documentation ¶
Index ¶
- Variables
- func AddQueryParam(target *[]QueryParam, param QueryParam)
- func AddQueryParams(target *[]QueryParam, params []QueryParam)
- func DebugQuery(q string)
- type ColumnUsed
- type MatchedSqlFunc
- type ParseResult
- type PostponedNodes
- type QueryParam
- type QuerySite
- type Schema
- type SqlFuncMatchRule
- type SqlFuncMatcher
- type SqlVetAnnotation
- type TableUsed
- type VetContext
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AddQueryParam ¶
func AddQueryParam(target *[]QueryParam, param QueryParam)
insert query param based on parameter number and avoid deduplications
func AddQueryParams ¶
func AddQueryParams(target *[]QueryParam, params []QueryParam)
func DebugQuery ¶
func DebugQuery(q string)
Types ¶
type ColumnUsed ¶
type MatchedSqlFunc ¶
type ParseResult ¶
type ParseResult struct { Columns []ColumnUsed Tables []TableUsed Params []QueryParam PostponedNodes *PostponedNodes }
type PostponedNodes ¶
type PostponedNodes struct {
RangeSubselectNodes []*pg_query.RangeSubselect
}
func (*PostponedNodes) Append ¶
func (p *PostponedNodes) Append(other *PostponedNodes)
func (*PostponedNodes) Parse ¶
func (p *PostponedNodes) Parse(ctx VetContext, parseRe *ParseResult) (err error)
type QueryParam ¶
type QueryParam struct {
Number int32
}
func ValidateSqlQuery ¶
func ValidateSqlQuery(ctx VetContext, queryStr string) ([]QueryParam, error)
type QuerySite ¶
type QuerySite struct { Called string Position token.Position Query string ParameterArgCount int Err error }
func CheckDir ¶
func CheckDir(ctx VetContext, dir, buildFlags string, extraMatchers []SqlFuncMatcher) ([]*QuerySite, error)
type SqlFuncMatchRule ¶
type SqlFuncMatcher ¶
type SqlFuncMatcher struct { PkgPath string `toml:"pkg_path"` Rules []SqlFuncMatchRule `toml:"rules"` // contains filtered or unexported fields }
func (*SqlFuncMatcher) IterPackageExportedFuncs ¶
func (s *SqlFuncMatcher) IterPackageExportedFuncs(cb func(*types.Func))
func (*SqlFuncMatcher) MatchSqlFuncs ¶
func (s *SqlFuncMatcher) MatchSqlFuncs(prog *ssa.Program) []MatchedSqlFunc
func (*SqlFuncMatcher) PackageImported ¶
func (s *SqlFuncMatcher) PackageImported() bool
func (*SqlFuncMatcher) SetGoPackage ¶
func (s *SqlFuncMatcher) SetGoPackage(p *packages.Package)
type SqlVetAnnotation ¶
type SqlVetAnnotation struct {
Ignore bool
}
func ParseComment ¶
func ParseComment(comment string) (SqlVetAnnotation, error)
type VetContext ¶
func NewContext ¶
func NewContext(tables map[string]schema.Table) VetContext
Click to show internal directories.
Click to hide internal directories.