Documentation
¶
Overview ¶
Package quoting provides shared identifier quoting utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Backtick ¶
Backtick quotes a SQL identifier using backticks (MySQL). Internal backticks are escaped by doubling them.
func DoubleQuote ¶
DoubleQuote quotes a SQL identifier using double quotes (PostgreSQL, SQLite, ANSI SQL). Internal double quotes are escaped by doubling them.
func EscapeLikePattern ¶
EscapeLikePattern escapes LIKE wildcard characters (%, _) in a string so they are matched literally. The backslash is used as the escape character.
func EscapeString ¶
EscapeString escapes a string literal for SQL by doubling single quotes and escaping backslashes (for MySQL compatibility).
SECURITY: This escaping is intended for non-parameterized mode only. Production code should use parameterized queries (visitors.WithParams()) for all user-provided values. In particular, MySQL with non-default character sets (GBK, SJIS) may have multi-byte sequences where a trailing byte coincides with backslash or quote; parameterized queries avoid this class of attack entirely.
Types ¶
This section is empty.