Skip to content

Commit

Permalink
Merge pull request jmoiron#27 from ottob/bool_support
Browse files Browse the repository at this point in the history
Boolean support
  • Loading branch information
coopernurse committed May 10, 2013
2 parents d4c8e0b + 982e1f5 commit e7ebe4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dialect.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ type SqliteDialect struct {

func (d SqliteDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string {
switch val.Kind() {
case reflect.Bool:
return "integer"
case reflect.Int, reflect.Int16, reflect.Int32, reflect.Int64:
return "integer"
case reflect.Float64, reflect.Float32:
Expand Down Expand Up @@ -129,6 +131,8 @@ type PostgresDialect struct {

func (d PostgresDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string {
switch val.Kind() {
case reflect.Bool:
return "boolean"
case reflect.Int, reflect.Int16, reflect.Int32:
if isAutoIncr {
return "serial"
Expand Down Expand Up @@ -223,6 +227,8 @@ type MySQLDialect struct {

func (m MySQLDialect) ToSqlType(val reflect.Type, maxsize int, isAutoIncr bool) string {
switch val.Kind() {
case reflect.Bool:
return "boolean"
case reflect.Int, reflect.Int16, reflect.Int32:
return "int"
case reflect.Int64:
Expand Down

0 comments on commit e7ebe4b

Please sign in to comment.