pub enum JsonAgg {
ArrayAgg {
column: String,
distinct: bool,
order_by: Option<String>,
},
ObjectAgg {
key_column: String,
value_column: String,
},
BuildObject {
pairs: Vec<(String, String)>,
},
BuildArray {
elements: Vec<String>,
},
}Expand description
JSON aggregation operations.
Variants§
ArrayAgg
Aggregate rows into a JSON array.
ObjectAgg
Aggregate rows into a JSON object.
BuildObject
Build a JSON object from key-value pairs.
BuildArray
Build a JSON array from expressions.
Implementations§
Source§impl JsonAgg
impl JsonAgg
Sourcepub fn object_agg(key: impl Into<String>, value: impl Into<String>) -> Self
pub fn object_agg(key: impl Into<String>, value: impl Into<String>) -> Self
Create an object aggregation.
Sourcepub fn to_postgres_sql(&self) -> String
pub fn to_postgres_sql(&self) -> String
Generate PostgreSQL SQL.
Sourcepub fn to_mysql_sql(&self) -> String
pub fn to_mysql_sql(&self) -> String
Generate MySQL SQL.
Sourcepub fn to_sql(&self, db_type: DatabaseType) -> String
pub fn to_sql(&self, db_type: DatabaseType) -> String
Generate SQL for the specified database.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JsonAgg
impl<'de> Deserialize<'de> for JsonAgg
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for JsonAgg
impl StructuralPartialEq for JsonAgg
Auto Trait Implementations§
impl Freeze for JsonAgg
impl RefUnwindSafe for JsonAgg
impl Send for JsonAgg
impl Sync for JsonAgg
impl Unpin for JsonAgg
impl UnwindSafe for JsonAgg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more