Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LexOption ¶
type LexOption func(*Lexer)
LexOption is a function that sets a preference on the lexer
func LexOptions ¶
LexOptions converts an aritrary number of options into one function for easier handling
func WithNamedCallback ¶
func WithNamedCallback(cb OnNamedParam) LexOption
WithNamedCallback sets the optional named parameter callback
func WithPositionalSubstitution ¶
func WithPositionalSubstitution(cb SubstitutePosParam) LexOption
WithPositionalSubstitution sets the optional positional substitution callback
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer loosely breaks a SQL query down into chunks that the Vertica package cares about, offering opportunities for substitution.
type OnNamedParam ¶
type OnNamedParam func(name string)
OnNamedParam is called when a value such as @queryParam is encountered. This can be used to associate a placeholder in the SQL to an index. The placeholders are encountered in the order they appear in the string.
type SubstitutePosParam ¶
type SubstitutePosParam func() string
SubstitutePosParam is called by the lexer when a '?' rune is encountered outside a string. The return value is substituted for the placeholder. This can be used to emulate server side binding but should be done with extreme caution due to the risk of SQL injection.