dialect

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: BSD-2-Clause Imports: 3 Imported by: 6

Documentation

Index

Constants

View Source
const (
	SqliteIndex = iota
	MysqlIndex
	PostgresIndex
)

Variables

Mysql handles the MySQL syntax.

Postgres handles the PostgreSQL syntax.

Sqlite handles the Sqlite syntax.

Functions

func ReplacePlaceholdersWithNumbers

func ReplacePlaceholdersWithNumbers(sql string) string

ReplacePlaceholdersWithNumbers replaces all '?' placeholders with '$1' etc numbered placeholders, as used by PostgreSQL etc.

Types

type Dialect

type Dialect struct {
	// Name is used for
	Ident int

	// HasNumberedPlaceholders is true for numbered placehoders (Postgresql),
	// or false for the default '?' placeholders.
	PlaceholderStyle PlaceholderStyle

	// Quoter determines the quote marks surrounding identifiers.
	Quoter quote.Quoter
}

func PickDialect

func PickDialect(name string) (Dialect, bool)

PickDialect finds a dialect that matches by name, ignoring letter case. It returns false if not found.

func (Dialect) ReplacePlaceholders

func (dialect Dialect) ReplacePlaceholders(sql string, names []string) string

ReplacePlaceholders converts a string containing '?' placeholders to the form used by the dialect.

type PlaceholderStyle

type PlaceholderStyle int
const (
	Queries PlaceholderStyle = iota
	Numbered
)

Jump to

Keyboard shortcuts

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