[][src]Struct postgres_parser::nodes::CaseExpr

pub struct CaseExpr {
    pub casetype: Oid,
    pub casecollid: Oid,
    pub arg: Option<Box<Expr>>,
    pub args: Option<Vec<Node>>,
    pub defresult: Option<Box<Expr>>,
    pub location: i32,
}

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: Oidcasecollid: Oidarg: 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]

impl Eq for CaseExpr[src]

impl PartialEq<CaseExpr> for CaseExpr[src]

impl Serialize for CaseExpr[src]

impl StructuralEq for CaseExpr[src]

impl StructuralPartialEq for CaseExpr[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.