Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 1421 | |
| 1422 | // Format implements the NodeFormatter interface. |
| 1423 | func (d *DJSON) Format(ctx *FmtCtx) { |
| 1424 | // TODO(justin): ideally the JSON string encoder should know it needs to |
| 1425 | // escape things to be inside SQL strings in order to avoid this allocation. |
| 1426 | s := d.JSON.String() |
| 1427 | if ctx.flags.HasFlags(fmtRawStrings) { |
| 1428 | ctx.WriteString(s) |
| 1429 | } else { |
| 1430 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, s, ctx.flags.EncodeFlags()) |
| 1431 | } |
| 1432 | } |
| 1433 | |
| 1434 | // Size implements the Datum interface. |
| 1435 | // TODO(justin): is this a frequently-called method? Should we be caching the computed size? |
nothing calls this directly
no test coverage detected