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 std::sync::Arc;
23
24use build::BuildFunction;
25use database::{
26    CurrentSchemaFunction, DatabaseFunction, ReadPreferenceFunction, SessionUserFunction,
27};
28use pg_catalog::PGCatalogFunction;
29use procedure_state::ProcedureStateFunction;
30use timezone::TimezoneFunction;
31use version::VersionFunction;
32
33use crate::function_registry::FunctionRegistry;
34
35pub(crate) struct SystemFunction;
36
37impl SystemFunction {
38    pub fn register(registry: &FunctionRegistry) {
39        registry.register(Arc::new(BuildFunction));
40        registry.register(Arc::new(VersionFunction));
41        registry.register(Arc::new(CurrentSchemaFunction));
42        registry.register(Arc::new(DatabaseFunction));
43        registry.register(Arc::new(SessionUserFunction));
44        registry.register(Arc::new(ReadPreferenceFunction));
45        registry.register(Arc::new(TimezoneFunction));
46        registry.register_async(Arc::new(ProcedureStateFunction));
47        PGCatalogFunction::register(registry);
48    }
49}