summaryrefslogtreecommitdiffstats
path: root/vendor/xorm.io/xorm/dialects/time.go
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.io>2022-01-14 18:16:05 -0500
committerGitHub <noreply@github.com>2022-01-14 18:16:05 -0500
commit84145e45c50130922fae9055535ab5ea0378e1d4 (patch)
treefce077a5ae462840bb876ace79aca42abab29ed7 /vendor/xorm.io/xorm/dialects/time.go
parent2b16ca7c773de278ba01f122dc6f9f43d7534c52 (diff)
downloadgitea-84145e45c50130922fae9055535ab5ea0378e1d4.tar.gz
gitea-84145e45c50130922fae9055535ab5ea0378e1d4.zip
Remove golang vendored directory (#18277)
* rm go vendor * fix drone yaml * add to gitignore
Diffstat (limited to 'vendor/xorm.io/xorm/dialects/time.go')
-rw-r--r--vendor/xorm.io/xorm/dialects/time.go61
1 files changed, 0 insertions, 61 deletions
diff --git a/vendor/xorm.io/xorm/dialects/time.go b/vendor/xorm.io/xorm/dialects/time.go
deleted file mode 100644
index f0bbb76518..0000000000
--- a/vendor/xorm.io/xorm/dialects/time.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2015 The Xorm Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package dialects
-
-import (
- "strings"
- "time"
-
- "xorm.io/xorm/schemas"
-)
-
-// FormatColumnTime format column time
-func FormatColumnTime(dialect Dialect, dbLocation *time.Location, col *schemas.Column, t time.Time) (interface{}, error) {
- if t.IsZero() {
- if col.Nullable {
- return nil, nil
- }
-
- if col.SQLType.IsNumeric() {
- return 0, nil
- }
- }
-
- var tmZone = dbLocation
- if col.TimeZone != nil {
- tmZone = col.TimeZone
- }
-
- t = t.In(tmZone)
-
- switch col.SQLType.Name {
- case schemas.Date:
- return t.Format("2006-01-02"), nil
- case schemas.Time:
- var layout = "15:04:05"
- if col.Length > 0 {
- layout += "." + strings.Repeat("0", col.Length)
- }
- return t.Format(layout), nil
- case schemas.DateTime, schemas.TimeStamp:
- var layout = "2006-01-02 15:04:05"
- if col.Length > 0 {
- layout += "." + strings.Repeat("0", col.Length)
- }
- return t.Format(layout), nil
- case schemas.Varchar:
- return t.Format("2006-01-02 15:04:05"), nil
- case schemas.TimeStampz:
- if dialect.URI().DBType == schemas.MSSQL {
- return t.Format("2006-01-02T15:04:05.9999999Z07:00"), nil
- } else {
- return t.Format(time.RFC3339Nano), nil
- }
- case schemas.BigInt, schemas.Int:
- return t.Unix(), nil
- default:
- return t, nil
- }
-}