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

Method Format

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

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

385
386// Format implements the NodeFormatter interface.
387func (d *DInt) Format(ctx *FmtCtx) {
388 // If the number is negative, we need to use parens or the `:::INT` type hint
389 // will take precedence over the negation sign.
390 disambiguate := ctx.flags.HasFlags(fmtDisambiguateDatumTypes)
391 parsable := ctx.flags.HasFlags(FmtParsableNumerics)
392 needParens := (disambiguate || parsable) && *d < 0
393 if needParens {
394 ctx.WriteByte('(')
395 }
396 ctx.WriteString(strconv.FormatInt(int64(*d), 10))
397 if needParens {
398 ctx.WriteByte(')')
399 }
400}
401
402// Size implements the Datum interface.
403func (d *DInt) Size() uintptr {

Callers

nothing calls this directly

Calls 2

WriteStringMethod · 0.80
HasFlagsMethod · 0.45

Tested by

no test coverage detected