sea_query/extension/postgres/
mod.rs

1pub use expr::*;
2pub use extension::*;
3pub use func::*;
4pub use ltree::*;
5pub use select::*;
6pub use types::*;
7
8use crate::types::BinOper;
9
10pub(crate) mod expr;
11pub(crate) mod extension;
12pub(crate) mod func;
13pub(crate) mod interval;
14pub(crate) mod ltree;
15pub(crate) mod select;
16pub(crate) mod types;
17
18/// Postgres-specific binary operators.
19///
20/// For all supported operators (including the standard ones), see [`BinOper`].
21#[derive(Debug, Clone, Copy, PartialEq, Eq)]
22#[non_exhaustive]
23pub enum PgBinOper {
24    ILike,
25    NotILike,
26    /// `@@`. Full-text search match
27    Matches,
28    /// `@>`. Contains operator - checks if left operand contains right operand (arrays, JSON)
29    Contains,
30    /// `<@`. Contained operator - checks if left operand is contained by right operand (arrays, JSON)
31    Contained,
32    /// `||`. String/Array concatenation operator
33    Concatenate,
34    /// `&&`. Overlap operator - checks if arrays have any elements in common
35    Overlap,
36    /// `%`. Text similarity operator,
37    /// requires `pg_trgm` extension
38    Similarity,
39    /// `<%`. Word similarity operator,
40    /// requires `pg_trgm` extension
41    WordSimilarity,
42    /// `<<%`. Strict word similarity operator,
43    /// requires `pg_trgm` extension
44    StrictWordSimilarity,
45    /// `<->`. Similarity distance operator,
46    /// requires `pg_trgm` extension
47    SimilarityDistance,
48    /// `<<->`. Word similarity distance operator,
49    /// requires `pg_trgm` extension
50    WordSimilarityDistance,
51    /// `<<<->`. Strict word similarity distance operator,
52    /// requires `pg_trgm` extension
53    StrictWordSimilarityDistance,
54    /// `->`. Retrieves JSON field as JSON value
55    GetJsonField,
56    /// `->>`. Retrieves JSON field and casts it to text
57    CastJsonField,
58    /// `~`. Regex operator, case sensitively
59    Regex,
60    /// `~*`. Regex operator, case-insensitively
61    RegexCaseInsensitive,
62    #[cfg(feature = "postgres-vector")]
63    /// `<->`. L2 (Euclidean) distance operator
64    EuclideanDistance,
65    #[cfg(feature = "postgres-vector")]
66    /// `<#>`. Negative inner product operator
67    NegativeInnerProduct,
68    #[cfg(feature = "postgres-vector")]
69    /// `<=>`. Cosine distance operator
70    CosineDistance,
71}
72
73impl From<PgBinOper> for BinOper {
74    fn from(o: PgBinOper) -> Self {
75        Self::PgOperator(o)
76    }
77}