Add Value() method to gorm_test.Num to prevent scan error

This commit is contained in:
Ian Tan 2017-11-20 16:02:40 +08:00
parent 62740e8e1e
commit a4ba25028d

View File

@ -139,6 +139,11 @@ func (role Role) IsAdmin() bool {
type Num int64 type Num int64
func (i *Num) Value() (driver.Value, error) {
// guaranteed ok
return int64(*i), nil
}
func (i *Num) Scan(src interface{}) error { func (i *Num) Scan(src interface{}) error {
switch s := src.(type) { switch s := src.(type) {
case []byte: case []byte: