sanitizer

package
v0.2.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InKeyword  = "in"
	OrKeyword  = "or"
	AndKeyword = "and"
)

Variables

This section is empty.

Functions

func ExtractParameterHints

func ExtractParameterHints(text string) option.ParameterHints

func GetHolderName

func GetHolderName(identifier string) (string, string)

func RemoveParameterHints

func RemoveParameterHints(text string, hints option.ParameterHints) string

func Sanitize

func Sanitize(SQL string, hints option.ParameterHints) string

func SplitHint

func SplitHint(hint string) (marshal string, SQL string)

Types

type Context

type Context int
const (
	UnspecifiedContext Context = iota
	SetContext
	IfContext
	ForEachContext
	AppendContext
	FuncContext
)

type ParamContext

type ParamContext struct {
	ParamName string
	Context   Context
}

func NewParamContext

func NewParamContext(name string, context Context) *ParamContext

type ParamMatcher

type ParamMatcher struct {
	// contains filtered or unexported fields
}

func NewParamMatcher

func NewParamMatcher() *ParamMatcher

func (*ParamMatcher) TryMatchParam

func (p *ParamMatcher) TryMatchParam(cursor *parsly.Cursor) (string, int)

type ParamMeta

type ParamMeta struct {
	Start           int
	End             int
	FullName        string
	Prefix          string
	Holder          string
	Context         Context
	IsVariable      bool
	OccurrenceIndex int
	MetaType        *ParamMetaType
	SQLKeyword      string
}

type ParamMetaIterator

type ParamMetaIterator struct {
	SQL string
	// contains filtered or unexported fields
}

func NewIterator

func NewIterator(SQL string, hints option.ParameterHints) *ParamMetaIterator

func (*ParamMetaIterator) Has

func (i *ParamMetaIterator) Has() bool

func (*ParamMetaIterator) Next

func (i *ParamMetaIterator) Next() *ParamMeta

type ParamMetaType

type ParamMetaType struct {
	Typer []option.Typer
	SQL   []string
	Hint  []string
}

type ParamNameHandler

type ParamNameHandler func(paramName string, pos int, cursor *parsly.Cursor) (cont bool, revert bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL