Add Value() method to gorm_test.Num to prevent scan error
This commit is contained in:
parent
62740e8e1e
commit
a4ba25028d
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user