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

Method Format

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

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

661
662// Format implements the NodeFormatter interface.
663func (d *DBytes) Format(ctx *FmtCtx) {
664 f := ctx.flags
665 if f.HasFlags(fmtPgwireFormat) {
666 ctx.WriteString(`"\\x`)
667 writeAsHexString(ctx, d)
668 ctx.WriteString(`"`)
669 } else {
670 withQuotes := !f.HasFlags(FmtFlags(lex.EncBareStrings))
671 if withQuotes {
672 if f.HasFlags(fmtFormatByteLiterals) {
673 ctx.WriteByte('b')
674 }
675 ctx.WriteByte('\'')
676 }
677 ctx.WriteString("\\x")
678 writeAsHexString(ctx, d)
679 if withQuotes {
680 ctx.WriteByte('\'')
681 }
682 }
683}
684
685// Size implements the Datum interface.
686func (d *DBytes) Size() uintptr {

Callers

nothing calls this directly

Calls 4

writeAsHexStringFunction · 0.85
FmtFlagsTypeAlias · 0.85
WriteStringMethod · 0.80
HasFlagsMethod · 0.45

Tested by

no test coverage detected