@@ -1124,6 +1124,8 @@ pub enum Expr {
11241124 /// [Databricks](https://docs.databricks.com/en/sql/language-manual/sql-ref-lambda-functions.html)
11251125 /// [DuckDb](https://duckdb.org/docs/sql/functions/lambda.html)
11261126 Lambda ( LambdaFunction ) ,
1127+ /// Checks membership of a value in a JSON array
1128+ MemberOf ( MemberOf ) ,
11271129}
11281130
11291131impl Expr {
@@ -1912,6 +1914,7 @@ impl fmt::Display for Expr {
19121914 }
19131915 Expr :: Prior ( expr) => write ! ( f, "PRIOR {expr}" ) ,
19141916 Expr :: Lambda ( lambda) => write ! ( f, "{lambda}" ) ,
1917+ Expr :: MemberOf ( member_of) => write ! ( f, "{member_of}" ) ,
19151918 }
19161919 }
19171920}
@@ -9831,6 +9834,27 @@ impl fmt::Display for NullInclusion {
98319834 }
98329835}
98339836
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+
98349858#[ cfg( test) ]
98359859mod tests {
98369860 use crate :: tokenizer:: Location ;
0 commit comments