Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
AllDialects lists all currently-supported dialects.
Functions ¶
This section is empty.
Types ¶
type Dialect ¶
type Dialect interface { // Index returns a consistent ID for this dialect, regardless of other settings. Index() dialect.Dialect // String returns the name (and quoter if present) of this dialect. String() string // Name returns the name of this dialect. Name() string // Alias is an alternative name for this dialect. Alias() string // Config is the dialect config wrapped in this driver adapter. Config() dialect.DialectConfig // Quoter is the tool used for quoting identifiers. Quoter() quote.Quoter // WithQuoter returns a modified Dialect with a given quoter. WithQuoter(q quote.Quoter) Dialect FieldAsColumn(field *schema.Field) string TruncateDDL(tableName string, force bool) []string CreateTableSettings() string ShowTables() string // ReplacePlaceholders alters a query string by replacing the '?' placeholders with the appropriate // placeholders needed by this dialect. For MySQL and SQlite3, the string is returned unchanged. ReplacePlaceholders(sql string, args []interface{}) string // Placeholders returns a comma-separated list of n placeholders. Placeholders(n int) string // HasNumberedPlaceholders returns true for dialects such as PostgreSQL that use numbered placeholders. HasNumberedPlaceholders() bool // HasLastInsertId returns true for dialects such as MySQL that return a last-insert ID after each // INSERT. This allows the corresponding feature of the database/sql API to work. // It is the inverse of InsertHasReturningPhrase. HasLastInsertId() bool // InsertHasReturningPhrase returns true for dialects such as Postgres that use a RETURNING phrase to // obtain the last-insert ID after each INSERT. // It is the inverse of HasLastInsertId. InsertHasReturningPhrase() bool }
Dialect is an abstraction of a type of database.
func Mysql ¶
func Mysql(d ...dialect.DialectConfig) Dialect
func Pgx ¶
func Pgx(d ...dialect.DialectConfig) Dialect
func PickDialect ¶
PickDialect finds a dialect that matches by name, ignoring letter case. It returns nil if not found.
func Postgres ¶
func Postgres(d ...dialect.DialectConfig) Dialect
func Sqlite ¶
func Sqlite(d ...dialect.DialectConfig) Dialect
type StringWriter ¶
StringWriter is an interface that wraps the WriteString method. Note that bytes.Buffer happens to implement this interface.
Click to show internal directories.
Click to hide internal directories.