dialect

package
v0.0.0-...-0f2857b Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialect

type Dialect interface {
	Name() string
	Quote(ident string) string
	Placeholder(i int) string
	SupportsILIKE() bool
	SupportsReturning() bool
	JSONAgg(expr, orderBy string) string
	// JSONObject formats a JSON object literal from alternating key / value
	// expressions: pairs[0] is the first key, pairs[1] is its expression, and
	// so on. Keys must already be quoted as SQL literals (e.g., 'id').
	JSONObject(pairs []string) string
	// EmptyJSONArray returns a SQL expression equivalent to an empty JSON
	// array, used as a fallback when an aggregated subquery has no rows.
	EmptyJSONArray() string
	// StringLiteral renders s as a single-quoted SQL string literal with
	// engine-appropriate escaping (e.g., MySQL also escapes backslashes when
	// NO_BACKSLASH_ESCAPES is off, which is the default).
	StringLiteral(s string) string
	// ContainmentExpr returns an SQL boolean expression for a JSON / array
	// containment predicate. col is the already-quoted column reference,
	// valPlaceholder is the parameter placeholder for the right-hand value,
	// columnType is the column's introspected type (e.g., "jsonb",
	// "text[]", "json"), and contained switches between "col contains
	// value" (false: PostgREST's `cs`, Postgres `@>`) and "col is
	// contained in value" (true: PostgREST's `cd`, Postgres `<@`).
	// Returns an error if the dialect cannot express the operation for
	// the given column type.
	ContainmentExpr(col, valPlaceholder, columnType string, contained bool) (string, error)
}

func MySQL

func MySQL() Dialect

func Postgres

func Postgres() Dialect

Jump to

Keyboard shortcuts

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