mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
为gtime添加scanner和valuer
This commit is contained in:
17
os/gtime/gtime_sql.go
Normal file
17
os/gtime/gtime_sql.go
Normal file
@ -0,0 +1,17 @@
|
||||
package gtime
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
)
|
||||
|
||||
//add Scanner
|
||||
func (t *Time) Scan(value interface{}) error {
|
||||
newTime := New(value)
|
||||
t.Time = newTime.Time
|
||||
return nil
|
||||
}
|
||||
|
||||
//add valuer
|
||||
func (t *Time) Value() (driver.Value, error) {
|
||||
return t.Time, nil
|
||||
}
|
||||
Reference in New Issue
Block a user