Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
gouguoyin committed Sep 12, 2023
1 parent 3f07ac4 commit c3a3945
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions database.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func (c *Carbon) Scan(v interface{}) error {
value, ok := v.(time.Time)
if ok {
*c = Carbon{time: value, loc: time.Local}
*c = CreateFromStdTime(value)
return nil
}
return fmt.Errorf("can not convert %v to carbon", v)
Expand All @@ -21,5 +21,5 @@ func (c Carbon) Value() (driver.Value, error) {
if c.IsZero() {
return nil, nil
}
return c.time, nil
return c.ToStdTime(), nil
}

0 comments on commit c3a3945

Please sign in to comment.