PGWireFormatTimeTZ formats t into a format lib/pq understands, appending to the provided tmp buffer and reallocating if needed. The function will then return the resulting buffer.
(t timetz.TimeTZ, tmp []byte)
| 321 | // provided tmp buffer and reallocating if needed. The function will then return |
| 322 | // the resulting buffer. |
| 323 | func PGWireFormatTimeTZ(t timetz.TimeTZ, tmp []byte) []byte { |
| 324 | format := PGTimeTZFormat |
| 325 | if t.OffsetSecs%60 != 0 { |
| 326 | format += ":00:00" |
| 327 | } else if t.OffsetSecs%3600 != 0 { |
| 328 | format += ":00" |
| 329 | } |
| 330 | ret := t.ToTime().AppendFormat(tmp, format) |
| 331 | // time.Time's AppendFormat does not recognize 2400, so special case it accordingly. |
| 332 | if t.TimeOfDay == timeofday.Time2400 { |
| 333 | // It instead reads 00:00:00. Replace that text. |
| 334 | var newRet []byte |
| 335 | newRet = append(newRet, PGTime2400Format...) |
| 336 | newRet = append(newRet, ret[len(PGTime2400Format):]...) |
| 337 | ret = newRet |
| 338 | } |
| 339 | return ret |
| 340 | } |
| 341 | |
| 342 | // PGWireFormatTimestamp formats t into a format lib/pq understands. |
| 343 | // If offset is not nil, it will not display the timezone offset. |
no test coverage detected
searching dependent graphs…