aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/go-xorm/core/scan.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2019-10-23 23:03:17 -0700
committerGitHub <noreply@github.com>2019-10-23 23:03:17 -0700
commit613139e7bef81d3573e7988a47eb6765f3de347a (patch)
tree49de7277898d3ff47a122c072568edb8ed4c9ac9 /vendor/github.com/go-xorm/core/scan.go
parentfb100dbf98f02e4c631d142ff0f52ec29ee2f00c (diff)
Enable Go modules (#5835)
* Remove vendor * Enable Go modules * ci: add command to fetch dependencies * ci: update setting * ci: update settings * Require Go 1.11 * Rename module name to gogs.io/gogs
Diffstat (limited to 'vendor/github.com/go-xorm/core/scan.go')
-rw-r--r--vendor/github.com/go-xorm/core/scan.go55
1 files changed, 0 insertions, 55 deletions
diff --git a/vendor/github.com/go-xorm/core/scan.go b/vendor/github.com/go-xorm/core/scan.go
deleted file mode 100644
index b7c159b2..00000000
--- a/vendor/github.com/go-xorm/core/scan.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package core
-
-import (
- "database/sql/driver"
- "fmt"
- "time"
-)
-
-type NullTime time.Time
-
-var (
- _ driver.Valuer = NullTime{}
-)
-
-func (ns *NullTime) Scan(value interface{}) error {
- if value == nil {
- return nil
- }
- return convertTime(ns, value)
-}
-
-// Value implements the driver Valuer interface.
-func (ns NullTime) Value() (driver.Value, error) {
- if (time.Time)(ns).IsZero() {
- return nil, nil
- }
- return (time.Time)(ns).Format("2006-01-02 15:04:05"), nil
-}
-
-func convertTime(dest *NullTime, src interface{}) error {
- // Common cases, without reflect.
- switch s := src.(type) {
- case string:
- t, err := time.Parse("2006-01-02 15:04:05", s)
- if err != nil {
- return err
- }
- *dest = NullTime(t)
- return nil
- case []uint8:
- t, err := time.Parse("2006-01-02 15:04:05", string(s))
- if err != nil {
- return err
- }
- *dest = NullTime(t)
- return nil
- case time.Time:
- *dest = NullTime(s)
- return nil
- case nil:
- default:
- return fmt.Errorf("unsupported driver -> Scan pair: %T -> %T", src, dest)
- }
- return nil
-}