Documentation
¶
Index ¶
- Variables
- type Dialect
- type Feature
- type LimitSyntax
- type MySQLDialect
- func (d *MySQLDialect) GetDataTypes() []string
- func (d *MySQLDialect) GetKeywords() []string
- func (d *MySQLDialect) GetLimitSyntax() LimitSyntax
- func (d *MySQLDialect) IsReservedWord(word string) bool
- func (d *MySQLDialect) Name() string
- func (d *MySQLDialect) QuoteIdentifier(identifier string) string
- func (d *MySQLDialect) SupportsFeature(feature Feature) bool
- type OracleDialect
- func (d *OracleDialect) GetDataTypes() []string
- func (d *OracleDialect) GetKeywords() []string
- func (d *OracleDialect) GetLimitSyntax() LimitSyntax
- func (d *OracleDialect) IsReservedWord(word string) bool
- func (d *OracleDialect) Name() string
- func (d *OracleDialect) QuoteIdentifier(identifier string) string
- func (d *OracleDialect) SupportsFeature(feature Feature) bool
- type PostgreSQLDialect
- func (d *PostgreSQLDialect) GetDataTypes() []string
- func (d *PostgreSQLDialect) GetKeywords() []string
- func (d *PostgreSQLDialect) GetLimitSyntax() LimitSyntax
- func (d *PostgreSQLDialect) IsReservedWord(word string) bool
- func (d *PostgreSQLDialect) Name() string
- func (d *PostgreSQLDialect) QuoteIdentifier(identifier string) string
- func (d *PostgreSQLDialect) SupportsFeature(feature Feature) bool
- type SQLServerDialect
- func (d *SQLServerDialect) GetDataTypes() []string
- func (d *SQLServerDialect) GetKeywords() []string
- func (d *SQLServerDialect) GetLimitSyntax() LimitSyntax
- func (d *SQLServerDialect) IsReservedWord(word string) bool
- func (d *SQLServerDialect) Name() string
- func (d *SQLServerDialect) QuoteIdentifier(identifier string) string
- func (d *SQLServerDialect) SupportsFeature(feature Feature) bool
- type SQLiteDialect
- func (d *SQLiteDialect) GetDataTypes() []string
- func (d *SQLiteDialect) GetKeywords() []string
- func (d *SQLiteDialect) GetLimitSyntax() LimitSyntax
- func (d *SQLiteDialect) IsReservedWord(word string) bool
- func (d *SQLiteDialect) Name() string
- func (d *SQLiteDialect) QuoteIdentifier(identifier string) string
- func (d *SQLiteDialect) SupportsFeature(feature Feature) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var CommonDataTypes = []string{
"INT", "INTEGER", "BIGINT", "SMALLINT", "TINYINT",
"DECIMAL", "NUMERIC", "FLOAT", "REAL", "DOUBLE",
"CHAR", "VARCHAR", "TEXT", "NCHAR", "NVARCHAR",
"DATE", "TIME", "DATETIME", "TIMESTAMP",
"BOOLEAN", "BOOL", "BIT",
"BLOB", "BINARY", "VARBINARY",
}
Common data types
View Source
var CommonKeywords = []string{
"SELECT", "FROM", "WHERE", "JOIN", "INNER", "LEFT", "RIGHT", "FULL", "OUTER",
"ON", "AS", "AND", "OR", "NOT", "IN", "EXISTS", "BETWEEN", "LIKE", "IS", "NULL",
"INSERT", "INTO", "VALUES", "UPDATE", "SET", "DELETE", "CREATE", "TABLE", "INDEX",
"DROP", "ALTER", "ADD", "COLUMN", "PRIMARY", "KEY", "FOREIGN", "REFERENCES",
"UNIQUE", "CHECK", "DEFAULT", "AUTO_INCREMENT", "IDENTITY",
"GROUP", "BY", "HAVING", "ORDER", "ASC", "DESC", "LIMIT", "OFFSET",
"UNION", "ALL", "DISTINCT", "CASE", "WHEN", "THEN", "ELSE", "END",
"CAST", "CONVERT", "COUNT", "SUM", "AVG", "MIN", "MAX",
}
Common keywords shared across most SQL dialects
Functions ¶
This section is empty.
Types ¶
type Dialect ¶
type Dialect interface {
// Name returns the dialect name
Name() string
// QuoteIdentifier returns the proper way to quote identifiers in this dialect
QuoteIdentifier(identifier string) string
// SupportsFeature checks if a feature is supported in this dialect
SupportsFeature(feature Feature) bool
// GetKeywords returns dialect-specific keywords
GetKeywords() []string
// GetDataTypes returns dialect-specific data types
GetDataTypes() []string
// IsReservedWord checks if a word is reserved in this dialect
IsReservedWord(word string) bool
// GetLimitSyntax returns the LIMIT clause syntax for this dialect
GetLimitSyntax() LimitSyntax
}
Dialect represents a SQL dialect with its specific features and syntax
func GetDialect ¶
GetDialect returns the appropriate dialect implementation
type LimitSyntax ¶
type LimitSyntax int
LimitSyntax represents different ways to limit results
const ( LimitSyntaxStandard LimitSyntax = iota // LIMIT n OFFSET m LimitSyntaxSQLServer // TOP n LimitSyntaxOracle // ROWNUM )
type MySQLDialect ¶
type MySQLDialect struct{}
MySQLDialect implements MySQL-specific features
func (*MySQLDialect) GetDataTypes ¶
func (d *MySQLDialect) GetDataTypes() []string
func (*MySQLDialect) GetKeywords ¶
func (d *MySQLDialect) GetKeywords() []string
func (*MySQLDialect) GetLimitSyntax ¶
func (d *MySQLDialect) GetLimitSyntax() LimitSyntax
func (*MySQLDialect) IsReservedWord ¶
func (d *MySQLDialect) IsReservedWord(word string) bool
func (*MySQLDialect) Name ¶
func (d *MySQLDialect) Name() string
func (*MySQLDialect) QuoteIdentifier ¶
func (d *MySQLDialect) QuoteIdentifier(identifier string) string
func (*MySQLDialect) SupportsFeature ¶
func (d *MySQLDialect) SupportsFeature(feature Feature) bool
type OracleDialect ¶
type OracleDialect struct{}
OracleDialect implements Oracle-specific features
func (*OracleDialect) GetDataTypes ¶
func (d *OracleDialect) GetDataTypes() []string
func (*OracleDialect) GetKeywords ¶
func (d *OracleDialect) GetKeywords() []string
func (*OracleDialect) GetLimitSyntax ¶
func (d *OracleDialect) GetLimitSyntax() LimitSyntax
func (*OracleDialect) IsReservedWord ¶
func (d *OracleDialect) IsReservedWord(word string) bool
func (*OracleDialect) Name ¶
func (d *OracleDialect) Name() string
func (*OracleDialect) QuoteIdentifier ¶
func (d *OracleDialect) QuoteIdentifier(identifier string) string
func (*OracleDialect) SupportsFeature ¶
func (d *OracleDialect) SupportsFeature(feature Feature) bool
type PostgreSQLDialect ¶
type PostgreSQLDialect struct{}
PostgreSQLDialect implements PostgreSQL-specific features
func (*PostgreSQLDialect) GetDataTypes ¶
func (d *PostgreSQLDialect) GetDataTypes() []string
func (*PostgreSQLDialect) GetKeywords ¶
func (d *PostgreSQLDialect) GetKeywords() []string
func (*PostgreSQLDialect) GetLimitSyntax ¶
func (d *PostgreSQLDialect) GetLimitSyntax() LimitSyntax
func (*PostgreSQLDialect) IsReservedWord ¶
func (d *PostgreSQLDialect) IsReservedWord(word string) bool
func (*PostgreSQLDialect) Name ¶
func (d *PostgreSQLDialect) Name() string
func (*PostgreSQLDialect) QuoteIdentifier ¶
func (d *PostgreSQLDialect) QuoteIdentifier(identifier string) string
func (*PostgreSQLDialect) SupportsFeature ¶
func (d *PostgreSQLDialect) SupportsFeature(feature Feature) bool
type SQLServerDialect ¶
type SQLServerDialect struct{}
SQLServerDialect implements SQL Server-specific features
func (*SQLServerDialect) GetDataTypes ¶
func (d *SQLServerDialect) GetDataTypes() []string
func (*SQLServerDialect) GetKeywords ¶
func (d *SQLServerDialect) GetKeywords() []string
func (*SQLServerDialect) GetLimitSyntax ¶
func (d *SQLServerDialect) GetLimitSyntax() LimitSyntax
func (*SQLServerDialect) IsReservedWord ¶
func (d *SQLServerDialect) IsReservedWord(word string) bool
func (*SQLServerDialect) Name ¶
func (d *SQLServerDialect) Name() string
func (*SQLServerDialect) QuoteIdentifier ¶
func (d *SQLServerDialect) QuoteIdentifier(identifier string) string
func (*SQLServerDialect) SupportsFeature ¶
func (d *SQLServerDialect) SupportsFeature(feature Feature) bool
type SQLiteDialect ¶
type SQLiteDialect struct{}
SQLiteDialect implements SQLite-specific features
func (*SQLiteDialect) GetDataTypes ¶
func (d *SQLiteDialect) GetDataTypes() []string
func (*SQLiteDialect) GetKeywords ¶
func (d *SQLiteDialect) GetKeywords() []string
func (*SQLiteDialect) GetLimitSyntax ¶
func (d *SQLiteDialect) GetLimitSyntax() LimitSyntax
func (*SQLiteDialect) IsReservedWord ¶
func (d *SQLiteDialect) IsReservedWord(word string) bool
func (*SQLiteDialect) Name ¶
func (d *SQLiteDialect) Name() string
func (*SQLiteDialect) QuoteIdentifier ¶
func (d *SQLiteDialect) QuoteIdentifier(identifier string) string
func (*SQLiteDialect) SupportsFeature ¶
func (d *SQLiteDialect) SupportsFeature(feature Feature) bool
Click to show internal directories.
Click to hide internal directories.