MCPcopy Create free account
hub / github.com/lib/pq / formatTS

Function formatTS

encode.go:326–338  ·  view source on GitHub ↗

formatTS formats t into a format postgres understands.

(t time.Time)

Source from the content-addressed store, hash-verified

324
325// formatTS formats t into a format postgres understands.
326func formatTS(t time.Time) []byte {
327 if infinityTSEnabled {
328 // t <= -infinity : ! (t > -infinity)
329 if !t.After(infinityTSNegative) {
330 return []byte("-infinity")
331 }
332 // t >= infinity : ! (!t < infinity)
333 if !t.Before(infinityTSPositive) {
334 return []byte("infinity")
335 }
336 }
337 return FormatTimestamp(t)
338}
339
340// FormatTimestamp formats t into Postgres' text format for timestamps.
341func FormatTimestamp(t time.Time) []byte {

Callers 2

encodeFunction · 0.85
appendEncodedTextFunction · 0.85

Calls 1

FormatTimestampFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…