MCPcopy Create free account
hub / github.com/cel-expr/cel-go / AddVariableDecls

Method AddVariableDecls

common/env/env.go:118–129  ·  view source on GitHub ↗

AddVariableDecls adds one or more variables to the config, converting them to serializable values first. VariableDecl inputs are expected to be well-formed.

(vars ...*decls.VariableDecl)

Source from the content-addressed store, hash-verified

116//
117// VariableDecl inputs are expected to be well-formed.
118func (c *Config) AddVariableDecls(vars ...*decls.VariableDecl) *Config {
119 convVars := make([]*Variable, len(vars))
120 for i, v := range vars {
121 if v == nil {
122 continue
123 }
124 cv := NewVariable(v.Name(), SerializeTypeDesc(v.Type()))
125 cv.Description = v.Description()
126 convVars[i] = cv
127 }
128 return c.AddVariables(convVars...)
129}
130
131// AddVariables adds one or more variables to the config.
132func (c *Config) AddVariables(vars ...*Variable) *Config {

Callers 2

ToConfigMethod · 0.95

Calls 6

AddVariablesMethod · 0.95
SerializeTypeDescFunction · 0.85
NewVariableFunction · 0.70
NameMethod · 0.65
TypeMethod · 0.65
DescriptionMethod · 0.65

Tested by 1