Golang database/sql.NullBool type examples

package database/sql

NullBool represents a bool that may be null. NullBool implements the Scanner interface so it can be used as a scan destination, similar to NullString.

Golang database/sql.NullBool type usage examples

Example 1:

 type DataNull struct {
 Id int
 Boolean bool `orm:"null"`
 Char string `orm:"null;size(50)"`
 Text string `orm:"null;type(text)"`
 Date time.Time `orm:"null;type(date)"`
 DateTime time.Time `orm:"null;column(datetime)"`
 Byte byte `orm:"null"`
 NullBool sql.NullBool `orm:"null"`
 ...

Example 2:

 case sql.NullBool:
 fieldtype = TypeBooleanField

Reference :

http://golang.org/pkg/database/sql/#NullBool

Advertisement