beedb
beedb copied to clipboard
Can not enter null values
It's possible I'm missing something, but how do you enter null values in for columns?
For example, giving the code:
type Userinfo struct {
Uid int `PK`
Age int
Departname string
Created time.Time
}
var saveone Userinfo
saveone.Username = "Test Add User"
saveone.Departname = "Dept"
saveone.Created = time.Now()
orm.Save(&saveone)
How would I enter a NULL value for Age? This code will insert a "0" for Age.
@hobbs, in go a null value depends on the type. For an int
the null value is 0
, for string
it is ""
, etc...
That's more of an FYI statement than an answer to how to add a NULL field in the DB, sorry.