MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / NewParamSet

Function NewParamSet

internal/sql/named/param_set.go:67–85  ·  view source on GitHub ↗

NewParamSet creates a set of parameters with the given list of already used positions

(positionsUsed map[int]bool, hasNamedSupport bool)

Source from the content-addressed store, hash-verified

65
66// NewParamSet creates a set of parameters with the given list of already used positions
67func NewParamSet(positionsUsed map[int]bool, hasNamedSupport bool) *ParamSet {
68 positionToName := make(map[int]string, len(positionsUsed))
69 for index, used := range positionsUsed {
70 if !used {
71 continue
72 }
73
74 // assume the previously used params have no name
75 positionToName[index] = ""
76 }
77
78 return &ParamSet{
79 argn: 1,
80 namedParams: make(map[string]Param),
81 namedLocs: make(map[string][]int),
82 hasNamedSupport: hasNamedSupport,
83 positionToName: positionToName,
84 }
85}

Callers 2

NamedParametersFunction · 0.92
TestParamSet_AddFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParamSet_AddFunction · 0.68