@@ -1125,13 +1125,7 @@ pub enum Expr {
11251125 /// [DuckDb](https://duckdb.org/docs/sql/functions/lambda.html)
11261126 Lambda ( LambdaFunction ) ,
11271127 /// Checks membership of a value in a JSON array
1128- ///
1129- /// Syntax:
1130- /// ```sql
1131- /// <value> MEMBER OF(<array>)
1132- /// ```
1133- /// [MySQL](https://dev.mysql.com/doc/refman/8.4/en/json-search-functions.html#operator_member-of)
1134- MemberOf ( Box < Expr > , Box < Expr > ) ,
1128+ MemberOf ( MemberOf ) ,
11351129}
11361130
11371131impl Expr {
@@ -1920,7 +1914,7 @@ impl fmt::Display for Expr {
19201914 }
19211915 Expr :: Prior ( expr) => write ! ( f, "PRIOR {expr}" ) ,
19221916 Expr :: Lambda ( lambda) => write ! ( f, "{lambda}" ) ,
1923- Expr :: MemberOf ( value , array ) => write ! ( f, "{value} MEMBER OF({array}) " ) ,
1917+ Expr :: MemberOf ( member_of ) => write ! ( f, "{member_of} " ) ,
19241918 }
19251919 }
19261920}
@@ -9840,6 +9834,27 @@ impl fmt::Display for NullInclusion {
98409834 }
98419835}
98429836
9837+ /// Checks membership of a value in a JSON array
9838+ ///
9839+ /// Syntax:
9840+ /// ```sql
9841+ /// <value> MEMBER OF(<array>)
9842+ /// ```
9843+ /// [MySQL](https://dev.mysql.com/doc/refman/8.4/en/json-search-functions.html#operator_member-of)
9844+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
9845+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
9846+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
9847+ pub struct MemberOf {
9848+ pub value : Box < Expr > ,
9849+ pub array : Box < Expr > ,
9850+ }
9851+
9852+ impl fmt:: Display for MemberOf {
9853+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
9854+ write ! ( f, "{} MEMBER OF({})" , self . value, self . array)
9855+ }
9856+ }
9857+
98439858#[ cfg( test) ]
98449859mod tests {
98459860 use crate :: tokenizer:: Location ;
0 commit comments