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

Function Date

testing/go/framework.go:879–888  ·  view source on GitHub ↗

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

(dateStr string)

Source from the content-addressed store, hash-verified

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.
879func Date(dateStr string) (d pgtype.Date) {
880 t, err := time.Parse("2006-01-02", dateStr)
881 if err != nil {
882 panic("invalid date format: " + err.Error())
883 }
884 if err := d.Scan(t); err != nil {
885 panic("failed to set pgtype.Date: " + err.Error())
886 }
887 return d
888}
889
890// UUID is a helper function to convert UUID strings to pgtype.UUID instances. If the string
891// 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