pub struct CaseGenerator {
pub column: String,
pub style: CaseStyle,
pub conditions: Vec<CaseCondition>,
pub else_clause: Option<String>,
pub alias: Option<String>,
}
Fields§
§column: String
§style: CaseStyle
§conditions: Vec<CaseCondition>
§else_clause: Option<String>
§alias: Option<String>
Implementations§
Source§impl CaseGenerator
impl CaseGenerator
Sourcepub fn from_ranges(
column: &str,
ranges: &str,
labels: Option<Vec<String>>,
) -> Result<Self>
pub fn from_ranges( column: &str, ranges: &str, labels: Option<Vec<String>>, ) -> Result<Self>
Create a generator from range specifications
Sourcepub fn from_values(column: &str, value_mappings: Vec<(String, String)>) -> Self
pub fn from_values(column: &str, value_mappings: Vec<(String, String)>) -> Self
Create a generator from specific values
Sourcepub fn to_sql_formatted(&self, indent: usize) -> String
pub fn to_sql_formatted(&self, indent: usize) -> String
Generate a pretty-printed version with indentation
Trait Implementations§
Source§impl Debug for CaseGenerator
impl Debug for CaseGenerator
Source§impl<'de> Deserialize<'de> for CaseGenerator
impl<'de> Deserialize<'de> for CaseGenerator
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
Auto Trait Implementations§
impl Freeze for CaseGenerator
impl RefUnwindSafe for CaseGenerator
impl Send for CaseGenerator
impl Sync for CaseGenerator
impl Unpin for CaseGenerator
impl UnwindSafe for CaseGenerator
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more