From 982e1f562536084a29cb55bbe562db9e1a186570 Mon Sep 17 00:00:00 2001 From: Otto Bretz Date: Tue, 5 Mar 2013 19:00:19 +0100 Subject: [PATCH] Boolean support Only tested with PostgreSQL --- dialect.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dialect.go b/dialect.go index a463aad..5bf3f52 100644 --- a/dialect.go +++ b/dialect.go @@ -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: @@ -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" @@ -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: