@@ -5632,6 +5632,161 @@ impl Spanned for AlterFunction {
56325632 }
56335633}
56345634
5635+ /// Text search object kind.
5636+ ///
5637+ /// See [PostgreSQL](https://www.postgresql.org/docs/current/textsearch-intro.html).
5638+ #[ derive( Debug , Clone , Copy , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
5639+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
5640+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
5641+ pub enum TextSearchObjectType {
5642+ /// `DICTIONARY`
5643+ Dictionary ,
5644+ /// `CONFIGURATION`
5645+ Configuration ,
5646+ /// `TEMPLATE`
5647+ Template ,
5648+ /// `PARSER`
5649+ Parser ,
5650+ }
5651+
5652+ impl fmt:: Display for TextSearchObjectType {
5653+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
5654+ match self {
5655+ TextSearchObjectType :: Dictionary => write ! ( f, "DICTIONARY" ) ,
5656+ TextSearchObjectType :: Configuration => write ! ( f, "CONFIGURATION" ) ,
5657+ TextSearchObjectType :: Template => write ! ( f, "TEMPLATE" ) ,
5658+ TextSearchObjectType :: Parser => write ! ( f, "PARSER" ) ,
5659+ }
5660+ }
5661+ }
5662+
5663+ /// `CREATE TEXT SEARCH ...` statement.
5664+ ///
5665+ /// See [PostgreSQL](https://www.postgresql.org/docs/current/sql-createtsdictionary.html).
5666+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
5667+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
5668+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
5669+ pub struct CreateTextSearch {
5670+ /// The specific text search object type.
5671+ pub object_type : TextSearchObjectType ,
5672+ /// Object name.
5673+ pub name : ObjectName ,
5674+ /// Parenthesized options.
5675+ pub options : Vec < SqlOption > ,
5676+ }
5677+
5678+ impl fmt:: Display for CreateTextSearch {
5679+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
5680+ write ! (
5681+ f,
5682+ "CREATE TEXT SEARCH {} {} ({})" ,
5683+ self . object_type,
5684+ self . name,
5685+ display_comma_separated( & self . options)
5686+ )
5687+ }
5688+ }
5689+
5690+ impl Spanned for CreateTextSearch {
5691+ fn span ( & self ) -> Span {
5692+ Span :: empty ( )
5693+ }
5694+ }
5695+
5696+ /// Option assignment used by `ALTER TEXT SEARCH ... ( ... )`.
5697+ ///
5698+ /// See [PostgreSQL](https://www.postgresql.org/docs/current/sql-altertsdictionary.html).
5699+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
5700+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
5701+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
5702+ pub struct AlterTextSearchOption {
5703+ /// Option name.
5704+ pub key : Ident ,
5705+ /// Optional value (`option [= value]`).
5706+ pub value : Option < Expr > ,
5707+ }
5708+
5709+ impl fmt:: Display for AlterTextSearchOption {
5710+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
5711+ match & self . value {
5712+ Some ( value) => write ! ( f, "{} = {}" , self . key, value) ,
5713+ None => write ! ( f, "{}" , self . key) ,
5714+ }
5715+ }
5716+ }
5717+
5718+ /// Operation for `ALTER TEXT SEARCH ...`.
5719+ ///
5720+ /// See [PostgreSQL](https://www.postgresql.org/docs/current/sql-altertsdictionary.html).
5721+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
5722+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
5723+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
5724+ pub enum AlterTextSearchOperation {
5725+ /// `RENAME TO new_name`
5726+ RenameTo {
5727+ /// New name.
5728+ new_name : Ident ,
5729+ } ,
5730+ /// `OWNER TO ...`
5731+ OwnerTo ( Owner ) ,
5732+ /// `SET SCHEMA schema_name`
5733+ SetSchema {
5734+ /// Target schema.
5735+ schema_name : ObjectName ,
5736+ } ,
5737+ /// `( option [= value] [, ...] )`
5738+ SetOptions {
5739+ /// Text search options to apply.
5740+ options : Vec < AlterTextSearchOption > ,
5741+ } ,
5742+ }
5743+
5744+ impl fmt:: Display for AlterTextSearchOperation {
5745+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
5746+ match self {
5747+ AlterTextSearchOperation :: RenameTo { new_name } => write ! ( f, "RENAME TO {new_name}" ) ,
5748+ AlterTextSearchOperation :: OwnerTo ( owner) => write ! ( f, "OWNER TO {owner}" ) ,
5749+ AlterTextSearchOperation :: SetSchema { schema_name } => {
5750+ write ! ( f, "SET SCHEMA {schema_name}" )
5751+ }
5752+ AlterTextSearchOperation :: SetOptions { options } => {
5753+ write ! ( f, "({})" , display_comma_separated( options) )
5754+ }
5755+ }
5756+ }
5757+ }
5758+
5759+ /// `ALTER TEXT SEARCH ...` statement.
5760+ ///
5761+ /// See [PostgreSQL](https://www.postgresql.org/docs/current/sql-altertsdictionary.html).
5762+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
5763+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
5764+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
5765+ pub struct AlterTextSearch {
5766+ /// The specific text search object type.
5767+ pub object_type : TextSearchObjectType ,
5768+ /// Object name.
5769+ pub name : ObjectName ,
5770+ /// Operation to apply.
5771+ pub operation : AlterTextSearchOperation ,
5772+ }
5773+
5774+ impl fmt:: Display for AlterTextSearch {
5775+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
5776+ write ! (
5777+ f,
5778+ "ALTER TEXT SEARCH {} {} {}" ,
5779+ self . object_type, self . name, self . operation
5780+ )
5781+ }
5782+ }
5783+
5784+ impl Spanned for AlterTextSearch {
5785+ fn span ( & self ) -> Span {
5786+ Span :: empty ( )
5787+ }
5788+ }
5789+
56355790/// CREATE POLICY statement.
56365791///
56375792/// See [PostgreSQL](https://www.postgresql.org/docs/current/sql-createpolicy.html)
0 commit comments