Documentation
¶
Overview ¶
Package sqlpolicy provides a small, dialect-neutral SQL lexical boundary. It recognizes statement separators and unquoted ASCII words without trying to parse SQL grammar. Callers remain responsible for an explicit allowlist.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSQL = errors.New("SQL text is invalid")
ErrInvalidSQL reports input that cannot be safely classified as SQL text.
Functions ¶
func HasTemporarySchemaReference ¶
HasTemporarySchemaReference reports whether tokens contain a quoted or unquoted temp schema qualifier.
func ValidateMigrationScript ¶
ValidateMigrationScript accepts a bounded sequence of durable DDL and DML statements. Transaction-control statements, temporary schema, REPLACE/WITH extensions, and executable ROLLBACK policy are outside this strict profile. CREATE TRIGGER bodies are recognized so their internal semicolons and BEGIN/END delimiters are not mistaken for top-level transaction control.
Types ¶
type Token ¶
type Token struct {
Word string
Identifier string
String string
Symbol string
Separator bool
Other bool
}
Token is one unquoted ASCII word, quoted identifier, quoted string, punctuation symbol, semicolon statement separator, or other executable SQL content. Whitespace and comments are skipped. String is retained only so a caller can reject dialects that permit quoted schema names; it remains Other.