import "xorm.io/xorm/dialects"
dialect.go driver.go filter.go mssql.go mysql.go oracle.go postgres.go quote.go sqlite3.go table_name.go time.go
var ( // DefaultPostgresSchema default postgres schema DefaultPostgresSchema = "public" )
ColumnString generate column description string according dialect
func FormatColumnTime(dialect Dialect, defaultTimeZone *time.Location, col *schemas.Column, t time.Time) (v interface{})
FormatTime format time as column type
func FullTableName(dialect Dialect, mapper names.Mapper, bean interface{}, includeSchema ...bool) string
FullTableName returns table name with quote and schema according parameter
QueryDefaultPostgresSchema returns the default postgres schema
RegisterDialect register database dialect
TableNameNoSchema returns table name with given tableName
TableNameWithSchema will add schema prefix on table name if possible
type Base struct {
// contains filtered or unexported fields
}
Base represents a basic dialect and all real dialects could embed this struct
func (db *Base) HasRecords(queryer core.Queryer, ctx context.Context, query string, args ...interface{}) (bool, error)
func (db *Base) IsColumnExist(queryer core.Queryer, ctx context.Context, tableName, colName string) (bool, error)
type Dialect interface { Init(*URI) error URI() *URI SQLType(*schemas.Column) string FormatBytes(b []byte) string IsReserved(string) bool Quoter() schemas.Quoter SetQuotePolicy(quotePolicy QuotePolicy) AutoIncrStr() string GetIndexes(queryer core.Queryer, ctx context.Context, tableName string) (map[string]*schemas.Index, error) IndexCheckSQL(tableName, idxName string) (string, []interface{}) CreateIndexSQL(tableName string, index *schemas.Index) string DropIndexSQL(tableName string, index *schemas.Index) string GetTables(queryer core.Queryer, ctx context.Context) ([]*schemas.Table, error) IsTableExist(queryer core.Queryer, ctx context.Context, tableName string) (bool, error) CreateTableSQL(table *schemas.Table, tableName string) ([]string, bool) DropTableSQL(tableName string) (string, bool) GetColumns(queryer core.Queryer, ctx context.Context, tableName string) ([]string, map[string]*schemas.Column, error) IsColumnExist(queryer core.Queryer, ctx context.Context, tableName string, colName string) (bool, error) AddColumnSQL(tableName string, col *schemas.Column) string ModifyColumnSQL(tableName string, col *schemas.Column) string ForUpdateSQL(query string) string Filters() []Filter SetParams(params map[string]string) }
Dialect represents a kind of database
OpenDialect opens a dialect via driver name and connection string
QueryDialect query if registered database dialect
Filter is an interface to filter SQL
QuotePolicy describes quote handle policy
const ( QuotePolicyAlways QuotePolicy = iota QuotePolicyNone QuotePolicyReserved )
All QuotePolicies
SeqFilter filter SQL replace ?, ? ... to $1, $2 ...
type URI struct { DBType schemas.DBType Proto string Host string Port string DBName string User string Passwd string Charset string Laddr string Raddr string Timeout time.Duration Schema string }
URI represents an uri to visit database
SetSchema set schema
Package dialects imports 15 packages (graph) and is imported by 8 packages. Updated 2021-01-22. Refresh now. Tools for package owners.