You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/vendor/github.com/gogf/gf/v2/os/gtime/gtime_sql.go

29 lines
595 B

package gtime
import (
"database/sql/driver"
)
// Scan implements interface used by Scan in package database/sql for Scanning value
// from database to local golang variable.
func (t *Time) Scan(value interface{}) error {
if t == nil {
return nil
}
newTime := New(value)
*t = *newTime
return nil
}
// Value is the interface providing the Value method for package database/sql/driver
// for retrieving value from golang variable to database.
func (t *Time) Value() (driver.Value, error) {
if t == nil {
return nil, nil
}
if t.IsZero() {
return nil, nil
}
return t.Time, nil
}