Documentation
¶
Overview ¶
Package dialect holds the SQL differences between databases behind one interface: identifier quoting, placeholders, LIKE and date handling, locks, index hints and a few join/union rules. Everything the databases share lives in the compiler of the root package, so supporting a new database is a new Grammar.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Grammar ¶
type Grammar interface {
// Quote wraps a single identifier segment, escaping embedded quote chars.
Quote(segment string) string
// QuoteChar is the identifier quote byte Quote wraps with, so callers can write a
// quoted identifier straight into a buffer without allocating.
QuoteChar() byte
// Placeholder returns the bind marker for the n-th (1-based) argument.
Placeholder(n int) string
// UnboundedLimit returns the limit literal required when OFFSET is used
// without LIMIT, or "" when the dialect accepts a bare OFFSET.
UnboundedLimit() string
// LikeOp returns the LIKE operator for the case-sensitivity / negation combo.
LikeOp(caseSensitive, not bool) string
// LikeValue adapts a LIKE pattern for the chosen operator.
LikeValue(pattern string, caseSensitive bool) string
// LikeCast returns a suffix appended to the wrapped column for LIKE operators.
LikeCast(op string) string
// NullSafeOp returns the NULL-safe equality operator.
NullSafeOp() string
// DatePart extracts part ("date","time","day","month","year") from a wrapped column.
DatePart(part, col string) string
// DateValueWrap wraps the right-hand side of a date comparison.
DateValueWrap() (pre, post string)
SupportsStraightJoin() bool
SupportsLateralJoin() bool
// UnionOpen opens a wrapped union member: "(" or "SELECT * FROM (".
UnionOpen() string
// LockSQL returns the locking clause, or "" when none applies.
LockSQL(kind LockKind, raw string) string
// IndexHint renders an index hint after the FROM table, or "" when unsupported.
IndexHint(kind, index string) (string, error)
// Random returns the random-order expression; seed may be nil.
Random(seed *int) string
}
Grammar holds the per-dialect differences. Everything shared lives in the compiler.
Click to show internal directories.
Click to hide internal directories.