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

Function NewPlaceholder

pkg/sql/sem/tree/expr.go:787–801  ·  view source on GitHub ↗

NewPlaceholder allocates a Placeholder.

(name string)

Source from the content-addressed store, hash-verified

785
786// NewPlaceholder allocates a Placeholder.
787func NewPlaceholder(name string) (*Placeholder, error) {
788 uval, err := strconv.ParseUint(name, 10, 64)
789 if err != nil {
790 return nil, err
791 }
792 // The string is the number that follows $ which is a 1-based index ($1, $2,
793 // etc), while PlaceholderIdx is 0-based.
794 if uval == 0 || uval > MaxPlaceholderIdx+1 {
795 return nil, pgerror.Newf(
796 pgcode.NumericValueOutOfRange,
797 "placeholder index must be between 1 and %d", MaxPlaceholderIdx+1,
798 )
799 }
800 return &Placeholder{Idx: PlaceholderIdx(uval - 1)}, nil
801}
802
803// Format implements the NodeFormatter interface.
804func (node *Placeholder) Format(ctx *FmtCtx) {

Callers 1

scanPlaceholderMethod · 0.92

Calls 2

NewfFunction · 0.92
PlaceholderIdxTypeAlias · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…