SetVariable sets the first variable found, with a matching name, to the value given. This does not ensure that the value matches the expectations of the type, so it should be validated before this is called. Returns an error if the variable cannot be found.
(ctx *sql.Context, name string, val any)
| 229 | // value matches the expectations of the type, so it should be validated before this is called. Returns an error if the |
| 230 | // variable cannot be found. |
| 231 | func (is *InterpreterStack) SetVariable(ctx *sql.Context, name string, val any) error { |
| 232 | iv := is.GetVariable(name) |
| 233 | if iv.Type == nil { |
| 234 | return fmt.Errorf("variable `%s` could not be found", name) |
| 235 | } |
| 236 | *iv.Value = val |
| 237 | return nil |
| 238 | } |
| 239 | |
| 240 | // SetLabel sets the label for the current scope. |
| 241 | func (is *InterpreterStack) SetLabel(label string) { |
no test coverage detected