MCPcopy Index your code
hub / github.com/coder/coder / CombineVariableValues

Function CombineVariableValues

codersdk/templatevariables.go:254–272  ·  view source on GitHub ↗
(valuesSets ...[]VariableValue)

Source from the content-addressed store, hash-verified

252}
253
254func CombineVariableValues(valuesSets ...[]VariableValue) []VariableValue {
255 combinedValues := make(map[string]string)
256
257 for _, values := range valuesSets {
258 for _, v := range values {
259 combinedValues[v.Name] = v.Value
260 }
261 }
262
263 var result []VariableValue
264 for name, value := range combinedValues {
265 result = append(result, VariableValue{Name: name, Value: value})
266 }
267
268 sort.Slice(result, func(i, j int) bool {
269 return result[i].Name < result[j].Name
270 })
271 return result
272}

Callers 2

ParseUserVariableValuesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected