dialect

package
v0.36.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: MIT Imports: 1 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 {
	// Type is the dialect's driver type.
	Type source.DriverType `json:"type"`

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

	// IdentQuote is the identifier quote rune. Most often this is
	// double-quote, e.g. SELECT * FROM "my_table", but can be other
	// values such as backtick, e.g. SELECT * FROM `my_table`.
	//
	// Arguably, this field should be deprecated. There's probably
	// no reason not to always use Enquote.
	IdentQuote rune `json:"quote"`

	// Enquote is a function that quotes and escapes an
	// identifier (such as a table or column name).
	Enquote func(string) string

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

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

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

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