MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / ParseDTimestamp

Function ParseDTimestamp

pkg/sql/sem/tree/datum.go:2636–2646  ·  view source on GitHub ↗

ParseDTimestamp parses and returns the *DTimestamp Datum value represented by the provided string in UTC, or an error if parsing is unsuccessful. The dependsOnContext return value indicates if we had to consult the ParseContext (either for the time or the local timezone). Parts of this function ar

(
	ctx ParseContext, s string, precision time.Duration,
)

Source from the content-addressed store, hash-verified

2634// Parts of this function are inlined into ParseAndRequireStringHandler, if this
2635// changes materially the timestamp case arms there may need to change too.
2636func ParseDTimestamp(
2637 ctx ParseContext, s string, precision time.Duration,
2638) (_ *DTimestamp, dependsOnContext bool, _ error) {
2639 now := relativeParseTime(ctx)
2640 t, dependsOnContext, err := pgdate.ParseTimestampWithoutTimezone(now, dateStyle(ctx), s, dateParseHelper(ctx))
2641 if err != nil {
2642 return nil, false, err
2643 }
2644 d, err := MakeDTimestamp(t, precision)
2645 return d, dependsOnContext, err
2646}
2647
2648// AsDTimestamp attempts to retrieve a DTimestamp from an Expr, returning a DTimestamp and
2649// a flag signifying whether the assertion was successful. The function should

Callers 1

ParseAndRequireStringFunction · 0.85

Calls 5

relativeParseTimeFunction · 0.85
dateStyleFunction · 0.85
dateParseHelperFunction · 0.85
MakeDTimestampFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…