Remove unused Scanner type from dialect

This commit is contained in:
Jinzhu 2014-03-16 07:50:57 +08:00
parent dc2f27401e
commit 4969fc9cb5
3 changed files with 12 additions and 15 deletions

View File

@ -1,7 +1,6 @@
package dialect package dialect
import ( import (
"database/sql"
"fmt" "fmt"
"time" "time"
) )
@ -20,13 +19,13 @@ func (d *mysql) SqlTag(column interface{}, size int) string {
switch column.(type) { switch column.(type) {
case time.Time: case time.Time:
return "datetime" return "datetime"
case bool, sql.NullBool: case bool:
return "boolean" return "boolean"
case int, int8, int16, int32, uint, uint8, uint16, uint32: case int, int8, int16, int32, uint, uint8, uint16, uint32:
return "int" return "int"
case int64, uint64, sql.NullInt64: case int64, uint64:
return "bigint" return "bigint"
case float32, float64, sql.NullFloat64: case float32, float64:
return "double" return "double"
case []byte: case []byte:
if size > 0 && size < 65532 { if size > 0 && size < 65532 {
@ -34,7 +33,7 @@ func (d *mysql) SqlTag(column interface{}, size int) string {
} else { } else {
return "longblob" return "longblob"
} }
case string, sql.NullString: case string:
if size > 0 && size < 65532 { if size > 0 && size < 65532 {
return fmt.Sprintf("varchar(%d)", size) return fmt.Sprintf("varchar(%d)", size)
} else { } else {

View File

@ -1,7 +1,6 @@
package dialect package dialect
import ( import (
"database/sql"
"fmt" "fmt"
"time" "time"
) )
@ -21,17 +20,17 @@ func (d *postgres) SqlTag(column interface{}, size int) string {
switch column.(type) { switch column.(type) {
case time.Time: case time.Time:
return "timestamp with time zone" return "timestamp with time zone"
case bool, sql.NullBool: case bool:
return "boolean" return "boolean"
case int, int8, int16, int32, uint, uint8, uint16, uint32: case int, int8, int16, int32, uint, uint8, uint16, uint32:
return "integer" return "integer"
case int64, uint64, sql.NullInt64: case int64, uint64:
return "bigint" return "bigint"
case float32, float64, sql.NullFloat64: case float32, float64:
return "numeric" return "numeric"
case []byte: case []byte:
return "bytea" return "bytea"
case string, sql.NullString: case string:
if size > 0 && size < 65532 { if size > 0 && size < 65532 {
return fmt.Sprintf("varchar(%d)", size) return fmt.Sprintf("varchar(%d)", size)
} else { } else {

View File

@ -1,7 +1,6 @@
package dialect package dialect
import ( import (
"database/sql"
"fmt" "fmt"
"time" "time"
) )
@ -20,17 +19,17 @@ func (s *sqlite3) SqlTag(column interface{}, size int) string {
switch column.(type) { switch column.(type) {
case time.Time: case time.Time:
return "datetime" return "datetime"
case bool, sql.NullBool: case bool:
return "bool" return "bool"
case int, int8, int16, int32, uint, uint8, uint16, uint32: case int, int8, int16, int32, uint, uint8, uint16, uint32:
return "integer" return "integer"
case int64, uint64, sql.NullInt64: case int64, uint64:
return "bigint" return "bigint"
case float32, float64, sql.NullFloat64: case float32, float64:
return "real" return "real"
case []byte: case []byte:
return "blob" return "blob"
case string, sql.NullString: case string:
if size > 0 && size < 65532 { if size > 0 && size < 65532 {
return fmt.Sprintf("varchar(%d)", size) return fmt.Sprintf("varchar(%d)", size)
} else { } else {