dialect

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package dialect contains functionality for SQL dialects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultOps

func DefaultOps() map[string]string

DefaultOps returns a default map of SLQ operator (e.g. "==" or "!=") to its SQL rendering. The returned map is a copy and can be safely modified by the caller.

Types

type Dialect

type Dialect struct {
	// Placeholders returns a string a SQL placeholders string.
	// For example "(?, ?, ?)" or "($1, $2, $3), ($4, $5, $6)".
	Placeholders func(numCols, numRows int) string

	// Enquote is a function that quotes and escapes an
	// identifier (such as a table or column name). Typically the func
	// uses the double-quote rune (although MySQL uses backtick).
	Enquote func(string) string

	// Ops is a map of overridden SLQ operator (e.g. "==" or "!=") to
	// its SQL rendering.
	Ops map[string]string

	// Type is the dialect's driver type.
	Type drivertype.Type `json:"type"`

	// Joins is the set of JOIN types (e.g. "RIGHT JOIN") that
	// the dialect supports. Not all drivers support each join type. For
	// example, MySQL doesn't support jointype.FullOuter.
	Joins []jointype.Type

	// MaxBatchValues is the maximum number of values in a batch insert.
	MaxBatchValues int

	// IntBool is true if BOOLEAN is handled as an INT by the DB driver.
	IntBool bool `json:"int_bool"`

	// Catalog indicates that the database supports the catalog concept,
	// in addition to schema. For example, PostgreSQL supports catalog
	// and schema (sakila.public.actor), whereas MySQL only supports schema
	// (sakila.actor).
	Catalog bool
}

Dialect holds driver-specific SQL dialect values and functions.

func (Dialect) String

func (d Dialect) String() string

String returns a log/debug-friendly representation.

Jump to

Keyboard shortcuts

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