compileNonOperatorFunction creates a CompiledFunction for each overload of the given function.
(funcName string, overloads []FunctionInterface)
| 172 | |
| 173 | // compileNonOperatorFunction creates a CompiledFunction for each overload of the given function. |
| 174 | func compileNonOperatorFunction(funcName string, overloads []FunctionInterface) { |
| 175 | overloadTree := NewOverloads() |
| 176 | for _, functionOverload := range overloads { |
| 177 | if err := overloadTree.Add(functionOverload); err != nil { |
| 178 | panic(err) |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | // Store the compiled function into the engine's built-in functions |
| 183 | // TODO: don't do this, use an actual contract for communicating these functions to the engine catalog |
| 184 | createFunc := func(ctx *sql.Context, params ...sql.Expression) (sql.Expression, error) { |
| 185 | return NewCompiledFunction(ctx, funcName, params, overloadTree, false), nil |
| 186 | } |
| 187 | function.BuiltIns = append(function.BuiltIns, sql.FunctionN{ |
| 188 | Name: funcName, |
| 189 | Fn: createFunc, |
| 190 | }) |
| 191 | compiledCatalog[funcName] = createFunc |
| 192 | } |
| 193 | |
| 194 | // compileNonOperatorFunction creates a CompiledFunction for each overload of the given function. |
| 195 | func compileAggFunction(funcName string, overloads []AggregateFunctionInterface) { |
no test coverage detected