@@ -372,39 +372,52 @@ pub enum Expr {
372
372
timestamp : Box < Expr > ,
373
373
time_zone : String ,
374
374
} ,
375
+ /// ```sql
375
376
/// EXTRACT(DateTimeField FROM <expr>)
377
+ /// ```
376
378
Extract {
377
379
field : DateTimeField ,
378
380
expr : Box < Expr > ,
379
381
} ,
382
+ /// ```sql
380
383
/// CEIL(<expr> [TO DateTimeField])
384
+ /// ```
381
385
Ceil {
382
386
expr : Box < Expr > ,
383
387
field : DateTimeField ,
384
388
} ,
389
+ /// ```sql
385
390
/// FLOOR(<expr> [TO DateTimeField])
391
+ /// ```
386
392
Floor {
387
393
expr : Box < Expr > ,
388
394
field : DateTimeField ,
389
395
} ,
396
+ /// ```sql
390
397
/// POSITION(<expr> in <expr>)
398
+ /// ```
391
399
Position { expr : Box < Expr > , r#in : Box < Expr > } ,
400
+ /// ```sql
392
401
/// SUBSTRING(<expr> [FROM <expr>] [FOR <expr>])
402
+ /// ```
393
403
Substring {
394
404
expr : Box < Expr > ,
395
405
substring_from : Option < Box < Expr > > ,
396
406
substring_for : Option < Box < Expr > > ,
397
407
} ,
398
- /// TRIM([BOTH | LEADING | TRAILING] [<expr> FROM] <expr>)\
399
- /// Or\
408
+ /// ```sql
409
+ /// TRIM([BOTH | LEADING | TRAILING] [<expr> FROM] <expr>)
400
410
/// TRIM(<expr>)
411
+ /// ```
401
412
Trim {
402
413
expr : Box < Expr > ,
403
414
// ([BOTH | LEADING | TRAILING]
404
415
trim_where : Option < TrimWhereField > ,
405
416
trim_what : Option < Box < Expr > > ,
406
417
} ,
418
+ /// ```sql
407
419
/// OVERLAY(<expr> PLACING <expr> FROM <expr>[ FOR <expr> ]
420
+ /// ```
408
421
Overlay {
409
422
expr : Box < Expr > ,
410
423
overlay_what : Box < Expr > ,
@@ -426,7 +439,7 @@ pub enum Expr {
426
439
TypedString { data_type : DataType , value : String } ,
427
440
/// Access a map-like object by field (e.g. `column['field']` or `column[4]`
428
441
/// Note that depending on the dialect, struct like accesses may be
429
- /// parsed as [`ArrayIndex`] or [`MapAccess`]
442
+ /// parsed as [`ArrayIndex`](Self::ArrayIndex) or [`MapAccess`](Self::MapAccess)
430
443
/// <https://clickhouse.com/docs/en/sql-reference/data-types/map/>
431
444
MapAccess { column : Box < Expr > , keys : Vec < Expr > } ,
432
445
/// Scalar function call e.g. `LEFT(foo, 5)`
@@ -490,7 +503,7 @@ pub enum Expr {
490
503
/// `MySQL` specific text search function [(1)].
491
504
///
492
505
/// Syntax:
493
- /// ```text
506
+ /// ```sql
494
507
/// MARCH (<col>, <col>, ...) AGAINST (<expr> [<search modifier>])
495
508
///
496
509
/// <col> = CompoundIdentifier
@@ -956,9 +969,9 @@ pub struct WindowFrame {
956
969
}
957
970
958
971
impl Default for WindowFrame {
959
- /// returns default value for window frame
972
+ /// Returns default value for window frame
960
973
///
961
- /// see https://www.sqlite.org/windowfunctions.html#frame_specifications
974
+ /// See [this page]( https://www.sqlite.org/windowfunctions.html#frame_specifications) for more details.
962
975
fn default ( ) -> Self {
963
976
Self {
964
977
units : WindowFrameUnits :: Range ,
@@ -1365,7 +1378,9 @@ pub enum Statement {
1365
1378
/// Role name. If NONE is specified, then the current role name is removed.
1366
1379
role_name : Option < Ident > ,
1367
1380
} ,
1381
+ /// ```sql
1368
1382
/// SET <variable>
1383
+ /// ```
1369
1384
///
1370
1385
/// Note: this is not a standard SQL statement, but it is supported by at
1371
1386
/// least MySQL and PostgreSQL. Not all MySQL-specific syntatic forms are
@@ -1376,10 +1391,12 @@ pub enum Statement {
1376
1391
variable : ObjectName ,
1377
1392
value : Vec < Expr > ,
1378
1393
} ,
1394
+ /// ```sql
1379
1395
/// SET TIME ZONE <value>
1396
+ /// ```
1380
1397
///
1381
1398
/// Note: this is a PostgreSQL-specific statements
1382
- /// SET TIME ZONE <value> is an alias for SET timezone TO <value> in PostgreSQL
1399
+ /// ` SET TIME ZONE <value>` is an alias for ` SET timezone TO <value>` in PostgreSQL
1383
1400
SetTimeZone { local : bool , value : Expr } ,
1384
1401
/// SET NAMES 'charset_name' [COLLATE 'collation_name']
1385
1402
///
@@ -1396,7 +1413,9 @@ pub enum Statement {
1396
1413
///
1397
1414
/// Note: this is a Presto-specific statement.
1398
1415
ShowFunctions { filter : Option < ShowStatementFilter > } ,
1416
+ /// ```sql
1399
1417
/// SHOW <variable>
1418
+ /// ```
1400
1419
///
1401
1420
/// Note: this is a PostgreSQL-specific statement.
1402
1421
ShowVariable { variable : Vec < Ident > } ,
@@ -1471,10 +1490,13 @@ pub enum Statement {
1471
1490
location : Option < String > ,
1472
1491
managed_location : Option < String > ,
1473
1492
} ,
1493
+ /// ```sql
1474
1494
/// CREATE FUNCTION
1495
+ /// ```
1475
1496
///
1476
- /// Hive: https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-Create/Drop/ReloadFunction
1477
- /// Postgres: https://www.postgresql.org/docs/15/sql-createfunction.html
1497
+ /// Supported variants:
1498
+ /// 1. [Hive](https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-Create/Drop/ReloadFunction)
1499
+ /// 2. [Postgres](https://www.postgresql.org/docs/15/sql-createfunction.html)
1478
1500
CreateFunction {
1479
1501
or_replace : bool ,
1480
1502
temporary : bool ,
@@ -1567,8 +1589,11 @@ pub enum Statement {
1567
1589
// Specifies the actions to perform when values match or do not match.
1568
1590
clauses : Vec < MergeClause > ,
1569
1591
} ,
1570
- /// CACHE [ FLAG ] TABLE <table_name> [ OPTIONS('K1' = 'V1', 'K2' = V2) ] [ AS ] [ <query> ]
1571
- /// Based on Spark SQL,see <https://docs.databricks.com/spark/latest/spark-sql/language-manual/sql-ref-syntax-aux-cache-cache-table.html>
1592
+ /// `CACHE [ FLAG ] TABLE <table_name> [ OPTIONS('K1' = 'V1', 'K2' = V2) ] [ AS ] [ <query> ]`.
1593
+ ///
1594
+ /// See [Spark SQL docs] for more details.
1595
+ ///
1596
+ /// [Spark SQL docs]: https://docs.databricks.com/spark/latest/spark-sql/language-manual/sql-ref-syntax-aux-cache-cache-table.html
1572
1597
Cache {
1573
1598
/// Table flag
1574
1599
table_flag : Option < ObjectName > ,
@@ -2707,9 +2732,11 @@ impl fmt::Display for Statement {
2707
2732
}
2708
2733
2709
2734
/// Can use to describe options in create sequence or table column type identity
2735
+ /// ```sql
2710
2736
/// [ INCREMENT [ BY ] increment ]
2711
2737
/// [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
2712
2738
/// [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
2739
+ /// ```
2713
2740
#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
2714
2741
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
2715
2742
#[ cfg_attr( feature = "visitor" , derive( Visit ) ) ]
@@ -3540,7 +3567,8 @@ impl fmt::Display for ShowStatementFilter {
3540
3567
3541
3568
/// Sqlite specific syntax
3542
3569
///
3543
- /// https://sqlite.org/lang_conflict.html
3570
+ /// See [Sqlite documentation](https://sqlite.org/lang_conflict.html)
3571
+ /// for more details.
3544
3572
#[ derive( Debug , Copy , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
3545
3573
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
3546
3574
#[ cfg_attr( feature = "visitor" , derive( Visit ) ) ]
@@ -3979,7 +4007,10 @@ impl fmt::Display for FunctionDefinition {
3979
4007
}
3980
4008
}
3981
4009
3982
- /// Postgres: https://www.postgresql.org/docs/15/sql-createfunction.html
4010
+ /// Postgres specific feature.
4011
+ ///
4012
+ /// See [Postgresdocs](https://www.postgresql.org/docs/15/sql-createfunction.html)
4013
+ /// for more details
3983
4014
#[ derive( Debug , Default , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
3984
4015
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
3985
4016
#[ cfg_attr( feature = "visitor" , derive( Visit ) ) ]
0 commit comments