feat(pkg/db): postgres database
This commit is contained in:
23
pkg/internal/format/format.go
Normal file
23
pkg/internal/format/format.go
Normal file
@ -0,0 +1,23 @@
|
||||
package format
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
errorPraseTime = errors.New("Can not parse time")
|
||||
|
||||
TimeFormat = "2006-01-02T15:04:05.999999Z07:00"
|
||||
)
|
||||
|
||||
// FormatedTime returns a current timestamp without nano seconds. Postgres
|
||||
// currently does not support nanoseconds which is automatically include into
|
||||
// the go time object
|
||||
func FormatedTime() time.Time {
|
||||
t := time.Now()
|
||||
l, _ := time.LoadLocation("Europe/Berlin")
|
||||
return time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), int(math.Round(float64(t.Nanosecond())/1000000)*1000000), l)
|
||||
|
||||
}
|
Reference in New Issue
Block a user