MCPcopy Create free account
hub / github.com/dolthub/doltgresql / Format

Method Format

postgres/parser/sem/tree/datum.go:1423–1432  ·  view source on GitHub ↗

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

1421
1422// Format implements the NodeFormatter interface.
1423func (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?

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected