fixed
This commit is contained in:
parent
a18c751d44
commit
22c515f1e0
|
@ -30,11 +30,12 @@ type Column struct {
|
||||||
IsCascade bool
|
IsCascade bool
|
||||||
IsVersion bool
|
IsVersion bool
|
||||||
fieldPath []string
|
fieldPath []string
|
||||||
|
DefaultIsEmpty bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewColumn(name, fieldName string, sqlType SQLType, len1, len2 int, nullable bool) *Column {
|
func NewColumn(name, fieldName string, sqlType SQLType, len1, len2 int, nullable bool) *Column {
|
||||||
return &Column{name, fieldName, sqlType, len1, len2, nullable, "", make(map[string]bool), false, false,
|
return &Column{name, fieldName, sqlType, len1, len2, nullable, "", make(map[string]bool), false, false,
|
||||||
TWOSIDES, false, false, false, false, nil}
|
TWOSIDES, false, false, false, false, nil, false}
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate column description string according dialect
|
// generate column description string according dialect
|
||||||
|
|
11
dialect.go
11
dialect.go
|
@ -1,6 +1,7 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -29,6 +30,8 @@ type Dialect interface {
|
||||||
SqlType(t *Column) string
|
SqlType(t *Column) string
|
||||||
SupportInsertMany() bool
|
SupportInsertMany() bool
|
||||||
QuoteStr() string
|
QuoteStr() string
|
||||||
|
RollBackStr() string
|
||||||
|
DropTableSql(tableName string) string
|
||||||
AutoIncrStr() string
|
AutoIncrStr() string
|
||||||
SupportEngine() bool
|
SupportEngine() bool
|
||||||
SupportCharset() bool
|
SupportCharset() bool
|
||||||
|
@ -83,6 +86,14 @@ func (b *Base) Quote(c string) string {
|
||||||
return b.dialect.QuoteStr() + c + b.dialect.QuoteStr()
|
return b.dialect.QuoteStr() + c + b.dialect.QuoteStr()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (db *Base) RollBackStr() string {
|
||||||
|
return "ROLL BACK"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (db *Base) DropTableSql(tableName string) string {
|
||||||
|
return fmt.Sprintf("DROP TABLE IF EXISTS `%s`", tableName)
|
||||||
|
}
|
||||||
|
|
||||||
func (b *Base) CreateTableSql(table *Table, tableName, storeEngine, charset string) string {
|
func (b *Base) CreateTableSql(table *Table, tableName, storeEngine, charset string) string {
|
||||||
var sql string
|
var sql string
|
||||||
sql = "CREATE TABLE IF NOT EXISTS "
|
sql = "CREATE TABLE IF NOT EXISTS "
|
||||||
|
|
Loading…
Reference in New Issue