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

Method Format

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

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

711
712// Format implements the NodeFormatter interface.
713func (d *DInt) Format(ctx *FmtCtx) {
714 // If the number is negative, we need to use parens or the `:::INT` type hint
715 // will take precedence over the negation sign.
716 disambiguate := ctx.flags.HasFlags(fmtDisambiguateDatumTypes)
717 parsable := ctx.flags.HasFlags(FmtParsableNumerics)
718 needParens := (disambiguate || parsable) && *d < 0
719 if needParens {
720 ctx.WriteByte('(')
721 }
722 ctx.WriteString(strconv.FormatInt(int64(*d), 10))
723 if needParens {
724 ctx.WriteByte(')')
725 }
726}
727
728// Size implements the Datum interface.
729func (d *DInt) Size() uintptr {

Callers

nothing calls this directly

Calls 1

HasFlagsMethod · 0.45

Tested by

no test coverage detected