Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 3054 | |
| 3055 | // Format implements the NodeFormatter interface. |
| 3056 | func (d *DTimestampTZ) Format(ctx *FmtCtx) { |
| 3057 | f := ctx.flags |
| 3058 | bareStrings := f.HasFlags(FmtFlags(lexbase.EncBareStrings)) |
| 3059 | if !bareStrings { |
| 3060 | ctx.WriteByte('\'') |
| 3061 | } |
| 3062 | // By default, rely on the ctx location. |
| 3063 | loc := ctx.location |
| 3064 | // We sometimes set location correctly in DTimestampTZ. |
| 3065 | if loc == nil { |
| 3066 | loc = d.Location() |
| 3067 | } |
| 3068 | if f.HasFlags(fmtPgwireFormat) { |
| 3069 | // This assertion should be in place everywhere, but that's a |
| 3070 | // huge change for a different day. |
| 3071 | if loc == nil { |
| 3072 | panic(errors.AssertionFailedf("location on ctx for fmtPgwireFormat must be set for TimestampTZ types")) |
| 3073 | } |
| 3074 | } |
| 3075 | ctx.Write(PGWireFormatTimestamp(d.Time, loc, ctx.scratch[:0])) |
| 3076 | if !bareStrings { |
| 3077 | ctx.WriteByte('\'') |
| 3078 | } |
| 3079 | } |
| 3080 | |
| 3081 | // Size implements the Datum interface. |
| 3082 | func (d *DTimestampTZ) Size() uintptr { |
nothing calls this directly
no test coverage detected