MCPcopy Create free account
hub / github.com/dolthub/doltgresql / Timestamp

Function Timestamp

testing/go/framework.go:866–875  ·  view source on GitHub ↗

Timestamp is a helper function to convert timestamp strings to pgtype.Timestamp instances. If the string cannot be converted, this function will panic.

(timestampStr string)

Source from the content-addressed store, hash-verified

864// Timestamp is a helper function to convert timestamp strings to pgtype.Timestamp instances. If
865// the string cannot be converted, this function will panic.
866func Timestamp(timestampStr string) (ret pgtype.Timestamp) {
867 t, err := time.Parse("2006-01-02 15:04:05", timestampStr)
868 if err != nil {
869 panic("invalid timestamp format: " + err.Error())
870 }
871 if err := ret.Scan(t); err != nil {
872 panic("failed to set pgtype.Timestamp: " + err.Error())
873 }
874 return ret
875}
876
877// Date is a helper function to convert date strings to pgtype.Date instances. If the string
878// cannot be converted, this function will panic.

Callers 1

Calls 3

ParseMethod · 0.45
ErrorMethod · 0.45
ScanMethod · 0.45

Tested by

no test coverage detected