[−][src]Struct postgres_parser::nodes::CaseExpr
CaseExpr a CASE expression
We support two distinct forms of CASE expression: CASE WHEN boolexpr THEN expr [ WHEN boolexpr THEN expr ... ] CASE testexpr WHEN compexpr THEN expr [ WHEN compexpr THEN expr ... ] These are distinguishable by the "arg" field being NULL in the first case and the testexpr in the second case.
In the raw grammar output for the second form, the condition expressions of the WHEN clauses are just the comparison values. Parse analysis converts these to valid boolean expressions of the form CaseTestExpr '=' compexpr where the CaseTestExpr node is a placeholder that emits the correct value at runtime. This structure is used so that the testexpr need be evaluated only once. Note that after parse analysis, the condition expressions always yield boolean.
Note: we can test whether a CaseExpr has been through parse analysis yet by checking whether casetype is InvalidOid or not.
Fields
casetype: Oid
casecollid: Oid
arg: Option<Box<Expr>>
args: Option<Vec<Node>>
defresult: Option<Box<Expr>>
location: i32
Trait Implementations
impl Debug for CaseExpr
[src]
impl<'de> Deserialize<'de> for CaseExpr
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for CaseExpr
[src]
impl PartialEq<CaseExpr> for CaseExpr
[src]
impl Serialize for CaseExpr
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for CaseExpr
[src]
impl StructuralPartialEq for CaseExpr
[src]
Auto Trait Implementations
impl RefUnwindSafe for CaseExpr
impl Send for CaseExpr
impl Sync for CaseExpr
impl Unpin for CaseExpr
impl UnwindSafe for CaseExpr
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,