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

Function validateRoutineOptions

server/ast/create_function.go:258–268  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
258func 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}

Callers 4

nodeAlterFunctionFunction · 0.85
nodeCreateFunctionFunction · 0.85
nodeCreateProcedureFunction · 0.85
nodeAlterProcedureFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected