-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Hi, thanks for writing this library!
I don't understand how I can create a column that may be NULL in the database. Take a struct like the following:
type Person struct {
ID int64
BossID sql.NullInt64
}When a database is created by modl, the type of the column BossID (at least for sqlite3) is text. Why is that?
I have found the code mapping a column to the type here: https://github.com/jmoiron/modl/blob/master/dialect.go#L111-L112 It seems that it does test for the type name NullableInt64 instead of NullInt64. Is that intentional or a bug? I was unable to find any reference to the string NullableInt64, except in an early discussion on how to name the types within sql.Null*.
Creating a custom type works, but I don't think that this is the way it is supposed to be:
type NullableInt64 sql.NullInt64Now a database column with the type integer is created.
Am I missing something?