ParseDTimestamp parses and returns the *DTimestamp Datum value represented by the provided string in UTC, or an error if parsing is unsuccessful.
(ctx ParseTimeContext, s string, precision time.Duration)
| 2152 | // ParseDTimestamp parses and returns the *DTimestamp Datum value represented by |
| 2153 | // the provided string in UTC, or an error if parsing is unsuccessful. |
| 2154 | func ParseDTimestamp(ctx ParseTimeContext, s string, precision time.Duration) (*DTimestamp, error) { |
| 2155 | now := relativeParseTime(ctx) |
| 2156 | t, err := pgdate.ParseTimestamp(now, pgdate.ParseModeYMD, s) |
| 2157 | if err != nil { |
| 2158 | return nil, err |
| 2159 | } |
| 2160 | // Truncate the timezone. DTimestamp doesn't carry its timezone around. |
| 2161 | _, offset := t.Zone() |
| 2162 | t = t.Add(time.Duration(offset) * time.Second).UTC() |
| 2163 | return MakeDTimestamp(t, precision), nil |
| 2164 | } |
| 2165 | |
| 2166 | // AsDTimestamp attempts to retrieve a DTimestamp from an Expr, returning a DTimestamp and |
| 2167 | // a flag signifying whether the assertion was successful. The function should |
no test coverage detected
searching dependent graphs…