Skip to content

Commit

Permalink
Boolean support
Browse files Browse the repository at this point in the history
Only tested with PostgreSQL
  • Loading branch information
ottob committed Mar 5, 2013
1 parent 8874be3 commit 982e1f5
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 982e1f5

Please sign in to comment.