datafusion_doc/
udf.rs

1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18// Scalar UDF doc sections for use in public documentation
19pub mod scalar_doc_sections {
20    use crate::DocSection;
21
22    pub fn doc_sections() -> Vec<DocSection> {
23        vec![
24            DOC_SECTION_MATH,
25            DOC_SECTION_CONDITIONAL,
26            DOC_SECTION_STRING,
27            DOC_SECTION_BINARY_STRING,
28            DOC_SECTION_REGEX,
29            DOC_SECTION_DATETIME,
30            DOC_SECTION_ARRAY,
31            DOC_SECTION_STRUCT,
32            DOC_SECTION_MAP,
33            DOC_SECTION_HASHING,
34            DOC_SECTION_UNION,
35            DOC_SECTION_OTHER,
36        ]
37    }
38
39    pub const fn doc_sections_const() -> &'static [DocSection] {
40        &[
41            DOC_SECTION_MATH,
42            DOC_SECTION_CONDITIONAL,
43            DOC_SECTION_STRING,
44            DOC_SECTION_BINARY_STRING,
45            DOC_SECTION_REGEX,
46            DOC_SECTION_DATETIME,
47            DOC_SECTION_ARRAY,
48            DOC_SECTION_STRUCT,
49            DOC_SECTION_MAP,
50            DOC_SECTION_HASHING,
51            DOC_SECTION_UNION,
52            DOC_SECTION_OTHER,
53        ]
54    }
55
56    pub const DOC_SECTION_MATH: DocSection = DocSection {
57        include: true,
58        label: "Math Functions",
59        description: None,
60    };
61
62    pub const DOC_SECTION_CONDITIONAL: DocSection = DocSection {
63        include: true,
64        label: "Conditional Functions",
65        description: None,
66    };
67
68    pub const DOC_SECTION_STRING: DocSection = DocSection {
69        include: true,
70        label: "String Functions",
71        description: None,
72    };
73
74    pub const DOC_SECTION_BINARY_STRING: DocSection = DocSection {
75        include: true,
76        label: "Binary String Functions",
77        description: None,
78    };
79
80    pub const DOC_SECTION_REGEX: DocSection = DocSection {
81        include: true,
82        label: "Regular Expression Functions",
83        description: Some(
84            r#"Apache DataFusion uses a [PCRE-like](https://en.wikibooks.org/wiki/Regular_Expressions/Perl-Compatible_Regular_Expressions)
85regular expression [syntax](https://docs.rs/regex/latest/regex/#syntax)
86(minus support for several features including look-around and backreferences).
87The following regular expression functions are supported:"#,
88        ),
89    };
90
91    pub const DOC_SECTION_DATETIME: DocSection = DocSection {
92        include: true,
93        label: "Time and Date Functions",
94        description: None,
95    };
96
97    pub const DOC_SECTION_ARRAY: DocSection = DocSection {
98        include: true,
99        label: "Array Functions",
100        description: None,
101    };
102
103    pub const DOC_SECTION_STRUCT: DocSection = DocSection {
104        include: true,
105        label: "Struct Functions",
106        description: None,
107    };
108
109    pub const DOC_SECTION_MAP: DocSection = DocSection {
110        include: true,
111        label: "Map Functions",
112        description: None,
113    };
114
115    pub const DOC_SECTION_HASHING: DocSection = DocSection {
116        include: true,
117        label: "Hashing Functions",
118        description: None,
119    };
120
121    pub const DOC_SECTION_OTHER: DocSection = DocSection {
122        include: true,
123        label: "Other Functions",
124        description: None,
125    };
126
127    pub const DOC_SECTION_UNION: DocSection = DocSection {
128        include: true,
129        label: "Union Functions",
130        description: Some("Functions to work with the union data type, also know as tagged unions, variant types, enums or sum types. Note: Not related to the SQL UNION operator"),
131    };
132}