common_function/scalars/
json.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
15pub mod json_get;
16mod json_is;
17mod json_path_exists;
18mod json_path_match;
19mod json_to_string;
20mod parse_json;
21
22use json_get::{JsonGetBool, JsonGetFloat, JsonGetInt, JsonGetString};
23use json_is::{
24    JsonIsArray, JsonIsBool, JsonIsFloat, JsonIsInt, JsonIsNull, JsonIsObject, JsonIsString,
25};
26use json_to_string::JsonToStringFunction;
27use parse_json::ParseJsonFunction;
28
29use crate::function_registry::FunctionRegistry;
30
31pub(crate) struct JsonFunction;
32
33impl JsonFunction {
34    pub fn register(registry: &FunctionRegistry) {
35        registry.register_scalar(JsonToStringFunction);
36        registry.register_scalar(ParseJsonFunction);
37
38        registry.register_scalar(JsonGetInt);
39        registry.register_scalar(JsonGetFloat);
40        registry.register_scalar(JsonGetString);
41        registry.register_scalar(JsonGetBool);
42
43        registry.register_scalar(JsonIsNull);
44        registry.register_scalar(JsonIsInt);
45        registry.register_scalar(JsonIsFloat);
46        registry.register_scalar(JsonIsString);
47        registry.register_scalar(JsonIsBool);
48        registry.register_scalar(JsonIsArray);
49        registry.register_scalar(JsonIsObject);
50
51        registry.register_scalar(json_path_exists::JsonPathExistsFunction);
52        registry.register_scalar(json_path_match::JsonPathMatchFunction);
53    }
54}