Skip to main content

sql_builder/extension/postgres/
func.rs

1//! For calling built-in Postgres SQL functions.
2
3use crate::{PgDateTruncUnit, expr::*, func::*};
4
5mod aggregate;
6mod search;
7
8/// Known Postgres-specific functions.
9///
10/// For all supported functions (including the standard ones), see [`Func`].
11///
12/// If something is not supported, you can use [`Func::Custom`].
13#[derive(Debug, Clone, PartialEq)]
14pub enum PgFunc {
15    ToTsquery,
16    ToTsvector,
17    PhrasetoTsquery,
18    PlaintoTsquery,
19    WebsearchToTsquery,
20    TsRank,
21    TsRankCd,
22    StartsWith,
23    GenRandomUUID,
24    JsonBuildObject,
25    JsonAgg,
26    ArrayAgg,
27    DateTrunc,
28    Any,
29    Some,
30    All,
31    AdvisoryLock,
32    AdvisoryLockShared,
33    TryAdvisoryLock,
34    TryAdvisoryLockShared,
35    AdvisoryUnlock,
36    AdvisoryUnlockShared,
37    AdvisoryUnlockAll,
38    AdvisoryXactLock,
39    AdvisoryXactLockShared,
40    TryAdvisoryXactLock,
41    TryAdvisoryXactLockShared,
42}
43
44impl From<PgFunc> for Func {
45    fn from(func: PgFunc) -> Self {
46        Self::PgFunction(func)
47    }
48}