validateRoutineOptions ensures that each option is defined only once. Returns a map containing all options, or an error if an option is invalid or is defined multiple times.
(ctx *Context, options []tree.RoutineOption)
| 256 | // validateRoutineOptions ensures that each option is defined only once. Returns a map containing all options, or an |
| 257 | // error if an option is invalid or is defined multiple times. |
| 258 | func validateRoutineOptions(ctx *Context, options []tree.RoutineOption) (map[tree.FunctionOption]tree.RoutineOption, error) { |
| 259 | var optDefined = make(map[tree.FunctionOption]tree.RoutineOption) |
| 260 | for _, opt := range options { |
| 261 | if _, ok := optDefined[opt.OptionType]; ok { |
| 262 | return nil, errors.Errorf("ERROR: conflicting or redundant options") |
| 263 | } else { |
| 264 | optDefined[opt.OptionType] = opt |
| 265 | } |
| 266 | } |
| 267 | return optDefined, nil |
| 268 | } |
no test coverage detected