MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / Format

Method Format

pkg/sql/sem/tree/datum.go:2860–2869  ·  view source on GitHub ↗

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

2858
2859// Format implements the NodeFormatter interface.
2860func (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?

Callers

nothing calls this directly

Calls 4

EncodeSQLStringWithFlagsFunction · 0.92
EncodeFlagsMethod · 0.80
StringMethod · 0.65
HasFlagsMethod · 0.45

Tested by

no test coverage detected