common_function/
system.rs

1// Copyright 2023 Greptime Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15mod build;
16mod database;
17mod pg_catalog;
18mod procedure_state;
19mod timezone;
20mod version;
21
22use build::BuildFunction;
23use database::{
24    ConnectionIdFunction, CurrentSchemaFunction, DatabaseFunction, PgBackendPidFunction,
25    ReadPreferenceFunction, SessionUserFunction,
26};
27use pg_catalog::PGCatalogFunction;
28use procedure_state::ProcedureStateFunction;
29use timezone::TimezoneFunction;
30use version::VersionFunction;
31
32use crate::function_registry::FunctionRegistry;
33
34pub(crate) struct SystemFunction;
35
36impl SystemFunction {
37    pub fn register(registry: &FunctionRegistry) {
38        registry.register_scalar(BuildFunction);
39        registry.register_scalar(VersionFunction);
40        registry.register_scalar(CurrentSchemaFunction);
41        registry.register_scalar(DatabaseFunction);
42        registry.register_scalar(SessionUserFunction);
43        registry.register_scalar(ReadPreferenceFunction);
44        registry.register_scalar(PgBackendPidFunction);
45        registry.register_scalar(ConnectionIdFunction);
46        registry.register_scalar(TimezoneFunction);
47        registry.register(ProcedureStateFunction::factory());
48        PGCatalogFunction::register(registry);
49    }
50}