dialect

package
v0.0.0-...-9522951 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2017 License: MIT Imports: 3 Imported by: 0

README

dialect GoDoc

The dialect package handles differences in SQL dialects.

There is no backward compatibility guarantee for this package.

Documentation

Overview

Package dialect handles differences in various SQL dialects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialect

type Dialect interface {
	// Name of the dialect.
	Name() string

	// Quote a table name or column name so that it does
	// not clash with any reserved words. The SQL-99 standard
	// specifies double quotes (eg "table_name"), but many
	// dialects, including MySQL use the backtick (eg `table_name`).
	// SQL server uses square brackets (eg [table_name]).
	Quote(name string) string

	// Return the placeholder for binding a variable value.
	// Most SQL dialects support a single question mark (?), but
	// PostgreSQL uses numbered placeholders (eg $1).
	Placeholder(n int) string
}

Dialect is an interface used to handle differences in SQL dialects.

func For

func For(name string) Dialect

For returns a dialect for the specified database driver. If name is blank, then the dialect returned is for the first driver returned by sql.Drivers(). If the driver name is unknown, the default dialect is returned.

Supported dialects include:

name      alternative names
----      -----------------
mssql
mysql
postgres  pq, postgresql
sqlite3   sqlite
ql        ql-mem

Jump to

Keyboard shortcuts

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