Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 4241 | |
| 4242 | // Format implements the NodeFormatter interface. |
| 4243 | func (d *DJSON) Format(ctx *FmtCtx) { |
| 4244 | // TODO(justin): ideally the JSON string encoder should know it needs to |
| 4245 | // escape things to be inside SQL strings in order to avoid this allocation. |
| 4246 | s := d.JSON.String() |
| 4247 | if ctx.HasFlags(fmtRawStrings) || ctx.HasFlags(fmtPgwireFormat) { |
| 4248 | ctx.WriteString(s) |
| 4249 | } else { |
| 4250 | // TODO(knz): This seems incorrect, |
| 4251 | // see https://github.com/cockroachdb/cockroachdb-parser/issues/60673 |
| 4252 | lexbase.EncodeSQLStringWithFlags(&ctx.Buffer, s, ctx.flags.EncodeFlags()) |
| 4253 | } |
| 4254 | } |
| 4255 | |
| 4256 | // Size implements the Datum interface. |
| 4257 | // TODO(justin): is this a frequently-called method? Should we be caching the computed size? |
nothing calls this directly
no test coverage detected