fix(sql): Add boolstr to all dialects

closes #6116
This commit is contained in:
bergquist
2016-09-23 08:07:14 +02:00
parent 521b5cf014
commit e5c64732f1
7 changed files with 20 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ type Dialect interface {
SupportEngine() bool
LikeStr() string
Default(col *Column) string
BooleanStr(bool) string
CreateIndexSql(tableName string, index *Index) string
CreateTableSql(table *Table) string

View File

@@ -29,6 +29,10 @@ func (db *Mysql) AutoIncrStr() string {
return "AUTO_INCREMENT"
}
func (db *Mysql) BooleanStr(value bool) string {
return strconv.FormatBool(value)
}
func (db *Mysql) SqlType(c *Column) string {
var res string
switch c.Type {

View File

@@ -36,6 +36,10 @@ func (db *Postgres) AutoIncrStr() string {
return ""
}
func (db *Postgres) BooleanStr(value bool) string {
return strconv.FormatBool(value)
}
func (b *Postgres) Default(col *Column) string {
if col.Type == DB_Bool {
if col.Default == "0" {

View File

@@ -29,6 +29,13 @@ func (db *Sqlite3) AutoIncrStr() string {
return "AUTOINCREMENT"
}
func (db *Sqlite3) BooleanStr(value bool) string {
if value {
return "1"
}
return "0"
}
func (db *Sqlite3) SqlType(c *Column) string {
switch c.Type {
case DB_Date, DB_DateTime, DB_TimeStamp, DB_Time: