Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 2858 | |
| 2859 | // Format implements the NodeFormatter interface. |
| 2860 | func (d *DJSON) Format(ctx *FmtCtx) { |
| 2861 | // TODO(justin): ideally the JSON string encoder should know it needs to |
| 2862 | // escape things to be inside SQL strings in order to avoid this allocation. |
| 2863 | s := d.JSON.String() |
| 2864 | if ctx.flags.HasFlags(fmtRawStrings) { |
| 2865 | ctx.WriteString(s) |
| 2866 | } else { |
| 2867 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, s, ctx.flags.EncodeFlags()) |
| 2868 | } |
| 2869 | } |
| 2870 | |
| 2871 | // Size implements the Datum interface. |
| 2872 | // TODO(justin): is this a frequently-called method? Should we be caching the computed size? |
nothing calls this directly
no test coverage detected