Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoNewMigration = errors.New("no migration required")
)
Functions ¶
func RegisterDialect ¶
Types ¶
type ColumnType ¶
type Dialect ¶
type Dialect interface {
// SQL driver name
Driver() string
// Argument string to escape SQL injection
QuoteVar(n int) string
VarRune() rune
Var() string
// Character to escape table, column name
QuoteIdentifier(v string) string
// Quote rune can be ' or " or `
QuoteRune() rune
// Column data types
ColumnDataTypes() map[string]*ColumnType
// To create migration
Migrate(ctx context.Context, dsn string, w Writer, m TableMigrator) error
}
func DefaultDialect ¶
func DefaultDialect() Dialect
func GetDialect ¶
type GoColumn ¶
type GoColumn interface {
// Go field name
GoName() string
// Go field path
// eg. A.nested.Field
GoPath() string
// Go actual type
GoType() types.Type
// Is it a go nullable type? such as
// pointer, slice, map or chan
GoNullable() bool
// SQL column name
ColumnName() string
// SQL data type
DataType() string
// SQL default value, this can be
// string, []byte, bool, int64, float64, sql.RawBytes
Default() (driver.Value, bool)
// Determine whether this column is auto increment or not
AutoIncr() bool
// Key is to identify whether column is primary or foreign key
Key() bool
// Column size that declared by user
Size() int
}
type TableMigrator ¶
Click to show internal directories.
Click to hide internal directories.