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

Method ListVariables

server/plpgsql/interpreter_stack.go:158–172  ·  view source on GitHub ↗

ListVariables returns a map with the names of all variables. The attached slice represents field names for records. All names are lowercased.

()

Source from the content-addressed store, hash-verified

156// ListVariables returns a map with the names of all variables. The attached slice represents field names for records.
157// All names are lowercased.
158func (is *InterpreterStack) ListVariables() map[string][]string {
159 seen := make(map[string][]string)
160 for i := 0; i < is.stack.Len(); i++ {
161 for varName, iv := range is.stack.PeekDepth(i).variables {
162 var fieldNames []string
163 if len(iv.Record) > 0 {
164 for _, col := range iv.Record {
165 fieldNames = append(fieldNames, strings.ToLower(col.Name))
166 }
167 }
168 seen[strings.ToLower(varName)] = fieldNames
169 }
170 }
171 return seen
172}
173
174// NewRecord creates a new record in the current scope. If a record with the same name exists in a previous scope, then
175// that record will be shadowed until the current scope exits.

Callers 1

Calls 2

PeekDepthMethod · 0.80
LenMethod · 0.65

Tested by

no test coverage detected