| 1 | //===----------------------------------------------------------------------===// |
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/function/built_in_functions.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/function/function.hpp" |
| 12 | #include "duckdb/catalog/catalog_transaction.hpp" |
| 13 | |
| 14 | namespace duckdb { |
| 15 | |
| 16 | class BuiltinFunctions { |
| 17 | public: |
| 18 | BuiltinFunctions(CatalogTransaction transaction, Catalog &catalog); |
| 19 | ~BuiltinFunctions(); |
| 20 | |
| 21 | //! Initialize a catalog with all built-in functions |
| 22 | void Initialize(); |
| 23 | |
| 24 | public: |
| 25 | void AddFunction(AggregateFunctionSet set); |
| 26 | void AddFunction(AggregateFunction function); |
| 27 | void AddFunction(ScalarFunctionSet set); |
| 28 | void AddFunction(PragmaFunction function); |
| 29 | void AddFunction(const string &name, PragmaFunctionSet functions); |
| 30 | void AddFunction(ScalarFunction function); |
| 31 | void AddFunction(const vector<string> &names, ScalarFunction function); |
| 32 | void AddFunction(TableFunctionSet set); |
| 33 | void AddFunction(TableFunction function); |
| 34 | void AddFunction(CopyFunction function); |
| 35 | |
| 36 | void AddCollation(string name, ScalarFunction function, bool combinable = false, |
| 37 | bool not_required_for_equality = false); |
| 38 | |
| 39 | private: |
| 40 | CatalogTransaction transaction; |
| 41 | Catalog &catalog; |
| 42 | |
| 43 | private: |
| 44 | template <class T> |
| 45 | void Register() { |
| 46 | T::RegisterFunction(*this); |
| 47 | } |
| 48 | |
| 49 | // table-producing functions |
| 50 | void RegisterTableScanFunctions(); |
| 51 | void RegisterSQLiteFunctions(); |
| 52 | void RegisterReadFunctions(); |
| 53 | void RegisterTableFunctions(); |
| 54 | void RegisterArrowFunctions(); |
| 55 | |
| 56 | // aggregates |
| 57 | void RegisterDistributiveAggregates(); |
| 58 | |
| 59 | // scalar functions |
| 60 | void RegisterGenericFunctions(); |
| 61 | void RegisterOperators(); |
| 62 | void RegisterStringFunctions(); |
| 63 | void RegisterNestedFunctions(); |
| 64 | void RegisterSequenceFunctions(); |
| 65 | |
| 66 | // pragmas |
| 67 | void RegisterPragmaFunctions(); |
| 68 | }; |
| 69 | |
| 70 | } // namespace duckdb |
| 71 | |