This is a time function specific to the Postgres default DateStyle setting ("ISO, MDY"), the only one we currently support. This accounts for the discrepancies between the parsing available with time.Parse and the Postgres date formatting quirks.
(currentLocation *time.Location, str string)
| 295 | // discrepancies between the parsing available with time.Parse and the Postgres |
| 296 | // date formatting quirks. |
| 297 | func parseTS(currentLocation *time.Location, str string) (any, error) { |
| 298 | switch str { |
| 299 | case "-infinity": |
| 300 | if infinityTSEnabled { |
| 301 | return infinityTSNegative, nil |
| 302 | } |
| 303 | return []byte(str), nil |
| 304 | case "infinity": |
| 305 | if infinityTSEnabled { |
| 306 | return infinityTSPositive, nil |
| 307 | } |
| 308 | return []byte(str), nil |
| 309 | } |
| 310 | t, err := ParseTimestamp(currentLocation, str) |
| 311 | if err != nil { |
| 312 | err = errors.New("pq: " + err.Error()) |
| 313 | } |
| 314 | return t, err |
| 315 | } |
| 316 | |
| 317 | // ParseTimestamp parses Postgres' text format. It returns a time.Time in |
| 318 | // currentLocation iff that time's offset agrees with the offset sent from the |
no test coverage detected
searching dependent graphs…