github.com/mithrandie/csvq@v1.18.1/lib/syntax/syntax.go (about) 1 package syntax 2 3 type Syntax []Expression 4 5 type Expression struct { 6 Label string 7 Grammar []Definition 8 Description Description 9 Children []Expression 10 } 11 12 var CsvqSyntax = []Expression{ 13 { 14 Label: "SELECT Statement", 15 Grammar: []Definition{ 16 { 17 Name: "select_query", 18 Group: []Grammar{ 19 {Option{Link("with_clause")}, Link("select_entity"), Option{Link("order_by_clause")}, Option{Link("limit_clause")}, Option{Keyword("FOR"), Keyword("UPDATE")}}, 20 }, 21 }, 22 { 23 Name: "select_entity", 24 Group: []Grammar{ 25 {Link("select_clause"), Option{Link("from_clause")}, Option{Link("where_clause")}, Option{Link("group_by_clause")}}, 26 {Link("select_set_entity"), Link("Set Operators"), Option{Keyword("ALL")}, Link("select_set_entity")}, 27 }, 28 }, 29 { 30 Name: "select_set_entity", 31 Group: []Grammar{ 32 {Link("select_entity")}, 33 {Parentheses{Link("select_query")}}, 34 }, 35 }, 36 }, 37 Children: []Expression{ 38 { 39 Label: "WITH Clause", 40 Grammar: []Definition{ 41 { 42 Name: "with_clause", 43 Group: []Grammar{ 44 {Keyword("WITH"), ContinuousOption{Link("common_table_expression")}}, 45 }, 46 }, 47 { 48 Name: "common_table_expression", 49 Group: []Grammar{ 50 {Option{Keyword("RECURSIVE")}, Identifier("table_name"), Option{Parentheses{ContinuousOption{Identifier("column_name")}}}, Keyword("AS"), Parentheses{Link("select_query")}}, 51 }, 52 }, 53 }, 54 }, 55 { 56 Label: "SELECT Clause", 57 Grammar: []Definition{ 58 { 59 Name: "select_clause", 60 Group: []Grammar{ 61 {Keyword("SELECT"), Option{Keyword("DISTINCT")}, ContinuousOption{Link("field")}}, 62 }, 63 }, 64 { 65 Name: "field", 66 Group: []Grammar{ 67 {Link("value")}, 68 {Link("value"), Keyword("AS"), Identifier("alias")}, 69 {Keyword("*")}, 70 {ConnectedGroup{Identifier("table_name"), Token("."), Keyword("*")}}, 71 }, 72 }, 73 }, 74 }, 75 { 76 Label: "FROM Clause", 77 Grammar: []Definition{ 78 { 79 Name: "from_clause", 80 Group: []Grammar{ 81 {Keyword("FROM"), Link("table"), FollowingContinuousOption{AnyOne{Link("table"), PlainGroup{Keyword("LATERAL"), Link("laterable_table")}}}}, 82 }, 83 }, 84 { 85 Name: "table", 86 Group: []Grammar{ 87 {Link("table_entity")}, 88 {Link("table_entity"), Identifier("alias")}, 89 {Link("table_entity"), Keyword("AS"), Identifier("alias")}, 90 {Link("join")}, 91 {Keyword("DUAL")}, 92 {Link("laterable_table")}, 93 {Parentheses{Link("table")}}, 94 }, 95 }, 96 { 97 Name: "table_entity", 98 Group: []Grammar{ 99 {Link("table_identifier")}, 100 {Link("format_specified_function")}, 101 }, 102 }, 103 { 104 Name: "table_identifier", 105 Group: []Grammar{ 106 {Identifier("table_name")}, 107 {Identifier("url")}, 108 {Link("table_identification_function")}, 109 {Keyword("STDIN")}, 110 }, 111 }, 112 { 113 Name: "laterable_table", 114 Group: []Grammar{ 115 {Link("subquery")}, 116 {Link("subquery"), Identifier("alias")}, 117 {Link("subquery"), Keyword("AS"), Identifier("alias")}, 118 }, 119 }, 120 { 121 Name: "subquery", 122 Group: []Grammar{ 123 {Parentheses{Link("select_query")}}, 124 }, 125 }, 126 { 127 Name: "join", 128 Group: []Grammar{ 129 {Link("table"), Keyword("CROSS"), Keyword("JOIN"), Link("table")}, 130 {Link("table"), Option{Keyword("INNER")}, Keyword("JOIN"), Link("table"), Link("join_condition")}, 131 {Link("table"), AnyOne{Keyword("LEFT"), Keyword("RIGHT"), Keyword("FULL")}, Option{Keyword("OUTER")}, Keyword("JOIN"), Link("table"), Link("join_condition")}, 132 {Link("table"), Keyword("NATURAL"), Option{Keyword("INNER")}, Keyword("JOIN"), Link("table")}, 133 {Link("table"), Keyword("NATURAL"), AnyOne{Keyword("LEFT"), Keyword("RIGHT")}, Option{Keyword("OUTER")}, Keyword("JOIN"), Link("table")}, 134 {Link("table"), Keyword("CROSS"), Keyword("JOIN"), Keyword("LATERAL"), Link("laterable_table")}, 135 {Link("table"), Option{Keyword("INNER")}, Keyword("JOIN"), Keyword("LATERAL"), Link("laterable_table"), Link("join_condition")}, 136 {Link("table"), Keyword("LEFT"), Option{Keyword("OUTER")}, Keyword("JOIN"), Keyword("LATERAL"), Link("laterable_table"), Link("join_condition")}, 137 {Link("table"), Keyword("NATURAL"), Option{Keyword("INNER")}, Keyword("JOIN"), Keyword("LATERAL"), Link("laterable_table")}, 138 {Link("table"), Keyword("NATURAL"), Keyword("LEFT"), Option{Keyword("OUTER")}, Keyword("JOIN"), Keyword("LATERAL"), Link("laterable_table")}, 139 }, 140 }, 141 { 142 Name: "join_condition", 143 Group: []Grammar{ 144 {Keyword("ON"), Link("condition")}, 145 {Keyword("USING"), Parentheses{ContinuousOption{Identifier("column_name")}}}, 146 }, 147 }, 148 { 149 Name: "table_identification_function", 150 Group: []Grammar{ 151 {Function{Name: "FILE::", Args: []Element{String("file_path")}}}, 152 {Function{Name: "INLINE::", Args: []Element{String("file_path")}}}, 153 {Function{Name: "URL::", Args: []Element{String("url")}}}, 154 {Function{Name: "DATA::", Args: []Element{String("data")}}}, 155 }, 156 }, 157 { 158 Name: "format_specified_function", 159 Group: []Grammar{ 160 {Function{Name: "CSV", Args: []Element{String("delimiter"), Link("table_identifier"), Option{String("encoding"), Boolean("no_header"), Boolean("without_null")}}}}, 161 {Function{Name: "FIXED", Args: []Element{String("delimiter_positions"), Link("table_identifier"), Option{String("encoding"), Boolean("no_header"), Boolean("without_null")}}}}, 162 {Function{Name: "JSON", Args: []Element{String("json_query"), Link("table_identifier")}}}, 163 {Function{Name: "JSONL", Args: []Element{String("json_query"), Link("table_identifier")}}}, 164 {Function{Name: "LTSV", Args: []Element{Link("table_identifier"), Option{String("encoding"), Boolean("without_null")}}}}, 165 }, 166 }, 167 }, 168 }, 169 { 170 Label: "WHERE Clause", 171 Grammar: []Definition{ 172 { 173 Name: "where_clause", 174 Group: []Grammar{ 175 {Keyword("WHERE"), Link("condition")}, 176 }, 177 }, 178 { 179 Name: "condition", 180 Group: []Grammar{ 181 {Link("value")}, 182 }, 183 }, 184 }, 185 }, 186 { 187 Label: "GROUP BY Clause", 188 Grammar: []Definition{ 189 { 190 Name: "group_by_clause", 191 Group: []Grammar{ 192 {Keyword("GROUP"), Keyword("BY"), ContinuousOption{Link("field")}}, 193 }, 194 }, 195 }, 196 }, 197 { 198 Label: "HAVING Clause", 199 Grammar: []Definition{ 200 { 201 Name: "having_clause", 202 Group: []Grammar{ 203 {Keyword("HAVING"), Link("condition")}, 204 }, 205 }, 206 }, 207 }, 208 { 209 Label: "ORDER BY Clause", 210 Grammar: []Definition{ 211 { 212 Name: "order_by_clause", 213 Group: []Grammar{ 214 {Keyword("ORDER"), Keyword("BY"), ContinuousOption{Link("order_item")}}, 215 }, 216 }, 217 { 218 Name: "order_item", 219 Group: []Grammar{ 220 {Link("field"), Option{Link("order_direction")}, Option{Link("null_position")}}, 221 }, 222 Description: Description{ 223 Template: "If %s keyword is specified in the %s, you can use only enumerated fields in the %s as %s.", 224 Values: []Element{Keyword("DISTINCT"), Link("select_clause"), Link("select_clause"), Link("field")}, 225 }, 226 }, 227 { 228 Name: "order_direction", 229 Group: []Grammar{ 230 {AnyOne{Keyword("ASC"), Keyword("DESC")}}, 231 }, 232 Description: Description{ 233 Template: "%s is the default.", 234 Values: []Element{Keyword("ASC")}, 235 }, 236 }, 237 { 238 Name: "null_position", 239 Group: []Grammar{ 240 {Keyword("NULLS"), AnyOne{Keyword("FIRST"), Keyword("LAST")}}, 241 }, 242 Description: Description{ 243 Template: "If %s is specified as %s then %s is the default. Otherwise %s is the default.", 244 Values: []Element{Link("order_direction"), Keyword("ASC"), Keyword("FIRST"), Keyword("LAST")}, 245 }, 246 }, 247 }, 248 }, 249 { 250 Label: "LIMIT Clause", 251 Grammar: []Definition{ 252 { 253 Name: "limit_clause", 254 Group: []Grammar{ 255 {Keyword("LIMIT"), Integer("number_of_records"), Option{AnyOne{Keyword("ROW"), Keyword("ROWS")}}, Option{AnyOne{Keyword("ONLY"), Keyword("WITH TIES")}}, Option{Link("offset_clause")}}, 256 {Keyword("LIMIT"), Float("percentage"), Keyword("PERCENT"), Option{AnyOne{Keyword("ONLY"), Keyword("WITH TIES")}}, Option{Link("offset_clause")}}, 257 {Option{Link("offset_clause")}, Keyword("FETCH"), AnyOne{Keyword("FIRST"), Keyword("NEXT")}, Integer("number_of_records"), AnyOne{Keyword("ROW"), Keyword("ROWS")}, Option{AnyOne{Keyword("ONLY"), Keyword("WITH TIES")}}}, 258 {Option{Link("offset_clause")}, Keyword("FETCH"), AnyOne{Keyword("FIRST"), Keyword("NEXT")}, Float("percentage"), Keyword("PERCENT"), Option{AnyOne{Keyword("ONLY"), Keyword("WITH TIES")}}}, 259 {Link("offset_clause")}, 260 }, 261 }, 262 { 263 Name: "offset_clause", 264 Group: []Grammar{ 265 {Keyword("OFFSET"), Integer("number_of_records"), Option{AnyOne{Keyword("ROW"), Keyword("ROWS")}}}, 266 }, 267 }, 268 }, 269 }, 270 }, 271 }, 272 { 273 Label: "INSERT Statement", 274 Grammar: []Definition{ 275 { 276 Name: "insert_statement", 277 Group: []Grammar{ 278 {Option{Link("with_clause")}, Link("insert_query")}, 279 }, 280 }, 281 { 282 Name: "insert_query", 283 Group: []Grammar{ 284 {Keyword("INSERT"), Keyword("INTO"), Identifier("table_name"), Option{Parentheses{ContinuousOption{Identifier("column_name")}}}, Keyword("VALUES"), ContinuousOption{Link("row_value")}}, 285 {Keyword("INSERT"), Keyword("INTO"), Identifier("table_name"), Option{Parentheses{ContinuousOption{Identifier("column_name")}}}, Link("select_query")}, 286 }, 287 }, 288 }, 289 }, 290 { 291 Label: "UPDATE Statement", 292 Grammar: []Definition{ 293 { 294 Name: "update_statement", 295 Group: []Grammar{ 296 {Option{Link("with_clause")}, Link("update_query")}, 297 }, 298 }, 299 { 300 Name: "update_query", 301 Group: []Grammar{ 302 {Keyword("UPDATE"), Identifier("table_name"), Keyword("SET"), ContinuousOption{Link("set_value")}, Option{Link("where_clause")}}, 303 {Keyword("UPDATE"), ContinuousOption{Identifier("table_alias")}, Keyword("SET"), ContinuousOption{Link("set_value")}, Link("from_clause"), Option{Link("where_clause")}}, 304 }, 305 }, 306 { 307 Name: "set_value", 308 Group: []Grammar{ 309 {Identifier("column_name"), Token("="), Link("value")}, 310 }, 311 }, 312 }, 313 }, 314 { 315 Label: "REPLACE Statement", 316 Grammar: []Definition{ 317 { 318 Name: "replace_statement", 319 Group: []Grammar{ 320 {Option{Link("with_clause")}, Link("replace_query")}, 321 }, 322 }, 323 { 324 Name: "replace_query", 325 Group: []Grammar{ 326 {Keyword("REPLACE"), Keyword("INTO"), Identifier("table_name"), Option{Parentheses{ContinuousOption{Identifier("column_name")}}}, Keyword("USING"), Parentheses{ContinuousOption{Identifier("key_column_name")}}, Keyword("VALUES"), ContinuousOption{Link("row_value")}}, 327 {Keyword("REPLACE"), Keyword("INTO"), Identifier("table_name"), Option{Parentheses{ContinuousOption{Identifier("column_name")}}}, Keyword("USING"), Parentheses{ContinuousOption{Identifier("key_column_name")}}, Link("select_query")}, 328 }, 329 }, 330 }, 331 }, 332 { 333 Label: "DELETE Statement", 334 Grammar: []Definition{ 335 { 336 Name: "delete_statement", 337 Group: []Grammar{ 338 {Option{Link("with_clause")}, Link("delete_query")}, 339 }, 340 }, 341 { 342 Name: "delete_query", 343 Group: []Grammar{ 344 {Keyword("DELETE"), Keyword("FROM"), Identifier("table_name"), Option{Link("where_clause")}}, 345 {Keyword("DELETE"), ContinuousOption{Identifier("table_alias")}, Link("from_clause"), Option{Link("where_clause")}}, 346 }, 347 }, 348 }, 349 }, 350 { 351 Label: "CREATE TABLE Statement", 352 Grammar: []Definition{ 353 { 354 Name: "create_table_statement", 355 Group: []Grammar{ 356 {Keyword("CREATE"), Keyword("TABLE"), Option{Keyword("IF NOT EXISTS")}, Identifier("file_path"), Parentheses{ContinuousOption{Identifier("column_name")}}}, 357 {Keyword("CREATE"), Keyword("TABLE"), Option{Keyword("IF NOT EXISTS")}, Identifier("file_path"), Option{Parentheses{ContinuousOption{Identifier("column_name")}}}, Option{Keyword("AS")}, Link("select_query")}, 358 }, 359 }, 360 }, 361 }, 362 { 363 Label: "ALTER TABLE Statement", 364 Grammar: []Definition{ 365 { 366 Name: "alter_table_add_column_statement", 367 Group: []Grammar{ 368 {Keyword("ALTER"), Keyword("TABLE"), Identifier("table_name"), Keyword("ADD"), Link("column_definition"), Option{Link("column_position")}}, 369 {Keyword("ALTER"), Keyword("TABLE"), Identifier("table_name"), Keyword("ADD"), Parentheses{ContinuousOption{Link("column_definition")}}, Option{Link("column_position")}}, 370 }, 371 }, 372 { 373 Name: "column_definition", 374 Group: []Grammar{ 375 {Identifier("column_name"), Option{Keyword("DEFAULT"), Link("value")}}, 376 }, 377 Description: Description{ 378 Template: "%s is the default value.", 379 Values: []Element{Null("NULL")}, 380 }, 381 }, 382 { 383 Name: "column_position", 384 Group: []Grammar{ 385 {AnyOne{Keyword("FIRST"), Keyword("LAST"), PlainGroup{Keyword("AFTER"), Identifier("column_name")}, PlainGroup{Keyword("BEFORE"), Identifier("column_name")}}}, 386 }, 387 Description: Description{ 388 Template: "%s is the default.", 389 Values: []Element{Keyword("LAST")}, 390 }, 391 }, 392 { 393 Name: "alter_table_drop_column_statement", 394 Group: []Grammar{ 395 {Keyword("ALTER"), Keyword("TABLE"), Identifier("table_name"), Keyword("DROP"), Identifier("column_name")}, 396 {Keyword("ALTER"), Keyword("TABLE"), Identifier("table_name"), Keyword("DROP"), Parentheses{ContinuousOption{Identifier("column_name")}}}, 397 }, 398 }, 399 { 400 Name: "alter_table_rename_column_statement", 401 Group: []Grammar{ 402 {Keyword("ALTER"), Keyword("TABLE"), Identifier("table_name"), Keyword("RENAME"), Identifier("old_column_name"), Keyword("TO"), Identifier("new_column_name")}, 403 }, 404 }, 405 { 406 Name: "alter_table_set_attribute_statement", 407 Group: []Grammar{ 408 {Keyword("ALTER"), Keyword("TABLE"), Identifier("table_name"), Keyword("SET"), Link("table_attribute"), Keyword("TO"), Link("value")}, 409 }, 410 }, 411 { 412 Name: "table_attribute", 413 Group: []Grammar{ 414 {AnyOne{Keyword("FORMAT"), Keyword("DELIMITER"), Keyword("DELIMITER_POSITIONS"), Keyword("JSON_ESCAPE"), Keyword("ENCODING"), Keyword("LINE_BREAK"), Keyword("HEADER"), Keyword("ENCLOSE_ALL"), Keyword("PRETTY_PRINT")}}, 415 }, 416 }, 417 }, 418 }, 419 { 420 Label: "Prepared Statement", 421 Grammar: []Definition{ 422 { 423 Name: "prepare_statement", 424 Group: []Grammar{ 425 {Keyword("PREPARE"), Identifier("statement_name"), Keyword("FROM"), String("statement")}, 426 }, 427 }, 428 { 429 Name: "execute_prepared_statement", 430 Group: []Grammar{ 431 {Keyword("EXECUTE"), Identifier("statement_name")}, 432 {Keyword("EXECUTE"), Identifier("statement_name"), Keyword("USING"), ContinuousOption{Link("statement_replace_value")}}, 433 }, 434 }, 435 { 436 Name: "statement_replace_value", 437 Group: []Grammar{ 438 {Link("value")}, 439 {Link("value"), Keyword("AS"), Identifier("placeholder_name")}, 440 }, 441 }, 442 { 443 Name: "dispose_prepared_statement", 444 Group: []Grammar{ 445 {Keyword("DISPOSE"), Keyword("PREPARE"), Identifier("statement_name")}, 446 }, 447 }, 448 { 449 Name: "statement_placeholder", 450 Description: Description{ 451 Template: "" + 452 "Positional Placeholder\n" + 453 " > Question Mark(U+003F `?`)\n" + 454 "Named Placeholder\n" + 455 " > Colon(U+003A `:`) and followd by %s", 456 Values: []Element{Identifier("identifier")}, 457 }, 458 }, 459 }, 460 }, 461 { 462 Label: "Variables", 463 Grammar: []Definition{ 464 { 465 Name: "declare_variable_statement", 466 Group: []Grammar{ 467 {Keyword("DECLARE"), ContinuousOption{Link("variable_assignment")}}, 468 {Keyword("VAR"), ContinuousOption{Link("variable_assignment")}}, 469 }, 470 }, 471 { 472 Name: "variable_assignment", 473 Group: []Grammar{ 474 {Variable("@variable")}, 475 {Variable("@variable"), Token(":="), Link("value")}, 476 }, 477 Description: Description{ 478 Template: "%s is the default value.", 479 Values: []Element{Null("NULL")}, 480 }, 481 }, 482 { 483 Name: "variable_substitution", 484 Group: []Grammar{ 485 {Variable("@variable"), Token(":="), Link("value")}, 486 }, 487 }, 488 { 489 Name: "select_into_statement", 490 Group: []Grammar{ 491 {Option{Link("with_clause")}, Link("select_clause"), Keyword("INTO"), ContinuousOption{Link("variable")}, Option{Link("from_clause")}, Option{Link("where_clause")}, Option{Link("group_by_clause")}, Option{Link("having_clause")}, Option{Link("order_by_clause")}, Option{Link("limit_clause")}, Option{Link("offset_clause")}, Option{Keyword("FOR"), Keyword("UPDATE")}}, 492 }, 493 }, 494 { 495 Name: "dispose_variable_statement", 496 Group: []Grammar{ 497 {Keyword("DISPOSE"), Variable("@variable")}, 498 }, 499 }, 500 }, 501 }, 502 { 503 Label: "Cursors", 504 Grammar: []Definition{ 505 { 506 Name: "declare_cursor_statement", 507 Group: []Grammar{ 508 {Keyword("DECLARE"), Identifier("cursor_name"), Keyword("CURSOR"), Keyword("FOR"), Link("select_query")}, 509 {Keyword("DECLARE"), Identifier("cursor_name"), Keyword("CURSOR"), Keyword("FOR"), Identifier("prepared_statement_name")}, 510 }, 511 }, 512 { 513 Name: "open_cursor_statement", 514 Group: []Grammar{ 515 {Keyword("OPEN"), Identifier("cursor_name")}, 516 {Keyword("OPEN"), Identifier("cursor_name"), Keyword("USING"), ContinuousOption{Link("replace_value")}}, 517 }, 518 }, 519 { 520 Name: "close_cursor_statement", 521 Group: []Grammar{ 522 {Keyword("CLOSE"), Identifier("cursor_name")}, 523 }, 524 }, 525 { 526 Name: "fetch_cursor_statement", 527 Group: []Grammar{ 528 {Keyword("FETCH"), Option{Link("fetch_position")}, Identifier("cursor_name"), Keyword("INTO"), ContinuousOption{Variable("@variable")}}, 529 }, 530 }, 531 { 532 Name: "fetch_position", 533 Group: []Grammar{ 534 {AnyOne{Keyword("NEXT"), Keyword("PRIOR"), Keyword("FIRST"), Keyword("LAST"), PlainGroup{Keyword("ABSOLUTE"), Integer("row_number")}, PlainGroup{Keyword("RELATIVE"), Integer("row_number")}}}, 535 }, 536 Description: Description{ 537 Template: "%s is the default.", 538 Values: []Element{Keyword("NEXT")}, 539 }, 540 }, 541 { 542 Name: "dispose_cursor_statement", 543 Group: []Grammar{ 544 {Keyword("DISPOSE"), Keyword("CURSOR"), Identifier("cursor_name")}, 545 }, 546 }, 547 }, 548 }, 549 { 550 Label: "Temporary Tables", 551 Grammar: []Definition{ 552 { 553 Name: "declare_view_statement", 554 Group: []Grammar{ 555 {Keyword("DECLARE"), Identifier("view_name"), Keyword("VIEW"), Parentheses{ContinuousOption{Identifier("column_name")}}}, 556 {Keyword("DECLARE"), Identifier("view_name"), Keyword("VIEW"), Option{Parentheses{ContinuousOption{Identifier("column_name")}}}, Keyword("AS"), Link("select_query")}, 557 }, 558 }, 559 { 560 Name: "dispose_view_statement", 561 Group: []Grammar{ 562 {Keyword("DISPOSE"), Keyword("VIEW"), Identifier("view_name")}, 563 }, 564 }, 565 }, 566 }, 567 { 568 Label: "User Defined Functions", 569 Grammar: []Definition{ 570 { 571 Name: "declare_scalar_function_statement", 572 Group: []Grammar{ 573 {Keyword("DECLARE"), Identifier("function_name"), Keyword("FUNCTION"), Parentheses{Link("function_parameters")}, Keyword("AS"), Keyword("BEGIN"), Token("statements"), Keyword("END")}, 574 }, 575 }, 576 { 577 Name: "declare_aggregate_function_statement", 578 Group: []Grammar{ 579 {Keyword("DECLARE"), Identifier("function_name"), Keyword("AGGREGATE"), Parentheses{Identifier("internal_cursor_name"), Link("function_parameters")}, Keyword("AS"), Keyword("BEGIN"), Token("statements"), Keyword("END")}, 580 }, 581 Description: Description{ 582 Template: "An aggregate function can also be called as an analytic function.", 583 }, 584 }, 585 { 586 Name: "function_parameters", 587 Group: []Grammar{ 588 {Option{ContinuousOption{Variable("@parameter")}}, Option{ContinuousOption{Link("optional_parameter")}}}, 589 }, 590 }, 591 { 592 Name: "optional_parameter", 593 Group: []Grammar{ 594 {Variable("@parameter"), Keyword("DEFAULT"), Link("value")}, 595 }, 596 }, 597 { 598 Name: "dispose_function_statement", 599 Group: []Grammar{ 600 {Keyword("DISPOSE"), Keyword("FUNCTION"), Identifier("function_name")}, 601 }, 602 }, 603 { 604 Name: "return_statement", 605 Group: []Grammar{ 606 {Keyword("RETURN"), Option{Link("value")}}, 607 }, 608 Description: Description{ 609 Template: "%s is the default value.", 610 Values: []Element{Null("NULL")}, 611 }, 612 }, 613 { 614 Name: "scalar_function_call", 615 Group: []Grammar{ 616 {Identifier("function_name"), Parentheses{ContinuousOption{Link("argument")}}}, 617 }, 618 }, 619 { 620 Name: "aggregate_function_call", 621 Group: []Grammar{ 622 {Identifier("function_name"), Parentheses{Option{Keyword("DISTINCT")}, Link("list_value"), Option{ContinuousOption{Link("argument")}}}}, 623 }, 624 }, 625 { 626 Name: "analytic_function_call", 627 Group: []Grammar{ 628 {Identifier("function_name"), Parentheses{Option{Keyword("DISTINCT")}, Link("list_value"), Option{ContinuousOption{Link("argument")}}}, Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, 629 }, 630 }, 631 }, 632 }, 633 { 634 Label: "Control Flow", 635 Grammar: []Definition{ 636 { 637 Name: "if_statement", 638 Group: []Grammar{ 639 {Keyword("IF"), Link("condition"), Keyword("THEN"), Token("statements"), Option{Keyword("ELSEIF"), Link("condition"), Keyword("THEN"), Token("statements"), Token("...")}, Option{Keyword("ELSE"), Token("statements")}, Keyword("END"), Keyword("IF")}, 640 }, 641 }, 642 { 643 Name: "case_statement", 644 Group: []Grammar{ 645 {Keyword("CASE"), Keyword("WHEN"), Link("condition"), Keyword("THEN"), Token("statements"), Option{Keyword("WHEN"), Link("condition"), Keyword("THEN"), Token("statements"), Token("...")}, Option{Keyword("ELSE"), Token("statements")}, Keyword("END"), Keyword("CASE")}, 646 {Keyword("CASE"), Link("value"), Keyword("WHEN"), Link("comparison_value"), Keyword("THEN"), Token("statements"), Option{Keyword("WHEN"), Link("comparison_value"), Keyword("THEN"), Token("statements"), Token("...")}, Option{Keyword("ELSE"), Token("statements")}, Keyword("END"), Keyword("CASE")}, 647 }, 648 }, 649 { 650 Name: "while_statement", 651 Group: []Grammar{ 652 {Keyword("WHILE"), Link("condition"), Keyword("DO"), Token("statements"), Keyword("END"), Keyword("WHILE")}, 653 }, 654 }, 655 { 656 Name: "while_in_cursor_statement", 657 Group: []Grammar{ 658 {Keyword("WHILE"), Option{AnyOne{Keyword("DECLARE"), Keyword("VAR")}}, ContinuousOption{Variable("@variable")}, Keyword("IN"), Identifier("cursor_name"), Keyword("DO"), Token("statements"), Keyword("END"), Keyword("WHILE")}, 659 }, 660 }, 661 { 662 Name: "continue_statement", 663 Group: []Grammar{ 664 {Keyword("CONTINUE")}, 665 }, 666 }, 667 { 668 Name: "break_statement", 669 Group: []Grammar{ 670 {Keyword("BREAK")}, 671 }, 672 }, 673 { 674 Name: "exit_statement", 675 Group: []Grammar{ 676 {Keyword("EXIT"), Option{Integer("exit_code")}}, 677 }, 678 Description: Description{ 679 Template: "%s is the default %s.", 680 Values: []Element{Token("0"), Integer("exit_code")}, 681 }, 682 }, 683 { 684 Name: "trigger_error_statement", 685 Group: []Grammar{ 686 {Keyword("TRIGGER"), Keyword("ERROR"), Option{Integer("exit_code")}, Option{String("error_message")}}, 687 }, 688 Description: Description{ 689 Template: "%s is the default %s.", 690 Values: []Element{Token("1"), Integer("exit_code")}, 691 }, 692 }, 693 }, 694 }, 695 { 696 Label: "Transaction Management", 697 Grammar: []Definition{ 698 { 699 Name: "commit_statement", 700 Group: []Grammar{ 701 {Keyword("COMMIT")}, 702 }, 703 }, 704 { 705 Name: "rollback_statement", 706 Group: []Grammar{ 707 {Keyword("ROLLBACK")}, 708 }, 709 }, 710 }, 711 }, 712 { 713 Label: "Built-in Command", 714 Grammar: []Definition{ 715 { 716 Name: "echo", 717 Group: []Grammar{ 718 {Keyword("ECHO"), Link("value")}, 719 }, 720 Description: Description{ 721 Template: "Print a value. This command returns the same result as \"PRINTF '%%s' USING value\".", 722 }, 723 }, 724 { 725 Name: "print", 726 Group: []Grammar{ 727 {Keyword("PRINT"), Link("value")}, 728 }, 729 Description: Description{ 730 Template: "Print a value formatted according to the type.", 731 }, 732 }, 733 { 734 Name: "printf", 735 Group: []Grammar{ 736 {Keyword("PRINTF"), String("format")}, 737 {Keyword("PRINTF"), String("format"), Keyword("USING"), ContinuousOption{Link("replace_value")}}, 738 }, 739 Description: Description{ 740 Template: "Print a formatted value.", 741 }, 742 }, 743 { 744 Name: "source", 745 Group: []Grammar{ 746 {Keyword("SOURCE"), Identifier("file_path")}, 747 }, 748 Description: Description{ 749 Template: "Load and execute an external file as a part of the procedure.", 750 }, 751 }, 752 { 753 Name: "execute", 754 Group: []Grammar{ 755 {Keyword("EXECUTE"), String("statements")}, 756 {Keyword("EXECUTE"), String("statements_format"), Keyword("USING"), ContinuousOption{Link("replace_value")}}, 757 }, 758 Description: Description{ 759 Template: "Execute a string as statements.", 760 }, 761 }, 762 { 763 Name: "show", 764 Group: []Grammar{ 765 {Keyword("SHOW"), AnyOne{Keyword("TABLES"), Keyword("VIEWS"), Keyword("CURSORS"), Keyword("FUNCTIONS"), Keyword("FLAGS"), Keyword("ENV"), Keyword("RUNINFO")}}, 766 }, 767 Description: Description{ 768 Template: "Show objects.", 769 }, 770 }, 771 { 772 Name: "show_fields", 773 Group: []Grammar{ 774 {Keyword("SHOW"), Keyword("FIELDS"), Keyword("FROM"), Identifier("table_name")}, 775 }, 776 Description: Description{ 777 Template: "Show fields in a table or a view.", 778 }, 779 }, 780 { 781 Name: "chdir", 782 Group: []Grammar{ 783 {Keyword("CHDIR"), Identifier("directory_path")}, 784 }, 785 Description: Description{ 786 Template: "Change current working directory.", 787 }, 788 }, 789 { 790 Name: "pwd", 791 Group: []Grammar{ 792 {Keyword("PWD")}, 793 }, 794 Description: Description{ 795 Template: "Print current working directory.", 796 }, 797 }, 798 { 799 Name: "reload", 800 Group: []Grammar{ 801 {Keyword("RELOAD"), Keyword("CONFIG")}, 802 }, 803 Description: Description{ 804 Template: "Reload configuration json files.", 805 }, 806 }, 807 { 808 Name: "syntax", 809 Group: []Grammar{ 810 {Keyword("SYNTAX"), Option{ContinuousOption{String("search_word")}}}, 811 }, 812 Description: Description{ 813 Template: "Print syntax.", 814 }, 815 }, 816 }, 817 }, 818 { 819 Label: "External Command", 820 Grammar: []Definition{ 821 { 822 Name: "external_command", 823 Group: []Grammar{ 824 {Token("$"), Token("command"), Option{Token("args"), Token("...")}}, 825 }, 826 Description: Description{ 827 Template: "Run an external command. The result is written to the standard output.", 828 }, 829 }, 830 }, 831 }, 832 { 833 Label: "Values", 834 Grammar: []Definition{ 835 { 836 Name: "Primitive Types", 837 Description: Description{ 838 Template: "" + 839 "%s\n" + 840 " > Character strings encoded in UTF-8.\n" + 841 "%s\n" + 842 " > 64-bit signed integers.\n" + 843 "%s\n" + 844 " > 64-bit floating point numbers.\n" + 845 "%s\n" + 846 " > Boolean values. true or false.\n" + 847 "%s\n" + 848 " > Values of three-valued logic. TRUE, UNKNOWN or FALSE.\n" + 849 "%s\n" + 850 " > Values of Date and time with nano seconds.\n" + 851 "%s\n" + 852 " > Representations of missing values." + 853 "", 854 Values: []Element{ 855 String("String"), 856 Integer("Integer"), 857 Float("Float"), 858 Boolean("Boolean"), 859 Ternary("Ternary"), 860 Datetime("Datetime"), 861 Null("Null"), 862 }, 863 }, 864 }, 865 { 866 Name: "field_reference", 867 Group: []Grammar{ 868 {Identifier("column_name")}, 869 {ConnectedGroup{Identifier("table_name"), Token("."), Identifier("column_name")}}, 870 {ConnectedGroup{Identifier("table_name"), Token("."), Integer("column_number")}}, 871 }, 872 }, 873 { 874 Name: "arithmetic_operation", 875 Description: Description{ 876 Template: "cf. %s", 877 Values: []Element{Link("Arithmetic Operators")}, 878 }, 879 }, 880 { 881 Name: "string_operation", 882 Description: Description{ 883 Template: "cf. %s", 884 Values: []Element{Link("String Operators")}, 885 }, 886 }, 887 { 888 Name: "function", 889 Description: Description{ 890 Template: "cf.\n" + 891 " > %s\n" + 892 " > %s\n" + 893 " > %s\n" + 894 " > %s\n" + 895 " > %s\n" + 896 " > %s\n" + 897 " > %s\n" + 898 " > %s\n" + 899 " > %s\n" + 900 " > %s\n" + 901 "", 902 Values: []Element{ 903 Link("Logical Functions"), 904 Link("Numeric Functions"), 905 Link("DateTime Functions"), 906 Link("String Functions"), 907 Link("Cryptographic Hash Functions"), 908 Link("Cast Functions"), 909 Link("System Functions"), 910 Link("Aggregate Functions"), 911 Link("Analytic Functions"), 912 Link("User Defined Functions"), 913 }, 914 }, 915 }, 916 { 917 Name: "subquery", 918 Group: []Grammar{ 919 {Parentheses{Link("select_query")}}, 920 }, 921 }, 922 { 923 Name: "variable", 924 Description: Description{ 925 Template: "cf. %s", 926 Values: []Element{Link("Variables")}, 927 }, 928 }, 929 { 930 Name: "variable_substitution", 931 Description: Description{ 932 Template: "cf. %s", 933 Values: []Element{Link("variable_substitution")}, 934 }, 935 }, 936 { 937 Name: "environment_variable", 938 Description: Description{ 939 Template: "cf. %s", 940 Values: []Element{Link("Environment Variables")}, 941 }, 942 }, 943 { 944 Name: "runtime_information", 945 Description: Description{ 946 Template: "cf. %s", 947 Values: []Element{Link("Runtime Information")}, 948 }, 949 }, 950 { 951 Name: "system_defined_constant", 952 Description: Description{ 953 Template: "cf. %s", 954 Values: []Element{Link("System Defined Constant")}, 955 }, 956 }, 957 { 958 Name: "flag", 959 Description: Description{ 960 Template: "cf. %s", 961 Values: []Element{Link("Flags")}, 962 }, 963 }, 964 { 965 Name: "parentheses", 966 Group: []Grammar{ 967 {Parentheses{Link("value")}}, 968 }, 969 }, 970 { 971 Name: "case_expression", 972 Group: []Grammar{ 973 {Keyword("CASE"), Keyword("WHEN"), Link("condition"), Keyword("THEN"), Link("result_value"), Option{Keyword("WHEN"), Link("condition"), Keyword("THEN"), Link("result_value"), Token("...")}, Option{Keyword("ELSE"), Link("result_value")}, Keyword("END")}, 974 {Keyword("CASE"), Link("value"), Keyword("WHEN"), Link("comparison_value"), Keyword("THEN"), Link("result_value"), Option{Keyword("WHEN"), Link("comparison_value"), Keyword("THEN"), Link("result_value"), Token("...")}, Option{Keyword("ELSE"), Link("result_value")}, Keyword("END")}, 975 }, 976 }, 977 { 978 Name: "comparison_operation", 979 Description: Description{ 980 Template: "cf. %s", 981 Values: []Element{Link("Comparison Operators")}, 982 }, 983 }, 984 { 985 Name: "logic_operation", 986 Description: Description{ 987 Template: "cf. %s", 988 Values: []Element{Link("Logic Operators")}, 989 }, 990 }, 991 { 992 Name: "cursor_status", 993 Group: []Grammar{ 994 {Keyword("CURSOR"), Identifier("cursor_name"), Keyword("IS"), Option{Keyword("NOT")}, Keyword("OPEN")}, 995 {Keyword("CURSOR"), Identifier("cursor_name"), Keyword("IS"), Option{Keyword("NOT")}, Keyword("IN"), Keyword("RANGE")}, 996 {Keyword("CURSOR"), Identifier("cursor_name"), Keyword("COUNT")}, 997 }, 998 }, 999 }, 1000 }, 1001 { 1002 Label: "Row Values", 1003 Grammar: []Definition{ 1004 { 1005 Name: "row_value", 1006 Group: []Grammar{ 1007 {Parentheses{ContinuousOption{Link("value")}}}, 1008 {Parentheses{Link("select_query")}}, 1009 {Function{Name: "JSON_ROW", Args: []Element{Link("json_query"), Link("json_data")}}}, 1010 }, 1011 }, 1012 }, 1013 }, 1014 { 1015 Label: "Flags", 1016 Description: Description{ 1017 Template: "" + 1018 "%s <type::%s>\n" + 1019 " > Deirectory path where files are located.\n" + 1020 "%s <type::%s>\n" + 1021 " > Default %s.\n" + 1022 "%s <type::%s>\n" + 1023 " > Datetime Format to parse strings.\n" + 1024 "%s <type::%s>\n" + 1025 " > Use double quotation mark(U+0022 \") as identifier enclosure.\n" + 1026 "%s <type::%s>\n" + 1027 " > Compare strictly that two values are equal for DISTINCT, GROUP BY and ORDER BY.\n" + 1028 "%s <type::%s>\n" + 1029 " > Limit of the waiting time in seconds to wait for locked files to be released.\n" + 1030 "%s <type::%s>\n" + 1031 " > Default format to load files.\n" + 1032 "%s <type::%s>\n" + 1033 " > Field delimiter for CSV.\n" + 1034 "%s <type::%s>\n" + 1035 " > Allow loading CSV files with uneven field length.\n" + 1036 "%s <type::%s>\n" + 1037 " > Delimiter positions for Fixed-Length Format.\n" + 1038 "%s <type::%s>\n" + 1039 " > Query for JSON data.\n" + 1040 "%s <type::%s>\n" + 1041 " > Character %s.\n" + 1042 "%s <type::%s>\n" + 1043 " > Import first line as a record.\n" + 1044 "%s <type::%s>\n" + 1045 " > Parse empty fields as empty strings.\n" + 1046 "%s <type::%s>\n" + 1047 " > Strip line break from the end of files and query results.\n" + 1048 "%s <type::%s>\n" + 1049 " > %s of query results.\n" + 1050 "%s <type::%s>\n" + 1051 " > Character %s of query results.\n" + 1052 "%s <type::%s>\n" + 1053 " > Field delimiter for query results in CSV.\n" + 1054 "%s <type::%s>\n" + 1055 " > Delimiter positions for query results in Fixed-Length Format.\n" + 1056 "%s <type::%s>\n" + 1057 " > Write without the header line in query results.\n" + 1058 "%s <type::%s>\n" + 1059 " > %s in query results.\n" + 1060 "%s <type::%s>\n" + 1061 " > Enclose all string values in CSV.\n" + 1062 "%s <type::%s>\n" + 1063 " > %s of query results.\n" + 1064 "%s <type::%s>\n" + 1065 " > Make JSON output easier to read in query results.\n" + 1066 "%s <type::%s>\n" + 1067 " > Use Scientific Notation for large exponents in output.\n" + 1068 "%s <type::%s>\n" + 1069 " > Count ambiguous characters as fullwidth.\n" + 1070 "%s <type::%s>\n" + 1071 " > Count diacritical signs as halfwidth.\n" + 1072 "%s <type::%s>\n" + 1073 " > Count format characters and zero-width spaces as halfwidth.\n" + 1074 "%s <type::%s>\n" + 1075 " > Use ANSI color escape sequences.\n" + 1076 "%s <type::%s>\n" + 1077 " > Suppress operation log output.\n" + 1078 "%s <type::%s>\n" + 1079 " > Hint for the number of cpu cores to be used.\n" + 1080 "%s <type::%s>\n" + 1081 " > Show execution time.\n" + 1082 "", 1083 Values: []Element{ 1084 Flag("@@REPOSITORY"), String("string"), 1085 Flag("@@TIMEZONE"), String("string"), Link("Timezone"), 1086 Flag("@@DATETIME_FORMAT"), String("string"), 1087 Flag("@@ANSI_QUOTES"), String("boolean"), 1088 Flag("@@STRICT_EQUAL"), String("boolean"), 1089 Flag("@@WAIT_TIMEOUT"), Float("float"), 1090 Flag("@@IMPORT_FORMAT"), String("string"), 1091 Flag("@@DELIMITER"), String("string"), 1092 Flag("@@ALLOW_UNEVEN_FIELDS"), String("boolean"), 1093 Flag("@@DELIMITER_POSITIONS"), String("string"), 1094 Flag("@@JSON_QUERY"), String("string"), 1095 Flag("@@ENCODING"), String("string"), Link("Encoding"), 1096 Flag("@@NO_HEADER"), Boolean("boolean"), 1097 Flag("@@WITHOUT_NULL"), Boolean("boolean"), 1098 Flag("@@STRIP_ENDING_LINE_BREAK"), Boolean("boolean"), 1099 Flag("@@FORMAT"), String("string"), Link("Format"), 1100 Flag("@@WRITE_ENCODING"), String("string"), Link("Encoding"), 1101 Flag("@@WRITE_DELIMITER"), String("string"), 1102 Flag("@@WRITE_DELIMITER_POSITIONS"), String("string"), 1103 Flag("@@WITHOUT_HEADER"), Boolean("boolean"), 1104 Flag("@@LINE_BREAK"), String("string"), Link("Line Break"), 1105 Flag("@@ENCLOSE_ALL"), Boolean("boolean"), 1106 Flag("@@JSON_ESCAPE"), String("string"), Link("Json Escape Type"), 1107 Flag("@@PRETTY_PRINT"), Boolean("boolean"), 1108 Flag("@@SCIENTIFIC_NOTATION"), Boolean("boolean"), 1109 Flag("@@EAST_ASIAN_ENCODING"), Boolean("boolean"), 1110 Flag("@@COUNT_DIACRITICAL_SIGN"), Boolean("boolean"), 1111 Flag("@@COUNT_FORMAT_CODE"), Boolean("boolean"), 1112 Flag("@@COLOR"), Boolean("boolean"), 1113 Flag("@@QUIET"), Boolean("boolean"), 1114 Flag("@@CPU"), Integer("integer"), 1115 Flag("@@STATS"), Boolean("boolean"), 1116 }, 1117 }, 1118 Grammar: []Definition{ 1119 { 1120 Name: "set_flag_statement", 1121 Group: []Grammar{ 1122 {Keyword("SET"), Flag("@@FLAG"), Keyword("TO"), Link("value")}, 1123 {Keyword("SET"), Flag("@@FLAG"), Keyword("="), Link("value")}, 1124 }, 1125 }, 1126 { 1127 Name: "show_flag_statement", 1128 Group: []Grammar{ 1129 {Keyword("SHOW"), Flag("@@FLAG")}, 1130 }, 1131 }, 1132 { 1133 Name: "add_flag_element_statement", 1134 Group: []Grammar{ 1135 {Keyword("ADD"), String("format"), Keyword("TO"), Flag("@@DATETIME_FORMAT")}, 1136 }, 1137 }, 1138 { 1139 Name: "remove_flag_element_statement", 1140 Group: []Grammar{ 1141 {Keyword("REMOVE"), String("format"), Keyword("FROM"), Flag("@@DATETIME_FORMAT")}, 1142 {Keyword("REMOVE"), Integer("format_index"), Keyword("FROM"), Flag("@@DATETIME_FORMAT")}, 1143 }, 1144 }, 1145 }, 1146 }, 1147 { 1148 Label: "Environment Variables", 1149 Grammar: []Definition{ 1150 { 1151 Name: "set_environment_variable_statement", 1152 Group: []Grammar{ 1153 {Keyword("SET"), Variable("@%ENV_NAME"), Keyword("TO"), Link("value")}, 1154 {Keyword("SET"), Variable("@@ENV_NAME"), Keyword("="), Link("value")}, 1155 }, 1156 }, 1157 { 1158 Name: "unset_environment_variable_statement", 1159 Group: []Grammar{ 1160 {Keyword("UNSET"), Variable("@%ENV_NAME")}, 1161 }, 1162 }, 1163 }, 1164 }, 1165 { 1166 Label: "Runtime Information", 1167 Description: Description{ 1168 Template: "" + 1169 "%s <type::%s>\n" + 1170 " > Whether there are tables or views that have not been comitted.\n" + 1171 "%s <type::%s>\n" + 1172 " > Number of uncommitted tables after creation.\n" + 1173 "%s <type::%s>\n" + 1174 " > Number of uncommitted tables after update.\n" + 1175 "%s <type::%s>\n" + 1176 " > Number of uncommitted views after update.\n" + 1177 "%s <type::%s>\n" + 1178 " > Number of loaded tables.\n" + 1179 "%s <type::%s>\n" + 1180 " > Current working directory.\n" + 1181 "%s <type::%s>\n" + 1182 " > Version of csvq.\n" + 1183 "", 1184 Values: []Element{ 1185 Variable("@#UNCOMMITTED"), Boolean("boolean"), 1186 Variable("@#CREATED"), Integer("integer"), 1187 Variable("@#UPDATED"), Integer("integer"), 1188 Variable("@#UPDATED_VIEWS"), Integer("integer"), 1189 Variable("@#LOADED_TABLES"), Integer("integer"), 1190 Variable("@#WORKING_DIRECTORY"), String("string"), 1191 Variable("@#VERSION"), String("string"), 1192 }, 1193 }, 1194 }, 1195 { 1196 Label: "System Defined Constant", 1197 Description: Description{ 1198 Template: "" + 1199 "```\n" + 1200 " +----------+------------------+---------+\n" + 1201 " | Category | Name | Type |\n" + 1202 " +----------+------------------+---------+\n" + 1203 " | MATH | E | float |\n" + 1204 " | | PI | float |\n" + 1205 " | | PHI | float |\n" + 1206 " | | SQRT2 | float |\n" + 1207 " | | SQRTE | float |\n" + 1208 " | | SQRTPI | float |\n" + 1209 " | | SQRTPHI | float |\n" + 1210 " | | LN2 | float |\n" + 1211 " | | LOG2E | float |\n" + 1212 " | | LN10 | float |\n" + 1213 " | | LOG10E | float |\n" + 1214 " | FLOAT | MAX | float |\n" + 1215 " | | SMALLEST_NONZERO | float |\n" + 1216 " | INTEGER | MAX | integer |\n" + 1217 " | | MIN | integer |\n" + 1218 " +----------+------------------+---------+\n" + 1219 "```", 1220 }, 1221 }, 1222 { 1223 Label: "JSON Query", 1224 Description: Description{ 1225 Template: "" + 1226 "%s\n" + 1227 " > A value identifier is used to represent an object member.\n" + 1228 "\n" + 1229 " > An identifier is a word starting with any unicode letter or a Low Line(U+005F _) and followed by a character string that contains any unicode letters, any digits or Low Lines(U+005F _)." + 1230 " You can use most character strings as an identifier by enclosing in Back Quotes(U+0060 `), Single Quotes(U+0027 ') or Double Quotes(U+0022 \")." + 1231 " Quotation Marks are escaped by Backslashes(U+005C \\).\n" + 1232 "%s\n" + 1233 " > Number of json array elements starting with 0.\n" + 1234 "%s\n" + 1235 " > A period(U+002E .) is used to separate values and that represents a child object.\n" + 1236 "%s\n" + 1237 " > Square Brackets(U+005B [, U+005D ]) are used to represent json array.\n" + 1238 "%s\n" + 1239 " > Curly Brackets(U+007B {, U+007D }) are used to repsesent json array of objects.\n" + 1240 "", 1241 Values: []Element{ 1242 Name("Value Identifier"), 1243 Name("Array Index"), 1244 Name("Value Separator"), 1245 Name("Array"), 1246 Name("Object Array"), 1247 }, 1248 }, 1249 Grammar: []Definition{ 1250 { 1251 Name: "json_value", 1252 Group: []Grammar{ 1253 {AnyOne{Link("json_object_member"), Link("json_array_element")}}, 1254 {ContinuousOption{Link("json_value")}}, 1255 }, 1256 }, 1257 { 1258 Name: "json_object_member", 1259 Group: []Grammar{ 1260 {Identifier("value_identifier")}, 1261 }, 1262 }, 1263 { 1264 Name: "json_array_element", 1265 Group: []Grammar{ 1266 {Option{Integer("index")}}, 1267 }, 1268 }, 1269 { 1270 Name: "json_array", 1271 Group: []Grammar{ 1272 {Option{}}, 1273 }, 1274 }, 1275 { 1276 Name: "json_object_array", 1277 Group: []Grammar{ 1278 {Token("{"), Option{ContinuousOption{Link("json_object_field")}}, Token("}")}, 1279 }, 1280 }, 1281 { 1282 Name: "json_object_field", 1283 Group: []Grammar{ 1284 {Identifier("field_name")}, 1285 {Identifier("field_name"), Keyword("as"), Identifier("alias")}, 1286 }, 1287 }, 1288 }, 1289 }, 1290 { 1291 Label: "Operators", 1292 Children: []Expression{ 1293 { 1294 Label: "Operator Precedence", 1295 Description: Description{ 1296 Template: "The following table list operators from highest precedence to lowest.\n" + 1297 "\n" + 1298 "```\n" + 1299 " +------------+---------------------+---------------+\n" + 1300 " | Precedence | Operators | Associativity |\n" + 1301 " +------------+---------------------+---------------+\n" + 1302 " | 1 | + (Unary Plus) | Right-to-Left |\n" + 1303 " | | - (Unary Minus) | Right-to-Left |\n" + 1304 " | | ! (Logical Not) | Right-to-Left |\n" + 1305 " | 2 | * (Multiplication) | Left-to-Right |\n" + 1306 " | | / (Division) | Left-to-Right |\n" + 1307 " | | %s (Modulo) | Left-to-Right |\n" + 1308 " | 3 | + (Addition) | Left-to-Right |\n" + 1309 " | | - (Subtraction) | Left-to-Right |\n" + 1310 " | 4 | || (Concatenation) | Left-to-Right |\n" + 1311 " | 5 | = | n/a |\n" + 1312 " | | == | n/a |\n" + 1313 " | | < | n/a |\n" + 1314 " | | <= | n/a |\n" + 1315 " | | > | n/a |\n" + 1316 " | | >= | n/a |\n" + 1317 " | | <> | n/a |\n" + 1318 " | | != | n/a |\n" + 1319 " | | IS | n/a |\n" + 1320 " | | BETWEEN | n/a |\n" + 1321 " | | IN | n/a |\n" + 1322 " | | LIKE | n/a |\n" + 1323 " | 6 | NOT | Right-to-Left |\n" + 1324 " | 7 | AND | Left-to-Right |\n" + 1325 " | 8 | OR | Left-to-Right |\n" + 1326 " | 9 | INTERSECT | Left-to-Right |\n" + 1327 " | 10 | UNION | Left-to-Right |\n" + 1328 " | | EXCEPT | Left-to-Right |\n" + 1329 " | 11 | := | Right-to-Left |\n" + 1330 " +------------+---------------------+---------------+\n" + 1331 "```", 1332 Values: []Element{Token("%")}, 1333 }, 1334 }, 1335 { 1336 Label: "Arithmetic Operators", 1337 Grammar: []Definition{ 1338 { 1339 Name: "binary_operator", 1340 Group: []Grammar{ 1341 {Link("value"), Link("binary_operator"), Link("value")}, 1342 }, 1343 Description: Description{ 1344 Template: "" + 1345 "```\n" + 1346 " +----------+-----------------+\n" + 1347 " | Operator | Description |\n" + 1348 " +----------+-----------------+\n" + 1349 " | + | Addition |\n" + 1350 " | - | Subtraction |\n" + 1351 " | * | Multiplication |\n" + 1352 " | / | Division |\n" + 1353 " | %s | Modulo |\n" + 1354 " +----------+-----------------+\n" + 1355 "```", 1356 Values: []Element{Token("%")}, 1357 }, 1358 }, 1359 { 1360 Name: "unary_operator", 1361 Group: []Grammar{ 1362 {Link("unary_operator"), Link("value")}, 1363 }, 1364 Description: Description{ 1365 Template: "" + 1366 "```\n" + 1367 " +----------+-------------+\n" + 1368 " | Operator | Description |\n" + 1369 " +----------+-------------+\n" + 1370 " | + | Plus |\n" + 1371 " | - | Minus |\n" + 1372 " +----------+-------------+\n" + 1373 "```", 1374 }, 1375 }, 1376 }, 1377 }, 1378 { 1379 Label: "Comparison Operators", 1380 Grammar: []Definition{ 1381 { 1382 Name: "relational_operator", 1383 Group: []Grammar{ 1384 {Link("value"), Link("relational_operator"), Link("value")}, 1385 {Link("row_value"), Link("relational_operator"), Link("row_value")}, 1386 }, 1387 Description: Description{ 1388 Template: "" + 1389 "```\n" + 1390 " +----------+-------------------------------------------------+\n" + 1391 " | Operator | Description |\n" + 1392 " +----------+-------------------------------------------------+\n" + 1393 " | = | LHS is equal to RHS |\n" + 1394 " | == | Both sides are the same type and the same value |\n" + 1395 " | < | LHS is less than RHS |\n" + 1396 " | <= | LHS is less than or equal to RHS |\n" + 1397 " | > | LHS is greater than RHS |\n" + 1398 " | >= | LHS is greater than or equal to RHS |\n" + 1399 " | <>,!= | LHS is not equal to RHS |\n" + 1400 " +----------+-------------------------------------------------+\n" + 1401 "```", 1402 }, 1403 }, 1404 { 1405 Name: "is", 1406 Group: []Grammar{ 1407 {Link("value"), Keyword("IS"), Option{Keyword("NOT")}, Keyword("NULL")}, 1408 {Link("value"), Keyword("IS"), Option{Keyword("NOT")}, Ternary("ternary")}, 1409 }, 1410 Description: Description{ 1411 Template: "Check if %s is %s. If %s value is specified, then evaluates the ternary value of %s and check if the ternary value is equal to %s.", 1412 Values: []Element{Link("value"), Null("NULL"), Ternary("ternary"), Link("value"), Ternary("ternary")}, 1413 }, 1414 }, 1415 { 1416 Name: "between", 1417 Group: []Grammar{ 1418 {Link("value"), Option{Keyword("NOT")}, Keyword("BETWEEN"), Link("low_value"), Keyword("AND"), Link("high_value")}, 1419 {Link("row_value"), Option{Keyword("NOT")}, Keyword("BETWEEN"), Link("low_row_value"), Keyword("AND"), Link("high_row_value")}, 1420 }, 1421 Description: Description{ 1422 Template: "Check %s is greater than or equal to %s and less than or equal to %s.", 1423 Values: []Element{Link("value"), Link("low"), Link("high")}, 1424 }, 1425 }, 1426 { 1427 Name: "like", 1428 Group: []Grammar{ 1429 {String("str"), Option{Keyword("NOT")}, Keyword("LIKE"), String("pattern")}, 1430 }, 1431 Description: Description{ 1432 Template: "Check if %s matches %s. If %s is null, then returns %s. In %s, following special characters can be used.\n" + 1433 "\n" + 1434 "```\n" + 1435 " +---------------------+---------------------------+\n" + 1436 " | character | Description |\n" + 1437 " +---------------------+---------------------------+\n" + 1438 " | %s | Any number of characters |\n" + 1439 " | _ (U+005F Low Line) | Exactly one character |\n" + 1440 " +---------------------+---------------------------+\n" + 1441 "```", 1442 Values: []Element{String("str"), String("pattern"), String("str"), Ternary("UNKNOWN"), String("pattern"), Token("%")}, 1443 }, 1444 }, 1445 { 1446 Name: "in", 1447 Group: []Grammar{ 1448 {Link("value"), Option{Keyword("NOT")}, Keyword("IN"), Parentheses{ContinuousOption{Link("value")}}}, 1449 {Link("row_value"), Option{Keyword("NOT")}, Keyword("IN"), Parentheses{ContinuousOption{Link("row_value")}}}, 1450 }, 1451 }, 1452 { 1453 Name: "any", 1454 Group: []Grammar{ 1455 {Link("value"), Link("relational_operator"), Keyword("ANY"), Parentheses{ContinuousOption{Link("value")}}}, 1456 {Link("row_value"), Link("relational_operator"), Keyword("ANY"), Parentheses{ContinuousOption{Link("row_value")}}}, 1457 }, 1458 }, 1459 { 1460 Name: "all", 1461 Group: []Grammar{ 1462 {Link("value"), Link("relational_operator"), Keyword("ALL"), Parentheses{ContinuousOption{Link("value")}}}, 1463 {Link("row_value"), Link("relational_operator"), Keyword("ALL"), Parentheses{ContinuousOption{Link("row_value")}}}, 1464 }, 1465 }, 1466 { 1467 Name: "exists", 1468 Group: []Grammar{ 1469 {Keyword("EXISTS"), Parentheses{Link("select_query")}}, 1470 }, 1471 }, 1472 }, 1473 }, 1474 { 1475 Label: "Logic Operators", 1476 Grammar: []Definition{ 1477 { 1478 Name: "and", 1479 Group: []Grammar{ 1480 {Link("value"), Keyword("AND"), Link("value")}, 1481 }, 1482 }, 1483 { 1484 Name: "or", 1485 Group: []Grammar{ 1486 {Link("value"), Keyword("OR"), Link("value")}, 1487 }, 1488 }, 1489 { 1490 Name: "not", 1491 Group: []Grammar{ 1492 {Keyword("NOT"), Link("value")}, 1493 {Keyword("!"), Link("value")}, 1494 }, 1495 Description: Description{ 1496 Template: "%s and %s return the same value, but there is the difference of %s between these two operators.", 1497 Values: []Element{Keyword("NOT"), Keyword("!"), Link("precedence")}, 1498 }, 1499 }, 1500 }, 1501 }, 1502 { 1503 Label: "String Operators", 1504 Grammar: []Definition{ 1505 { 1506 Name: "concatenation", 1507 Group: []Grammar{ 1508 {Link("value"), Keyword("||"), Link("value")}, 1509 }, 1510 }, 1511 }, 1512 }, 1513 { 1514 Label: "Set Operators", 1515 Grammar: []Definition{ 1516 { 1517 Name: "union", 1518 Group: []Grammar{ 1519 {Link("select_set_entity"), Keyword("UNION"), Option{Keyword("ALL")}, Link("select_set_entity")}, 1520 }, 1521 }, 1522 { 1523 Name: "except", 1524 Group: []Grammar{ 1525 {Link("select_set_entity"), Keyword("EXCEPT"), Option{Keyword("ALL")}, Link("select_set_entity")}, 1526 }, 1527 }, 1528 { 1529 Name: "intersect", 1530 Group: []Grammar{ 1531 {Link("select_set_entity"), Keyword("INTERSECT"), Option{Keyword("ALL")}, Link("select_set_entity")}, 1532 }, 1533 }, 1534 }, 1535 }, 1536 }, 1537 }, 1538 { 1539 Label: "Functions", 1540 Children: []Expression{ 1541 { 1542 Label: "Logical Functions", 1543 Grammar: []Definition{ 1544 { 1545 Name: "coalesce", 1546 Group: []Grammar{ 1547 {Function{Name: "COALESCE", Args: []Element{ContinuousOption{Link("value")}}, Return: Return("primitive type")}}, 1548 }, 1549 Description: Description{Template: "Returns the first non-null %s in arguments. If there is no non-null %s, then returns %s.", Values: []Element{Link("value"), Link("value"), Null("NULL")}}, 1550 }, 1551 { 1552 Name: "if", 1553 Group: []Grammar{ 1554 {Function{Name: "IF", Args: []Element{Link("condition"), Link("value1"), Link("value2")}, Return: Return("primitive type")}}, 1555 }, 1556 Description: Description{Template: "If %s is %s, then returns %s. Otherwise returns %s.", Values: []Element{Link("condition"), Ternary("TRUE"), Link("value1"), Link("value2")}}, 1557 }, 1558 { 1559 Name: "ifnull", 1560 Group: []Grammar{ 1561 {Function{Name: "IFNULL", Args: []Element{Link("value1"), Link("value2")}, Return: Return("primitive type")}}, 1562 }, 1563 Description: Description{Template: "If %s is %s, then returns %s. Otherwise returns %s.", Values: []Element{Link("value1"), Null("NULL"), Link("value2"), Link("value1")}}, 1564 }, 1565 { 1566 Name: "nullif", 1567 Group: []Grammar{ 1568 {Function{Name: "NULLIF", Args: []Element{Link("value1"), Link("value2")}, Return: Return("primitive type")}}, 1569 }, 1570 Description: Description{Template: "If %s is equal to %s, then returns %s. Otherwise returns %s.", Values: []Element{Link("value1"), Link("value2"), Null("NULL"), Link("value1")}}, 1571 }, 1572 }, 1573 }, 1574 { 1575 Label: "Numeric Functions", 1576 Grammar: []Definition{ 1577 { 1578 Name: "abs", 1579 Group: []Grammar{ 1580 {Function{Name: "ABS", Args: []Element{Float("number")}, Return: Return("float")}}, 1581 }, 1582 Description: Description{Template: "Returns the absolute value of %s.", Values: []Element{Float("number")}}, 1583 }, 1584 { 1585 Name: "acos", 1586 Group: []Grammar{ 1587 {Function{Name: "ACOS", Args: []Element{Float("number")}, Return: Return("float")}}, 1588 }, 1589 Description: Description{Template: "Returns the arc cosine of %s.", Values: []Element{Float("number")}}, 1590 }, 1591 { 1592 Name: "acosh", 1593 Group: []Grammar{ 1594 {Function{Name: "ACOSH", Args: []Element{Float("number")}, Return: Return("float")}}, 1595 }, 1596 Description: Description{Template: "Returns the inverse hyperbolic cosine of %s.", Values: []Element{Float("number")}}, 1597 }, 1598 { 1599 Name: "asin", 1600 Group: []Grammar{ 1601 {Function{Name: "ASIN", Args: []Element{Float("number")}, Return: Return("float")}}, 1602 }, 1603 Description: Description{Template: "Returns the arc sine of %s.", Values: []Element{Float("number")}}, 1604 }, 1605 { 1606 Name: "asinh", 1607 Group: []Grammar{ 1608 {Function{Name: "ASINH", Args: []Element{Float("number")}, Return: Return("float")}}, 1609 }, 1610 Description: Description{Template: "Returns the inverse hyperbolic sine of %s.", Values: []Element{Float("number")}}, 1611 }, 1612 { 1613 Name: "atan", 1614 Group: []Grammar{ 1615 {Function{Name: "ATAN", Args: []Element{Float("number")}, Return: Return("float")}}, 1616 }, 1617 Description: Description{Template: "Returns the arc tangent of %s.", Values: []Element{Float("number")}}, 1618 }, 1619 { 1620 Name: "atan2", 1621 Group: []Grammar{ 1622 {Function{Name: "ATAN2", Args: []Element{Float("number2"), Float("number1")}, Return: Return("float")}}, 1623 }, 1624 Description: Description{Template: "Returns the arc tangent of %s / %s, using the signs of the two to determine the quadrant of the return value.", Values: []Element{Float("number2"), Float("number1")}}, 1625 }, 1626 { 1627 Name: "atanh", 1628 Group: []Grammar{ 1629 {Function{Name: "ATANH", Args: []Element{Float("number")}, Return: Return("float")}}, 1630 }, 1631 Description: Description{Template: "Returns the inverse hyperbolic tangent of %s.", Values: []Element{Float("number")}}, 1632 }, 1633 { 1634 Name: "cbrt", 1635 Group: []Grammar{ 1636 {Function{Name: "CBRT", Args: []Element{Float("number")}, Return: Return("float")}}, 1637 }, 1638 Description: Description{Template: "Returns the cube root of %s.", Values: []Element{Float("number")}}, 1639 }, 1640 { 1641 Name: "ceil", 1642 Group: []Grammar{ 1643 {Function{Name: "CEIL", Args: []Element{Float("number"), ArgWithDefValue{Arg: Integer("place"), Default: Integer("0")}}, Return: Return("float")}}, 1644 }, 1645 Description: Description{Template: "Rounds %s up to %s decimal place. If %s is a negative number, then %s represents the place in the integer part.", Values: []Element{Float("number"), Integer("place"), Integer("place"), Integer("place")}}, 1646 }, 1647 { 1648 Name: "cos", 1649 Group: []Grammar{ 1650 {Function{Name: "COS", Args: []Element{Float("number")}, Return: Return("float")}}, 1651 }, 1652 Description: Description{Template: "Returns the cosine of %s.", Values: []Element{Float("number")}}, 1653 }, 1654 { 1655 Name: "cosh", 1656 Group: []Grammar{ 1657 {Function{Name: "COSH", Args: []Element{Float("number")}, Return: Return("float")}}, 1658 }, 1659 Description: Description{Template: "Returns the hyperbolic cosine of %s.", Values: []Element{Float("number")}}, 1660 }, 1661 { 1662 Name: "exp", 1663 Group: []Grammar{ 1664 {Function{Name: "EXP", Args: []Element{Float("number")}, Return: Return("float")}}, 1665 }, 1666 Description: Description{Template: "Returns the value of base %s raised to the power of %s.", Values: []Element{Italic("e"), Float("number")}}, 1667 }, 1668 { 1669 Name: "exp2", 1670 Group: []Grammar{ 1671 {Function{Name: "EXP2", Args: []Element{Float("number")}, Return: Return("float")}}, 1672 }, 1673 Description: Description{Template: "Returns the value of base 2 raised to the power of %s.", Values: []Element{Float("number")}}, 1674 }, 1675 { 1676 Name: "expm1", 1677 Group: []Grammar{ 1678 {Function{Name: "EXPM1", Args: []Element{Float("number")}, Return: Return("float")}}, 1679 }, 1680 Description: Description{Template: "Returns the value of base %s raised to the power of %s nimus %s.", Values: []Element{Italic("e"), Float("number"), Italic("1")}}, 1681 }, 1682 { 1683 Name: "floor", 1684 Group: []Grammar{ 1685 {Function{Name: "FLOOR", Args: []Element{Float("number"), ArgWithDefValue{Arg: Integer("place"), Default: Integer("0")}}, Return: Return("float")}}, 1686 }, 1687 Description: Description{Template: "Rounds %s down to %s decimal place. If %s is a negative number, then %s represents the place in the integer part.", Values: []Element{Float("number"), Integer("place"), Integer("place"), Integer("place")}}, 1688 }, 1689 { 1690 Name: "is_inf", 1691 Group: []Grammar{ 1692 {Function{Name: "IS_INF", Args: []Element{Float("number"), ArgWithDefValue{Arg: Integer("sign"), Default: Integer("0")}}, Return: Return("ternary")}}, 1693 }, 1694 Description: Description{Template: "Returns %s is +INF or not when %s > 0, -INF or not when %s < 0, or either INF when %s = 0.", Values: []Element{Float("number"), Integer("sign"), Integer("sign"), Integer("sign")}}, 1695 }, 1696 { 1697 Name: "is_nan", 1698 Group: []Grammar{ 1699 {Function{Name: "IS_NAN", Args: []Element{Float("number")}, Return: Return("ternary")}}, 1700 }, 1701 Description: Description{Template: "Returns whether %s is a NaN.", Values: []Element{Float("number")}}, 1702 }, 1703 { 1704 Name: "log", 1705 Group: []Grammar{ 1706 {Function{Name: "LOG", Args: []Element{Float("number")}, Return: Return("float")}}, 1707 }, 1708 Description: Description{Template: "Returns the natural logarithm of %s.", Values: []Element{Float("number")}}, 1709 }, 1710 { 1711 Name: "log10", 1712 Group: []Grammar{ 1713 {Function{Name: "LOG10", Args: []Element{Float("number")}, Return: Return("float")}}, 1714 }, 1715 Description: Description{Template: "Returns the decimal logarithm of %s.", Values: []Element{Float("number")}}, 1716 }, 1717 { 1718 Name: "log1p", 1719 Group: []Grammar{ 1720 {Function{Name: "LOG1P", Args: []Element{Float("number")}, Return: Return("float")}}, 1721 }, 1722 Description: Description{Template: "Returns the natural logarithm of 1 plus %s.", Values: []Element{Float("number")}}, 1723 }, 1724 { 1725 Name: "log2", 1726 Group: []Grammar{ 1727 {Function{Name: "LOG2", Args: []Element{Float("number")}, Return: Return("float")}}, 1728 }, 1729 Description: Description{Template: "Returns the binary logarithm of %s.", Values: []Element{Float("number")}}, 1730 }, 1731 { 1732 Name: "logb", 1733 Group: []Grammar{ 1734 {Function{Name: "LOGB", Args: []Element{Float("number")}, Return: Return("float")}}, 1735 }, 1736 Description: Description{Template: "Returns the binary exponent of %s.", Values: []Element{Float("number")}}, 1737 }, 1738 { 1739 Name: "pow", 1740 Group: []Grammar{ 1741 {Function{Name: "POW", Args: []Element{Float("base"), Float("exponent")}, Return: Return("float")}}, 1742 }, 1743 Description: Description{Template: "Returns the value of %s raised to the power of %s.", Values: []Element{Float("base"), Float("exponent")}}, 1744 }, 1745 { 1746 Name: "round", 1747 Group: []Grammar{ 1748 {Function{Name: "ROUND", Args: []Element{Float("number"), ArgWithDefValue{Arg: Integer("place"), Default: Integer("0")}}, Return: Return("float")}}, 1749 }, 1750 Description: Description{Template: "Rounds %s to %s decimal place. If %s is a negative number, then %s represents the place in the integer part.", Values: []Element{Float("number"), Integer("place"), Integer("place"), Integer("place")}}, 1751 }, 1752 { 1753 Name: "sin", 1754 Group: []Grammar{ 1755 {Function{Name: "SIN", Args: []Element{Float("number")}, Return: Return("float")}}, 1756 }, 1757 Description: Description{Template: "Returns the sine of %s.", Values: []Element{Float("number")}}, 1758 }, 1759 { 1760 Name: "sinh", 1761 Group: []Grammar{ 1762 {Function{Name: "SINH", Args: []Element{Float("number")}, Return: Return("float")}}, 1763 }, 1764 Description: Description{Template: "Returns the hyperbolic sine of %s.", Values: []Element{Float("number")}}, 1765 }, 1766 { 1767 Name: "sqrt", 1768 Group: []Grammar{ 1769 {Function{Name: "SQRT", Args: []Element{Float("number")}, Return: Return("float")}}, 1770 }, 1771 Description: Description{Template: "Returns the square root of %s.", Values: []Element{Float("number")}}, 1772 }, 1773 { 1774 Name: "tan", 1775 Group: []Grammar{ 1776 {Function{Name: "TAN", Args: []Element{Float("number")}, Return: Return("float")}}, 1777 }, 1778 Description: Description{Template: "Returns the tangent of %s.", Values: []Element{Float("number")}}, 1779 }, 1780 { 1781 Name: "tanh", 1782 Group: []Grammar{ 1783 {Function{Name: "TANH", Args: []Element{Float("number")}, Return: Return("float")}}, 1784 }, 1785 Description: Description{Template: "Returns the hyperbolic tangent of %s.", Values: []Element{Float("number")}}, 1786 }, 1787 { 1788 Name: "bin_to_dec", 1789 Group: []Grammar{ 1790 {Function{Name: "BIN_TO_DEC", Args: []Element{String("bin")}, Return: Return("integer")}}, 1791 }, 1792 Description: Description{Template: "Converts %s representing a binary number to an integer.", Values: []Element{String("bin")}}, 1793 }, 1794 { 1795 Name: "oct_to_dec", 1796 Group: []Grammar{ 1797 {Function{Name: "OCT_TO_DEC", Args: []Element{String("oct")}, Return: Return("integer")}}, 1798 }, 1799 Description: Description{Template: "Converts %s representing a octal number to an integer.", Values: []Element{String("oct")}}, 1800 }, 1801 { 1802 Name: "hex_to_dec", 1803 Group: []Grammar{ 1804 {Function{Name: "HEX_TO_DEC", Args: []Element{String("hex")}, Return: Return("integer")}}, 1805 }, 1806 Description: Description{Template: "Converts %s representing a hexadecimal number to an integer.", Values: []Element{String("hex")}}, 1807 }, 1808 { 1809 Name: "enotation_to_dec", 1810 Group: []Grammar{ 1811 {Function{Name: "ENOTATION_TO_DEC", Args: []Element{String("enotation")}, Return: Return("float")}}, 1812 }, 1813 Description: Description{Template: "Converts %s representing a number with exponential notation to an integer or a float.", Values: []Element{String("enotation")}}, 1814 }, 1815 { 1816 Name: "bin", 1817 Group: []Grammar{ 1818 {Function{Name: "BIN", Args: []Element{Integer("number")}, Return: Return("string")}}, 1819 }, 1820 Description: Description{Template: "Converts %s to a string representing the binary number.", Values: []Element{Integer("number")}}, 1821 }, 1822 { 1823 Name: "oct", 1824 Group: []Grammar{ 1825 {Function{Name: "OCT", Args: []Element{Integer("number")}, Return: Return("string")}}, 1826 }, 1827 Description: Description{Template: "Converts %s to a string representing the octal number.", Values: []Element{Integer("number")}}, 1828 }, 1829 { 1830 Name: "hex", 1831 Group: []Grammar{ 1832 {Function{Name: "HEX", Args: []Element{Integer("number")}, Return: Return("string")}}, 1833 }, 1834 Description: Description{Template: "Converts %s to a string representing the hexadecimal number.", Values: []Element{Integer("number")}}, 1835 }, 1836 { 1837 Name: "enotation", 1838 Group: []Grammar{ 1839 {Function{Name: "ENOTATION", Args: []Element{Float("number")}, Return: Return("string")}}, 1840 }, 1841 Description: Description{Template: "Converts %s to a string representing the number with exponential notation.", Values: []Element{Integer("number")}}, 1842 }, 1843 { 1844 Name: "number_format", 1845 Group: []Grammar{ 1846 {Function{Name: "NUMBER_FORMAT", Args: []Element{Float("number"), ArgWithDefValue{Arg: Integer("precision"), Default: Integer("-1")}, ArgWithDefValue{Arg: String("decimalPoint"), Default: String("'.'")}, ArgWithDefValue{Arg: String("thousandsSeparator"), Default: String("','")}, ArgWithDefValue{Arg: String("decimalSeparator"), Default: String("''")}}, Return: Return("string")}}, 1847 }, 1848 Description: Description{Template: "Formats %s to a string with separators.", Values: []Element{Integer("number")}}, 1849 }, 1850 { 1851 Name: "rand", 1852 Group: []Grammar{ 1853 {Function{Name: "RAND", Return: Return("float")}}, 1854 {Function{Name: "RAND", Args: []Element{Integer("min"), Integer("max")}, Return: Return("integer")}}, 1855 }, 1856 Description: Description{Template: "Returns a random float number greater than or equal to 0.0 and less than 1.0. If %s and %s are specified, then returns a random integer between %s and %s.", Values: []Element{Integer("min"), Integer("max"), Integer("min"), Integer("max")}}, 1857 }, 1858 }, 1859 }, 1860 { 1861 Label: "Datetime Functions", 1862 Grammar: []Definition{ 1863 { 1864 Name: "now", 1865 Group: []Grammar{ 1866 {Function{Name: "NOW", Return: Return("datetime")}}, 1867 }, 1868 Description: Description{Template: "Returns a datetime value of current date and time. In a single query, every this function returns the same value."}, 1869 }, 1870 { 1871 Name: "datetime_format", 1872 Group: []Grammar{ 1873 {Function{Name: "DATETIME_FORMAT", Args: []Element{Datetime("datetime"), String("format")}, Return: Return("string")}}, 1874 }, 1875 Description: Description{Template: "Formats %s according to %s.", Values: []Element{Datetime("datetime"), String("format")}}, 1876 }, 1877 { 1878 Name: "year", 1879 Group: []Grammar{ 1880 {Function{Name: "YEAR", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1881 }, 1882 Description: Description{Template: "Returns the year of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1883 }, 1884 { 1885 Name: "month", 1886 Group: []Grammar{ 1887 {Function{Name: "MONTH", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1888 }, 1889 Description: Description{Template: "Returns the month number of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1890 }, 1891 { 1892 Name: "day", 1893 Group: []Grammar{ 1894 {Function{Name: "DAY", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1895 }, 1896 Description: Description{Template: "Returns the day of month of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1897 }, 1898 { 1899 Name: "hour", 1900 Group: []Grammar{ 1901 {Function{Name: "HOUR", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1902 }, 1903 Description: Description{Template: "Returns the hour of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1904 }, 1905 { 1906 Name: "minute", 1907 Group: []Grammar{ 1908 {Function{Name: "MINUTE", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1909 }, 1910 Description: Description{Template: "Returns the minute of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1911 }, 1912 { 1913 Name: "second", 1914 Group: []Grammar{ 1915 {Function{Name: "SECOND", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1916 }, 1917 Description: Description{Template: "Returns the second of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1918 }, 1919 { 1920 Name: "millisecond", 1921 Group: []Grammar{ 1922 {Function{Name: "MILLISECOND", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1923 }, 1924 Description: Description{Template: "Returns the millisecond of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1925 }, 1926 { 1927 Name: "microsecond", 1928 Group: []Grammar{ 1929 {Function{Name: "MICROSECOND", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1930 }, 1931 Description: Description{Template: "Returns the microsecond of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1932 }, 1933 { 1934 Name: "nanosecond", 1935 Group: []Grammar{ 1936 {Function{Name: "NANOSECOND", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1937 }, 1938 Description: Description{Template: "Returns the nanosecond of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1939 }, 1940 { 1941 Name: "weekday", 1942 Group: []Grammar{ 1943 {Function{Name: "WEEKDAY", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1944 }, 1945 Description: Description{Template: "Returns the weekday number of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1946 }, 1947 { 1948 Name: "unix_time", 1949 Group: []Grammar{ 1950 {Function{Name: "UNIX_TIME", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1951 }, 1952 Description: Description{Template: "Returns the number of seconds elapsed since January 1, 1970 UTC of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1953 }, 1954 { 1955 Name: "unix_nano_time", 1956 Group: []Grammar{ 1957 {Function{Name: "UNIX_NANO_TIME", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1958 }, 1959 Description: Description{Template: "Returns the number of nanoseconds elapsed since January 1, 1970 UTC of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1960 }, 1961 { 1962 Name: "day_of_year", 1963 Group: []Grammar{ 1964 {Function{Name: "DAY_OF_YEAR", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1965 }, 1966 Description: Description{Template: "Returns the day of the year of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1967 }, 1968 { 1969 Name: "week_of_year", 1970 Group: []Grammar{ 1971 {Function{Name: "WEEK_OF_YEAR", Args: []Element{Datetime("datetime")}, Return: Return("integer")}}, 1972 }, 1973 Description: Description{Template: "Returns the week number of the year of %s as an integer.", Values: []Element{Datetime("datetime")}}, 1974 }, 1975 { 1976 Name: "add_year", 1977 Group: []Grammar{ 1978 {Function{Name: "ADD_YEAR", Args: []Element{Datetime("datetime"), Integer("duration")}, Return: Return("datetime")}}, 1979 }, 1980 Description: Description{Template: "Adds %s years to %s.", Values: []Element{Integer("duration"), Datetime("datetime")}}, 1981 }, 1982 { 1983 Name: "add_month", 1984 Group: []Grammar{ 1985 {Function{Name: "ADD_MONTH", Args: []Element{Datetime("datetime"), Integer("duration")}, Return: Return("datetime")}}, 1986 }, 1987 Description: Description{Template: "Adds %s monthes to %s.", Values: []Element{Integer("duration"), Datetime("datetime")}}, 1988 }, 1989 { 1990 Name: "add_day", 1991 Group: []Grammar{ 1992 {Function{Name: "ADD_DAY", Args: []Element{Datetime("datetime"), Integer("duration")}, Return: Return("datetime")}}, 1993 }, 1994 Description: Description{Template: "Adds %s days to %s.", Values: []Element{Integer("duration"), Datetime("datetime")}}, 1995 }, 1996 { 1997 Name: "add_hour", 1998 Group: []Grammar{ 1999 {Function{Name: "ADD_HOUR", Args: []Element{Datetime("datetime"), Integer("duration")}, Return: Return("datetime")}}, 2000 }, 2001 Description: Description{Template: "Adds %s hours to %s.", Values: []Element{Integer("duration"), Datetime("datetime")}}, 2002 }, 2003 { 2004 Name: "add_minute", 2005 Group: []Grammar{ 2006 {Function{Name: "ADD_MINUTE", Args: []Element{Datetime("datetime"), Integer("duration")}, Return: Return("datetime")}}, 2007 }, 2008 Description: Description{Template: "Adds %s minutes to %s.", Values: []Element{Integer("duration"), Datetime("datetime")}}, 2009 }, 2010 { 2011 Name: "add_second", 2012 Group: []Grammar{ 2013 {Function{Name: "ADD_SECOND", Args: []Element{Datetime("datetime"), Integer("duration")}, Return: Return("datetime")}}, 2014 }, 2015 Description: Description{Template: "Adds %s seconds to %s.", Values: []Element{Integer("duration"), Datetime("datetime")}}, 2016 }, 2017 { 2018 Name: "add_milli", 2019 Group: []Grammar{ 2020 {Function{Name: "ADD_MILLI", Args: []Element{Datetime("datetime"), Integer("duration")}, Return: Return("datetime")}}, 2021 }, 2022 Description: Description{Template: "Adds %s milliseconds to %s.", Values: []Element{Integer("duration"), Datetime("datetime")}}, 2023 }, 2024 { 2025 Name: "add_micro", 2026 Group: []Grammar{ 2027 {Function{Name: "ADD_MICRO", Args: []Element{Datetime("datetime"), Integer("duration")}, Return: Return("datetime")}}, 2028 }, 2029 Description: Description{Template: "Adds %s microseconds to %s.", Values: []Element{Integer("duration"), Datetime("datetime")}}, 2030 }, 2031 { 2032 Name: "add_nano", 2033 Group: []Grammar{ 2034 {Function{Name: "ADD_NANO", Args: []Element{Datetime("datetime"), Integer("duration")}, Return: Return("datetime")}}, 2035 }, 2036 Description: Description{Template: "Adds %s nanoseconds to %s.", Values: []Element{Integer("duration"), Datetime("datetime")}}, 2037 }, 2038 { 2039 Name: "trunc_month", 2040 Group: []Grammar{ 2041 {Function{Name: "TRUNC_MONTH", Args: []Element{Datetime("datetime")}, Return: Return("datetime")}}, 2042 }, 2043 Description: Description{Template: "Truncates time information less than 1 year from %s.", Values: []Element{Datetime("datetime")}}, 2044 }, 2045 { 2046 Name: "trunc_day", 2047 Group: []Grammar{ 2048 {Function{Name: "TRUNC_DAY", Args: []Element{Datetime("datetime")}, Return: Return("datetime")}}, 2049 }, 2050 Description: Description{Template: "Truncates time information less than 1 month from %s.", Values: []Element{Datetime("datetime")}}, 2051 }, 2052 { 2053 Name: "trunc_time", 2054 Group: []Grammar{ 2055 {Function{Name: "TRUNC_TIME", Args: []Element{Datetime("datetime")}, Return: Return("datetime")}}, 2056 }, 2057 Description: Description{Template: "Truncates time information less than 1 day from %s.", Values: []Element{Datetime("datetime")}}, 2058 }, 2059 { 2060 Name: "trunc_minute", 2061 Group: []Grammar{ 2062 {Function{Name: "TRUNC_MINUTE", Args: []Element{Datetime("datetime")}, Return: Return("datetime")}}, 2063 }, 2064 Description: Description{Template: "Truncates time information less than 1 hour from %s.", Values: []Element{Datetime("datetime")}}, 2065 }, 2066 { 2067 Name: "trunc_second", 2068 Group: []Grammar{ 2069 {Function{Name: "TRUNC_MONTH", Args: []Element{Datetime("datetime")}, Return: Return("datetime")}}, 2070 }, 2071 Description: Description{Template: "Truncates time information less than 1 minute from %s.", Values: []Element{Datetime("datetime")}}, 2072 }, 2073 { 2074 Name: "trunc_milli", 2075 Group: []Grammar{ 2076 {Function{Name: "TRUNC_MILLI", Args: []Element{Datetime("datetime")}, Return: Return("datetime")}}, 2077 }, 2078 Description: Description{Template: "Truncates time information less than 1 second from %s.", Values: []Element{Datetime("datetime")}}, 2079 }, 2080 { 2081 Name: "trunc_micro", 2082 Group: []Grammar{ 2083 {Function{Name: "TRUNC_MICRO", Args: []Element{Datetime("datetime")}, Return: Return("datetime")}}, 2084 }, 2085 Description: Description{Template: "Truncates time information less than 1 millisecond from %s.", Values: []Element{Datetime("datetime")}}, 2086 }, 2087 { 2088 Name: "trunc_nano", 2089 Group: []Grammar{ 2090 {Function{Name: "TRUNC_NANO", Args: []Element{Datetime("datetime")}, Return: Return("datetime")}}, 2091 }, 2092 Description: Description{Template: "Truncates time information less than 1 microsecond from %s.", Values: []Element{Datetime("datetime")}}, 2093 }, 2094 { 2095 Name: "date_diff", 2096 Group: []Grammar{ 2097 {Function{Name: "DATE_DIFF", Args: []Element{Datetime("datetime1"), Datetime("datetime2")}, Return: Return("integer")}}, 2098 }, 2099 Description: Description{Template: "Returns the difference of days between two %s values. The time information less than 1 day are ignored in the calculation.", Values: []Element{Datetime("datetime")}}, 2100 }, 2101 { 2102 Name: "time_diff", 2103 Group: []Grammar{ 2104 {Function{Name: "TIME_DIFF", Args: []Element{Datetime("datetime1"), Datetime("datetime2")}, Return: Return("float")}}, 2105 }, 2106 Description: Description{Template: "Returns the difference of time between two %s values as seconds. In the return value, the integer part represents seconds and the fractional part represents nanoseconds.", Values: []Element{Datetime("datetime")}}, 2107 }, 2108 { 2109 Name: "time_nano_diff", 2110 Group: []Grammar{ 2111 {Function{Name: "TIME_DIFF", Args: []Element{Datetime("datetime1"), Datetime("datetime2")}, Return: Return("integer")}}, 2112 }, 2113 Description: Description{Template: "Returns the difference of time between two %s values as nanoseconds.", Values: []Element{Datetime("datetime")}}, 2114 }, 2115 { 2116 Name: "utc", 2117 Group: []Grammar{ 2118 {Function{Name: "UTC", Args: []Element{Datetime("datetime")}, Return: Return("datetime")}}, 2119 }, 2120 Description: Description{Template: "Returns the datetime value of %s in UTC.", Values: []Element{Datetime("datetime")}}, 2121 }, 2122 { 2123 Name: "milli_to_datetime", 2124 Group: []Grammar{ 2125 {Function{Name: "MILLI_TO_DATETIME", Args: []Element{Integer("unix_milli_time")}, Return: Return("datetime")}}, 2126 }, 2127 Description: Description{Template: "Returns the datetime value represented by %s.", Values: []Element{Integer("unix_milli_time")}}, 2128 }, 2129 { 2130 Name: "nano_to_datetime", 2131 Group: []Grammar{ 2132 {Function{Name: "NANO_TO_DATETIME", Args: []Element{Integer("unix_nano_time")}, Return: Return("datetime")}}, 2133 }, 2134 Description: Description{Template: "Returns the datetime value represented by %s.", Values: []Element{Integer("unix_nano_time")}}, 2135 }, 2136 }, 2137 }, 2138 { 2139 Label: "String Functions", 2140 Grammar: []Definition{ 2141 { 2142 Name: "trim", 2143 Group: []Grammar{ 2144 {Function{Name: "TRIM", Args: []Element{String("str")}, Return: Return("string")}}, 2145 {Function{Name: "TRIM", Args: []Element{String("str"), String("charset")}, Return: Return("string")}}, 2146 }, 2147 Description: Description{ 2148 Template: "Returns the string value that is removed all leading and trailing characters contained in %s from %s. " + 2149 "If %s is not specified, then white spaces will be removed.", 2150 Values: []Element{String("charset"), String("str"), String("charset")}, 2151 }, 2152 }, 2153 { 2154 Name: "ltrim", 2155 Group: []Grammar{ 2156 {Function{Name: "LTRIM", Args: []Element{String("str")}, Return: Return("string")}}, 2157 {Function{Name: "LTRIM", Args: []Element{String("str"), String("charset")}, Return: Return("string")}}, 2158 }, 2159 Description: Description{ 2160 Template: "Returns the string value that is removed all leading characters contained in %s from %s. " + 2161 "If %s is not specified, then white spaces will be removed.", 2162 Values: []Element{String("charset"), String("str"), String("charset")}, 2163 }, 2164 }, 2165 { 2166 Name: "rtrim", 2167 Group: []Grammar{ 2168 {Function{Name: "RTRIM", Args: []Element{String("str")}, Return: Return("string")}}, 2169 {Function{Name: "RTRIM", Args: []Element{String("str"), String("charset")}, Return: Return("string")}}, 2170 }, 2171 Description: Description{ 2172 Template: "Returns the string value that is removed all trailing characters contained in %s from %s. " + 2173 "If %s is not specified, then white spaces will be removed.", 2174 Values: []Element{String("charset"), String("str"), String("charset")}, 2175 }, 2176 }, 2177 { 2178 Name: "upper", 2179 Group: []Grammar{ 2180 {Function{Name: "UPPER", Args: []Element{String("str")}, Return: Return("string")}}, 2181 }, 2182 Description: Description{Template: "Returns the string value replaced %s with characters mapped to their upper case.", Values: []Element{String("str")}}, 2183 }, 2184 { 2185 Name: "lower", 2186 Group: []Grammar{ 2187 {Function{Name: "LOWER", Args: []Element{String("str")}, Return: Return("string")}}, 2188 }, 2189 Description: Description{Template: "Returns the string value replaced %s with characters mapped to their lower case.", Values: []Element{String("str")}}, 2190 }, 2191 { 2192 Name: "base64_encode", 2193 Group: []Grammar{ 2194 {Function{Name: "BASE64_ENCODE", Args: []Element{String("str")}, Return: Return("string")}}, 2195 }, 2196 Description: Description{Template: "Returns the Base64 encoding of %s.", Values: []Element{String("str")}}, 2197 }, 2198 { 2199 Name: "base64_decode", 2200 Group: []Grammar{ 2201 {Function{Name: "BASE64_DECODE", Args: []Element{String("str")}, Return: Return("string")}}, 2202 }, 2203 Description: Description{Template: "Returns the string value represented by %s that is encoded with Base64.", Values: []Element{String("str")}}, 2204 }, 2205 { 2206 Name: "hex_encode", 2207 Group: []Grammar{ 2208 {Function{Name: "HEX_ENCODE", Args: []Element{String("str")}, Return: Return("string")}}, 2209 }, 2210 Description: Description{Template: "Returns the hexadecimal encoding of %s.", Values: []Element{String("str")}}, 2211 }, 2212 { 2213 Name: "hex_decode", 2214 Group: []Grammar{ 2215 {Function{Name: "HEX_DECODE", Args: []Element{String("str")}, Return: Return("string")}}, 2216 }, 2217 Description: Description{Template: "Returns the string value represented by %s that is encoded with hexadecimal.", Values: []Element{String("str")}}, 2218 }, 2219 { 2220 Name: "len", 2221 Group: []Grammar{ 2222 {Function{Name: "LEN", Args: []Element{String("str")}, Return: Return("integer")}}, 2223 }, 2224 Description: Description{Template: "Returns the number of characters of %s.", Values: []Element{String("str")}}, 2225 }, 2226 { 2227 Name: "byte_len", 2228 Group: []Grammar{ 2229 {Function{Name: "BYTE_LEN", Args: []Element{String("str"), ArgWithDefValue{Arg: String("encoding"), Default: String("'UTF8'")}}, Return: Return("integer")}}, 2230 }, 2231 Description: Description{Template: "Returns the byte length of %s.", Values: []Element{String("str")}}, 2232 }, 2233 { 2234 Name: "width", 2235 Group: []Grammar{ 2236 {Function{Name: "WIDTH", Args: []Element{String("str")}, Return: Return("integer")}}, 2237 }, 2238 Description: Description{ 2239 Template: "Returns the string width of %s.\n" + 2240 "Half-width characters are counted as 1, and full-width characters are counted as 2.", 2241 Values: []Element{String("str")}, 2242 }, 2243 }, 2244 { 2245 Name: "lpad", 2246 Group: []Grammar{ 2247 {Function{Name: "LPAD", Args: []Element{String("str"), Integer("len"), String("padstr"), ArgWithDefValue{Arg: String("pad_type"), Default: String("'LEN'")}, ArgWithDefValue{Arg: String("encoding"), Default: String("'UTF8'")}}, Return: Return("string")}}, 2248 }, 2249 Description: Description{ 2250 Template: "Returns the string value of %s padded with leading %s to the length specified by %s. %s is any one of %s.", 2251 Values: []Element{String("str"), String("padstr"), Integer("len"), String("pad_type"), AnyOne{Keyword("LEN"), Keyword("BYTE"), Keyword("WIDTH")}}, 2252 }, 2253 }, 2254 { 2255 Name: "rpad", 2256 Group: []Grammar{ 2257 {Function{Name: "RPAD", Args: []Element{String("str"), Integer("len"), String("padstr"), ArgWithDefValue{Arg: String("padType"), Default: String("'LEN'")}, ArgWithDefValue{Arg: String("encoding"), Default: String("'UTF8'")}}, Return: Return("string")}}, 2258 }, 2259 Description: Description{ 2260 Template: "Returns the string value of %s padded with trailing %s to the length specified by %s. %s is any one of %s.", 2261 Values: []Element{String("str"), String("padstr"), Integer("len"), String("padType"), AnyOne{Keyword("LEN"), Keyword("BYTE"), Keyword("WIDTH")}}, 2262 }, 2263 }, 2264 { 2265 Name: "substring", 2266 Group: []Grammar{ 2267 {Function{Name: "SUBSTRING", CustomArgs: []Element{String("str"), Keyword("FROM"), Integer("pos")}, Return: Return("string")}}, 2268 {Function{Name: "SUBSTRING", CustomArgs: []Element{String("str"), Keyword("FROM"), Integer("pos"), Keyword("FOR"), Integer("len")}, Return: Return("string")}}, 2269 {Function{Name: "SUBSTRING", Args: []Element{String("str"), Integer("pos")}, Return: Return("string")}}, 2270 {Function{Name: "SUBSTRING", Args: []Element{String("str"), Integer("pos"), Integer("len")}, Return: Return("string")}}, 2271 }, 2272 Description: Description{ 2273 Template: "Returns the %s characters in %s starting from the %s-th character using one-based positional indexing.\n" + 2274 "\n" + 2275 "If %s is 0, then it is treated as 1.\n" + 2276 "If %s is not specified or %s is longer than the length from %s to the end, then returns the substring from %s to the end.\n" + 2277 "If %s is negative, then starting position is %s from the end of the %s.", 2278 Values: []Element{Integer("len"), String("str"), Integer("pos"), Integer("pos"), Integer("len"), Integer("len"), Integer("pos"), Integer("pos"), Integer("pos"), Integer("pos"), String("str")}, 2279 }, 2280 }, 2281 { 2282 Name: "substr", 2283 Group: []Grammar{ 2284 {Function{Name: "SUBSTR", Args: []Element{String("str"), Integer("pos")}, Return: Return("string")}}, 2285 {Function{Name: "SUBSTR", Args: []Element{String("str"), Integer("pos"), Integer("len")}, Return: Return("string")}}, 2286 }, 2287 Description: Description{ 2288 Template: "Returns the %s characters in %s starting from the %s-th character. \n" + 2289 "This function behaves the same as %s function, but uses zero-based positional indexing.", 2290 Values: []Element{Integer("len"), String("str"), Integer("pos"), Link("substring")}, 2291 }, 2292 }, 2293 { 2294 Name: "instr", 2295 Group: []Grammar{ 2296 {Function{Name: "INSTR", Args: []Element{String("str"), Integer("substr")}, Return: Return("integer")}}, 2297 }, 2298 Description: Description{ 2299 Template: "Returns the index of the first occurrence of %s in %s, or null if %s is not present in %s.", 2300 Values: []Element{String("substr"), String("str"), String("substr"), String("str")}, 2301 }, 2302 }, 2303 { 2304 Name: "list_elem", 2305 Group: []Grammar{ 2306 {Function{Name: "LIST_ELEM", Args: []Element{String("str"), String("sep"), Integer("index")}, Return: Return("string")}}, 2307 }, 2308 Description: Description{Template: "Returns the string at %s in the list generated by splitting with %s from %s.", Values: []Element{Integer("index"), String("sep"), String("str")}}, 2309 }, 2310 { 2311 Name: "replace", 2312 Group: []Grammar{ 2313 {Function{Name: "REPLACE", Args: []Element{String("str"), String("old"), String("new")}, Return: Return("string")}}, 2314 }, 2315 Description: Description{Template: "Returns the string that is replaced all occurrences of %s with %s in %s.", Values: []Element{String("old"), String("new"), String("str")}}, 2316 }, 2317 { 2318 Name: "regexp_match", 2319 Group: []Grammar{ 2320 {Function{Name: "REGEXP_MATCH", Args: []Element{String("str"), String("regexp"), Option{Link("flags_of_regular_expressions")}}, Return: Return("ternary")}}, 2321 }, 2322 Description: Description{Template: "Verifies the string %s matches with the regular expression %s.", Values: []Element{String("str"), String("regexp")}}, 2323 }, 2324 { 2325 Name: "regexp_find", 2326 Group: []Grammar{ 2327 {Function{Name: "REGEXP_FIND", Args: []Element{String("str"), String("regexp"), Option{Link("flags_of_regular_expressions")}}, Return: Return("string")}}, 2328 }, 2329 Description: Description{Template: "Returns the string that matches the regular expression %s in %s.", Values: []Element{String("regexp"), String("str")}}, 2330 }, 2331 { 2332 Name: "regexp_find_submatches", 2333 Group: []Grammar{ 2334 {Function{Name: "REGEXP_FIND_SUBMATCHES", Args: []Element{String("str"), String("regexp"), Option{Link("flags_of_regular_expressions")}}, Return: Return("string")}}, 2335 }, 2336 Description: Description{Template: "Returns the string representing an array that matches the regular expression %s in %s.", Values: []Element{String("regexp"), String("str")}}, 2337 }, 2338 { 2339 Name: "regexp_find_all", 2340 Group: []Grammar{ 2341 {Function{Name: "REGEXP_FIND_ALL", Args: []Element{String("str"), String("regexp"), Option{Link("flags_of_regular_expressions")}}, Return: Return("string")}}, 2342 }, 2343 Description: Description{Template: "Returns the string representing a nested array that matches the regular expression %s in %s.", Values: []Element{String("regexp"), String("str")}}, 2344 }, 2345 { 2346 Name: "regexp_replace", 2347 Group: []Grammar{ 2348 {Function{Name: "REGEXP_REPLACE", Args: []Element{String("str"), String("regexp"), String("replacement_value"), Option{Link("flags_of_regular_expressions")}}, Return: Return("string")}}, 2349 }, 2350 Description: Description{Template: "Returns the string replaced substrings that match the regular expression %s with %s in %s.", Values: []Element{String("regexp"), String("replacement_value"), String("str")}}, 2351 }, 2352 { 2353 Name: "title_case", 2354 Group: []Grammar{ 2355 {Function{Name: "TITLE_CASE", Args: []Element{String("str")}, Return: Return("string")}}, 2356 }, 2357 Description: Description{Template: "Returns a string with the first letter of each word in %s capitalized.", Values: []Element{String("str")}}, 2358 }, 2359 { 2360 Name: "format", 2361 Group: []Grammar{ 2362 {Function{Name: "FORMAT", Args: []Element{String("format"), Option{ContinuousOption{Link("replace_value")}}}, Return: Return("string")}}, 2363 }, 2364 Description: Description{Template: "Returns a formatted string replaced %s with %s in %s.", Values: []Element{Link("placeholders"), Link("replace_value"), String("format")}}, 2365 }, 2366 { 2367 Name: "json_value", 2368 Group: []Grammar{ 2369 {Function{Name: "JSON_VALUE", Args: []Element{String("json_query"), String("json_data")}, Return: Return("value")}}, 2370 }, 2371 Description: Description{Template: "Returns a %s in %s.", Values: []Element{Link("value"), String("json_data")}}, 2372 }, 2373 { 2374 Name: "json_object", 2375 Group: []Grammar{ 2376 {Function{Name: "JSON_OBJECT", Args: []Element{ContinuousOption{Link("string")}}, Return: Return("string")}}, 2377 }, 2378 Description: Description{Template: "Returns a string formatted in JSON."}, 2379 }, 2380 }, 2381 }, 2382 { 2383 Label: "Cryptographic Hash Functions", 2384 Grammar: []Definition{ 2385 { 2386 Name: "md5", 2387 Group: []Grammar{ 2388 {Function{Name: "MD5", Args: []Element{String("str")}, Return: Return("string")}}, 2389 }, 2390 Description: Description{Template: "Generates a MD5 hash value."}, 2391 }, 2392 { 2393 Name: "sha1", 2394 Group: []Grammar{ 2395 {Function{Name: "SHA1", Args: []Element{String("str")}, Return: Return("string")}}, 2396 }, 2397 Description: Description{Template: "Generates a SHA-1 hash value."}, 2398 }, 2399 { 2400 Name: "sha256", 2401 Group: []Grammar{ 2402 {Function{Name: "SHA256", Args: []Element{String("str")}, Return: Return("string")}}, 2403 }, 2404 Description: Description{Template: "Generates a SHA-256 hash value."}, 2405 }, 2406 { 2407 Name: "sha512", 2408 Group: []Grammar{ 2409 {Function{Name: "SHA512", Args: []Element{String("str")}, Return: Return("string")}}, 2410 }, 2411 Description: Description{Template: "Generates a SHA-512 hash value."}, 2412 }, 2413 { 2414 Name: "md5_hmac", 2415 Group: []Grammar{ 2416 {Function{Name: "MD5_HMAC", Args: []Element{String("str"), String("key")}, Return: Return("string")}}, 2417 }, 2418 Description: Description{Template: "Generates a MD5 keyed-hash value using the HMAC method."}, 2419 }, 2420 { 2421 Name: "sha1_hmac", 2422 Group: []Grammar{ 2423 {Function{Name: "SHA1_HMAC", Args: []Element{String("str"), String("key")}, Return: Return("string")}}, 2424 }, 2425 Description: Description{Template: "Generates a SHA-1 keyed-hash value using the HMAC method."}, 2426 }, 2427 { 2428 Name: "sha256_hmac", 2429 Group: []Grammar{ 2430 {Function{Name: "SHA256_HMAC", Args: []Element{String("str"), String("key")}, Return: Return("string")}}, 2431 }, 2432 Description: Description{Template: "Generates a SHA-256 keyed-hash value using the HMAC method."}, 2433 }, 2434 { 2435 Name: "sha512_hmac", 2436 Group: []Grammar{ 2437 {Function{Name: "SHA512_HMAC", Args: []Element{String("str"), String("key")}, Return: Return("string")}}, 2438 }, 2439 Description: Description{Template: "Generates a SHA-512 keyed-hash value using the HMAC method."}, 2440 }, 2441 }, 2442 }, 2443 { 2444 Label: "Cast Functions", 2445 Grammar: []Definition{ 2446 { 2447 Name: "string", 2448 Group: []Grammar{ 2449 {Function{Name: "STRING", Args: []Element{Link("value")}, Return: Return("string")}}, 2450 }, 2451 Description: Description{Template: "Converts %s to a string.", Values: []Element{Link("value")}}, 2452 }, 2453 { 2454 Name: "integer", 2455 Group: []Grammar{ 2456 {Function{Name: "INTEGER", Args: []Element{Link("value")}, Return: Return("integer")}}, 2457 }, 2458 Description: Description{Template: "Converts %s to an integer.", Values: []Element{Link("value")}}, 2459 }, 2460 { 2461 Name: "float", 2462 Group: []Grammar{ 2463 {Function{Name: "FLOAT", Args: []Element{Link("value")}, Return: Return("float")}}, 2464 }, 2465 Description: Description{Template: "Converts %s to a float.", Values: []Element{Link("value")}}, 2466 }, 2467 { 2468 Name: "datetime", 2469 Group: []Grammar{ 2470 {Function{Name: "DATETIME", Args: []Element{Link("value"), Option{ArgWithDefValue{Arg: String("timezone"), Default: Italic("timezone set to the flag @@TIMEZONE")}}}, Return: Return("datetime")}}, 2471 }, 2472 Description: Description{Template: "Converts %s to a datetime.", Values: []Element{Link("value")}}, 2473 }, 2474 { 2475 Name: "boolean", 2476 Group: []Grammar{ 2477 {Function{Name: "BOOLEAN", Args: []Element{Link("value")}, Return: Return("boolean")}}, 2478 }, 2479 Description: Description{Template: "Converts %s to a boolean.", Values: []Element{Link("value")}}, 2480 }, 2481 { 2482 Name: "ternary", 2483 Group: []Grammar{ 2484 {Function{Name: "TERNARY", Args: []Element{Link("value")}, Return: Return("ternary")}}, 2485 }, 2486 Description: Description{Template: "Converts %s to a ternary.", Values: []Element{Link("value")}}, 2487 }, 2488 }, 2489 }, 2490 { 2491 Label: "System Functions", 2492 Grammar: []Definition{ 2493 { 2494 Name: "call", 2495 Group: []Grammar{ 2496 {Function{Name: "CALL", Args: []Element{String("command"), Option{ContinuousOption{String("argument")}}}, Return: Return("string")}}, 2497 }, 2498 Description: Description{ 2499 Template: "Executes an external %s and returns the standard output as a string. " + 2500 "If the external %s failed, then the executing procedure is terminated with an error.", 2501 Values: []Element{String("command"), String("command")}, 2502 }, 2503 }, 2504 }, 2505 }, 2506 { 2507 Label: "Aggregate Functions", 2508 Description: Description{ 2509 Template: "" + 2510 "Aggregate functions calculate groupd records retrieved by a select query. " + 2511 "If records are not grouped, all records are dealt with as one group. " + 2512 "If %s keyword is specified, aggregate functions calculate only unique values.\n" + 2513 "\n" + 2514 "Analytic Functions can be used only in %s, %s and %s", 2515 Values: []Element{Keyword("DISTINCT"), Link("Select Clause"), Link("Having Clause"), Link("Order By Clause")}, 2516 }, 2517 Grammar: []Definition{ 2518 { 2519 Name: "count", 2520 Group: []Grammar{ 2521 {Function{Name: "COUNT", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, Return: Return("integer")}}, 2522 {Function{Name: "COUNT", Args: []Element{Option{Keyword("DISTINCT")}, Keyword("*")}, Return: Return("integer")}}, 2523 }, 2524 Description: Description{ 2525 Template: "Returns the number of non-null values of %s. " + 2526 "If Asterisk(U+002A '*') is specified as a value, then returns the number of all values including null values.", 2527 Values: []Element{Link("value")}, 2528 }, 2529 }, 2530 { 2531 Name: "min", 2532 Group: []Grammar{ 2533 {Function{Name: "MIN", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, Return: Return("primitive type")}}, 2534 }, 2535 Description: Description{ 2536 Template: "Returns the minimum value of non-null values of %s. " + 2537 "If all values are null, then returns %s.", 2538 Values: []Element{Link("value"), Null("NULL")}, 2539 }, 2540 }, 2541 { 2542 Name: "max", 2543 Group: []Grammar{ 2544 {Function{Name: "MAX", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, Return: Return("primitive type")}}, 2545 }, 2546 Description: Description{ 2547 Template: "Returns the maximum value of non-null values of %s. " + 2548 "If all values are null, then returns %s.", 2549 Values: []Element{Link("value"), Null("NULL")}, 2550 }, 2551 }, 2552 { 2553 Name: "sum", 2554 Group: []Grammar{ 2555 {Function{Name: "SUM", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, Return: Return("float")}}, 2556 }, 2557 Description: Description{ 2558 Template: "Returns the sum of float values of %s. " + 2559 "If all values are null, then returns %s.", 2560 Values: []Element{Link("value"), Null("NULL")}, 2561 }, 2562 }, 2563 { 2564 Name: "avg", 2565 Group: []Grammar{ 2566 {Function{Name: "AVG", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, Return: Return("float")}}, 2567 }, 2568 Description: Description{ 2569 Template: "Returns the average of float values of %s. " + 2570 "If all values are null, then returns %s.", 2571 Values: []Element{Link("value"), Null("NULL")}, 2572 }, 2573 }, 2574 { 2575 Name: "stdev", 2576 Group: []Grammar{ 2577 {Function{Name: "STDEV", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, Return: Return("float")}}, 2578 }, 2579 Description: Description{ 2580 Template: "Returns the sample standard deviation of float values of %s. " + 2581 "If all values are null, then returns %s.", 2582 Values: []Element{Link("value"), Null("NULL")}, 2583 }, 2584 }, 2585 { 2586 Name: "stdevp", 2587 Group: []Grammar{ 2588 {Function{Name: "STDEVP", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, Return: Return("float")}}, 2589 }, 2590 Description: Description{ 2591 Template: "Returns the population standard deviation of float values of %s. " + 2592 "If all values are null, then returns %s.", 2593 Values: []Element{Link("value"), Null("NULL")}, 2594 }, 2595 }, 2596 { 2597 Name: "var", 2598 Group: []Grammar{ 2599 {Function{Name: "VAR", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, Return: Return("float")}}, 2600 }, 2601 Description: Description{ 2602 Template: "Returns the sample variance of float values of %s. " + 2603 "If all values are null, then returns %s.", 2604 Values: []Element{Link("value"), Null("NULL")}, 2605 }, 2606 }, 2607 { 2608 Name: "varp", 2609 Group: []Grammar{ 2610 {Function{Name: "VARP", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, Return: Return("float")}}, 2611 }, 2612 Description: Description{ 2613 Template: "Returns the population variance of float values of %s. " + 2614 "If all values are null, then returns %s.", 2615 Values: []Element{Link("value"), Null("NULL")}, 2616 }, 2617 }, 2618 { 2619 Name: "median", 2620 Group: []Grammar{ 2621 {Function{Name: "MEDIAN", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, Return: Return("float")}}, 2622 }, 2623 Description: Description{ 2624 Template: "Returns the median of float or datetime values of %s. " + 2625 "If all values are null, then returns %s.\n" + 2626 "\n" + 2627 "Even if %s represents datetime values, this function returns a float or an integer value. " + 2628 "The return value can be converted to a datetime value by using the %s function.", 2629 Values: []Element{Link("value"), Null("NULL"), Link("value"), Keyword("DATETIME")}, 2630 }, 2631 }, 2632 { 2633 Name: "listagg", 2634 Group: []Grammar{ 2635 {Function{Name: "LISTAGG", Args: []Element{Option{Keyword("DISTINCT")}, Link("value"), Option{String("sep")}}, AfterArgs: []Element{Option{Keyword("WITHIN"), Keyword("GROUP"), Parentheses{Link("order_by_clause")}}}, Return: Return("string")}}, 2636 }, 2637 Description: Description{ 2638 Template: "Returns the string result with the concatenated non-null values of %s. " + 2639 "If all values are null, then returns %s.\n" + 2640 "\n" + 2641 "%s is placed between values. Empty string is the default. " + 2642 "By using %s, you can sort values.", 2643 Values: []Element{Link("value"), Null("NULL"), String("sep"), Link("order_by_clause")}, 2644 }, 2645 }, 2646 { 2647 Name: "json_agg", 2648 Group: []Grammar{ 2649 {Function{Name: "JSON_AGG", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Option{Keyword("WITHIN"), Keyword("GROUP"), Parentheses{Link("order_by_clause")}}}, Return: Return("string")}}, 2650 }, 2651 Description: Description{ 2652 Template: "Returns the string formatted in JSON array of %s. " + 2653 "By using %s, you can sort values.", 2654 Values: []Element{Link("value"), Link("order_by_clause")}, 2655 }, 2656 }, 2657 }, 2658 }, 2659 { 2660 Label: "Analytic Functions", 2661 Description: Description{ 2662 Template: "Analytic functions calculate values of groups. Analytic Functions can be used only in %s and %s", 2663 Values: []Element{Link("Select Clause"), Link("Order By Clause")}, 2664 }, 2665 Grammar: []Definition{ 2666 { 2667 Name: "row_number", 2668 Group: []Grammar{ 2669 {Function{Name: "ROW_NUMBER", AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause")}}}, Return: Return("integer")}}, 2670 }, 2671 Description: Description{ 2672 Template: "Returns the sequential numbers of records in a group.", 2673 }, 2674 }, 2675 { 2676 Name: "rank", 2677 Group: []Grammar{ 2678 {Function{Name: "RANK", AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause")}}}, Return: Return("integer")}}, 2679 }, 2680 Description: Description{ 2681 Template: "Returns the ranks of records in a group.", 2682 }, 2683 }, 2684 { 2685 Name: "dense_rank", 2686 Group: []Grammar{ 2687 {Function{Name: "DENSE_RANK", AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause")}}}, Return: Return("integer")}}, 2688 }, 2689 Description: Description{ 2690 Template: "Returns the ranks of records without any gaps in the ranking in a group.", 2691 }, 2692 }, 2693 { 2694 Name: "cume_dist", 2695 Group: []Grammar{ 2696 {Function{Name: "CUME_DIST", AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause")}}}, Return: Return("float")}}, 2697 }, 2698 Description: Description{ 2699 Template: "Returns the cumulative distributions in a group. The return value is greater than 0 and less than or equal to 1.", 2700 }, 2701 }, 2702 { 2703 Name: "percent_rank", 2704 Group: []Grammar{ 2705 {Function{Name: "PERCENT_RANK", AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause")}}}, Return: Return("float")}}, 2706 }, 2707 Description: Description{ 2708 Template: "Returns the relative ranks in a group. The return value is greater than or equal to 0 and less than or equal to 1.", 2709 }, 2710 }, 2711 { 2712 Name: "ntile", 2713 Group: []Grammar{ 2714 {Function{Name: "NTILE", Args: []Element{Integer("number_of_groups")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause")}}}, Return: Return("integer")}}, 2715 }, 2716 Description: Description{ 2717 Template: "Splits the records into %s groups, then returns the sequential numbers of the groups.", 2718 Values: []Element{Integer("number_of_groups")}, 2719 }, 2720 }, 2721 { 2722 Name: "first_value", 2723 Group: []Grammar{ 2724 {Function{Name: "FIRST_VALUE", Args: []Element{Link("value")}, AfterArgs: []Element{Option{Keyword("IGNORE"), Keyword("NULLS")}, Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("primitive type")}}, 2725 }, 2726 Description: Description{ 2727 Template: "Returns the first value in a group. " + 2728 "If %s %s keywords are specified, then returns the first value that is not null.", 2729 Values: []Element{Keyword("IGNORE"), Keyword("NULLS")}, 2730 }, 2731 }, 2732 { 2733 Name: "last_value", 2734 Group: []Grammar{ 2735 {Function{Name: "FIRST_VALUE", Args: []Element{Link("value")}, AfterArgs: []Element{Option{Keyword("IGNORE"), Keyword("NULLS")}, Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("primitive type")}}, 2736 }, 2737 Description: Description{ 2738 Template: "Returns the last value in a group. " + 2739 "If %s %s keywords are specified, then returns the last value that is not null.", 2740 Values: []Element{Keyword("IGNORE"), Keyword("NULLS")}, 2741 }, 2742 }, 2743 { 2744 Name: "nth_value", 2745 Group: []Grammar{ 2746 {Function{Name: "NTH_VALUE", Args: []Element{Link("value"), Integer("n")}, AfterArgs: []Element{Option{Keyword("IGNORE"), Keyword("NULLS")}, Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("primitive type")}}, 2747 }, 2748 Description: Description{ 2749 Template: "Returns the %s-th value in a group. " + 2750 "If %s %s keywords are specified, then returns the %s-th value that is not null.", 2751 Values: []Element{Integer("n"), Keyword("IGNORE"), Keyword("NULLS"), Integer("n")}, 2752 }, 2753 }, 2754 { 2755 Name: "lag", 2756 Group: []Grammar{ 2757 {Function{Name: "LAG", Args: []Element{Link("value"), Option{ArgWithDefValue{Arg: Integer("offset"), Default: Integer("1")}, ArgWithDefValue{Arg: Link("default_value"), Default: Null("NULL")}}}, AfterArgs: []Element{Option{Keyword("IGNORE"), Keyword("NULLS")}, Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause")}}}, Return: Return("primitive type")}}, 2758 }, 2759 Description: Description{ 2760 Template: "Returns the value in a previous row. " + 2761 "If %s %s keywords are specified, then rows that %s values are nulls will be skipped.", 2762 Values: []Element{Link("value"), Keyword("IGNORE"), Keyword("NULLS")}, 2763 }, 2764 }, 2765 { 2766 Name: "lead", 2767 Group: []Grammar{ 2768 {Function{Name: "LEAD", Args: []Element{Link("value"), Option{ArgWithDefValue{Arg: Integer("offset"), Default: Integer("1")}, ArgWithDefValue{Arg: Link("default_value"), Default: Null("NULL")}}}, AfterArgs: []Element{Option{Keyword("IGNORE"), Keyword("NULLS")}, Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause")}}}, Return: Return("primitive type")}}, 2769 }, 2770 Description: Description{ 2771 Template: "Returns the value in a following row. " + 2772 "If %s %s keywords are specified, then rows that %s values are nulls will be skipped.", 2773 Values: []Element{Link("value"), Keyword("IGNORE"), Keyword("NULLS")}, 2774 }, 2775 }, 2776 { 2777 Name: "count", 2778 Group: []Grammar{ 2779 {Function{Name: "COUNT", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("integer")}}, 2780 {Function{Name: "COUNT", Args: []Element{Option{Keyword("DISTINCT")}, Keyword("*")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("integer")}}, 2781 }, 2782 Description: Description{ 2783 Template: "Returns the number of non-null values of %s.", 2784 Values: []Element{Link("value")}, 2785 }, 2786 }, 2787 { 2788 Name: "min", 2789 Group: []Grammar{ 2790 {Function{Name: "MIN", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("primitive type")}}, 2791 }, 2792 Description: Description{ 2793 Template: "Returns the minimum value of non-null values of %s. If all values are null, then returns %s.", 2794 Values: []Element{Link("value"), Null("NULL")}, 2795 }, 2796 }, 2797 { 2798 Name: "max", 2799 Group: []Grammar{ 2800 {Function{Name: "MAX", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("primitive type")}}, 2801 }, 2802 Description: Description{ 2803 Template: "Returns the maximum value of non-null values of %s. If all values are null, then returns %s.", 2804 Values: []Element{Link("value"), Null("NULL")}, 2805 }, 2806 }, 2807 { 2808 Name: "sum", 2809 Group: []Grammar{ 2810 {Function{Name: "SUM", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("float")}}, 2811 }, 2812 Description: Description{ 2813 Template: "Returns the sum of float values of %s. If all values are null, then returns %s.", 2814 Values: []Element{Link("value"), Null("NULL")}, 2815 }, 2816 }, 2817 { 2818 Name: "avg", 2819 Group: []Grammar{ 2820 {Function{Name: "AVG", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("float")}}, 2821 }, 2822 Description: Description{ 2823 Template: "Returns the average of float values of %s. If all values are null, then returns %s.", 2824 Values: []Element{Link("value"), Null("NULL")}, 2825 }, 2826 }, 2827 { 2828 Name: "stdev", 2829 Group: []Grammar{ 2830 {Function{Name: "STDEV", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("float")}}, 2831 }, 2832 Description: Description{ 2833 Template: "Returns the sample standard deviation of float values of %s. If all values are null, then returns %s.", 2834 Values: []Element{Link("value"), Null("NULL")}, 2835 }, 2836 }, 2837 { 2838 Name: "stdevp", 2839 Group: []Grammar{ 2840 {Function{Name: "STDEVP", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("float")}}, 2841 }, 2842 Description: Description{ 2843 Template: "Returns the population standard deviation of float values of %s. If all values are null, then returns %s.", 2844 Values: []Element{Link("value"), Null("NULL")}, 2845 }, 2846 }, 2847 { 2848 Name: "var", 2849 Group: []Grammar{ 2850 {Function{Name: "VAR", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("float")}}, 2851 }, 2852 Description: Description{ 2853 Template: "Returns the sample variance of float values of %s. If all values are null, then returns %s.", 2854 Values: []Element{Link("value"), Null("NULL")}, 2855 }, 2856 }, 2857 { 2858 Name: "varp", 2859 Group: []Grammar{ 2860 {Function{Name: "VARP", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("float")}}, 2861 }, 2862 Description: Description{ 2863 Template: "Returns the population variance of float values of %s. If all values are null, then returns %s.", 2864 Values: []Element{Link("value"), Null("NULL")}, 2865 }, 2866 }, 2867 { 2868 Name: "median", 2869 Group: []Grammar{ 2870 {Function{Name: "MEDIAN", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("float")}}, 2871 }, 2872 Description: Description{ 2873 Template: "Returns the sumedianm of float or datetime values of %s. If all values are null, then returns %s.\n" + 2874 "\n" + 2875 "Even if %s represents datetime values, this function returns a float or an integer value. " + 2876 "The return value can be converted to a datetime value by using the %s function.", 2877 Values: []Element{Link("value"), Null("NULL"), Link("value"), Keyword("DATETIME")}, 2878 }, 2879 }, 2880 { 2881 Name: "listagg", 2882 Group: []Grammar{ 2883 {Function{Name: "LISTAGG", Args: []Element{Option{Keyword("DISTINCT")}, Link("value"), Option{String("sep")}}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("string")}}, 2884 }, 2885 Description: Description{ 2886 Template: "Returns the string result with the concatenated non-null values of %s. If all values are null, then returns %s.\n" + 2887 "\n" + 2888 "%s is placed between values. Empty string is the default.", 2889 Values: []Element{Link("value"), Null("NULL"), String("sep")}, 2890 }, 2891 }, 2892 { 2893 Name: "json_agg", 2894 Group: []Grammar{ 2895 {Function{Name: "JSON_AGG", Args: []Element{Option{Keyword("DISTINCT")}, Link("value")}, AfterArgs: []Element{Keyword("OVER"), Parentheses{Option{Link("partition_clause")}, Option{Link("order_by_clause"), Option{Link("windowing_clause")}}}}, Return: Return("string")}}, 2896 }, 2897 Description: Description{ 2898 Template: "Returns the string formatted in JSON array of %s.", 2899 Values: []Element{Link("value")}, 2900 }, 2901 }, 2902 }, 2903 Children: []Expression{ 2904 { 2905 Label: "Partition Clause", 2906 Grammar: []Definition{ 2907 { 2908 Name: "partition_clause", 2909 Group: []Grammar{ 2910 {Keyword("PARTITION"), Keyword("BY"), ContinuousOption{Link("value")}}, 2911 }, 2912 }, 2913 }, 2914 }, 2915 { 2916 Label: "Windowing Clause", 2917 Grammar: []Definition{ 2918 { 2919 Name: "windowing_clause", 2920 Group: []Grammar{ 2921 {Keyword("ROWS"), Link("window_position")}, 2922 {Keyword("ROWS"), Keyword("BETWEEN"), Link("window_frame_low"), Keyword("AND"), Link("window_frame_high")}, 2923 }, 2924 }, 2925 { 2926 Name: "window_position", 2927 Group: []Grammar{ 2928 {Keyword("UNBOUNDED"), Keyword("PRECEDING")}, 2929 {Integer("offset"), Keyword("PRECEDING")}, 2930 {Keyword("CURRENT"), Keyword("ROW")}, 2931 }, 2932 }, 2933 { 2934 Name: "window_frame_low", 2935 Group: []Grammar{ 2936 {Keyword("UNBOUNDED"), Keyword("PRECEDING")}, 2937 {Integer("offset"), Keyword("PRECEDING")}, 2938 {Integer("offset"), Keyword("FOLLOWING")}, 2939 {Keyword("CURRENT"), Keyword("ROW")}, 2940 }, 2941 }, 2942 { 2943 Name: "window_frame_high", 2944 Group: []Grammar{ 2945 {Keyword("UNBOUNDED"), Keyword("FOLLOWING")}, 2946 {Integer("offset"), Keyword("PRECEDING")}, 2947 {Integer("offset"), Keyword("FOLLOWING")}, 2948 {Keyword("CURRENT"), Keyword("ROW")}, 2949 }, 2950 }, 2951 }, 2952 }, 2953 }, 2954 }, 2955 }, 2956 }, 2957 { 2958 Label: "Parsing", 2959 Grammar: []Definition{ 2960 { 2961 Name: "Tokens", 2962 Description: Description{ 2963 Template: "" + 2964 "%s\n" + 2965 " > An identifier is a word starting with any unicode letter or" + 2966 " a Low Line(U+005F _) and followed by a character string that" + 2967 " contains any unicode letters, any digits or Low Lines(U+005F _)." + 2968 " You cannot use %s as an identifier.\n" + 2969 "\n" + 2970 " > Notwithstanding above naming restriction, you can use most" + 2971 " character strings as an identifier by enclosing in" + 2972 " Grave Accents(U+0060 `) or Quotation Marks(U+0022 \") if" + 2973 " --ansi-quotes is specified. Enclosure characters are escaped by" + 2974 " back slashes or double enclosures.\n" + 2975 "\n" + 2976 " > Identifiers represent tables, columns, functions or cursors." + 2977 " Character case is insensitive except file paths, and whether file" + 2978 " paths are case insensitive or not depends on your file system.\n" + 2979 "\n" + 2980 "%s\n" + 2981 " > A string is a character string enclosed in Apostrophes(U+0027 ') or" + 2982 " Quotation Marks(U+0022 \") if --ansi-quotes is not specified." + 2983 " In a string, enclosure characters are escaped by back slashes or" + 2984 " double enclosures.\n" + 2985 "\n" + 2986 "%s\n" + 2987 " > An integer is a word that contains only [0-9].\n" + 2988 "\n" + 2989 "%s\n" + 2990 " > A float is a word that contains only [0-9] with a decimal point.\n" + 2991 "\n" + 2992 "%s\n" + 2993 " > A ternary is represented by any one keyword of TRUE, FALSE or" + 2994 " UNKNOWN.\n" + 2995 "\n" + 2996 "%s\n" + 2997 " > A datetime is a string formatted as datetime.\n" + 2998 "\n" + 2999 "%s\n" + 3000 " > A null is represented by a keyword NULL.\n" + 3001 "\n" + 3002 "%s\n" + 3003 " > A variable is a word starting with \"@\" and followed by a" + 3004 " character string that contains any unicode letters, any digits or" + 3005 " Low Lines(U+005F _).\n" + 3006 "\n" + 3007 "%s\n" + 3008 " > A flag is a word starting with \"@@\" and followed by a character" + 3009 " string that contains any unicode letters, any digits or" + 3010 " Low Lines(U+005F _). Character case is ignored.\n" + 3011 "\n" + 3012 "%s\n" + 3013 " > A environment variable is a word starting with \"@%%\" and followed" + 3014 " by a character string that contains any unicode letters, any digits" + 3015 " or Low Lines(U+005F _). If a environment variable includes other" + 3016 " characters, you can use the variable by enclosing" + 3017 " in Back Quotes(U+0060 `).\n" + 3018 "\n" + 3019 "%s\n" + 3020 " > A runtime information is a word starting with \"@#\" and followed" + 3021 " by a character string that contains any unicode letters, any digits" + 3022 " or Low Lines(U+005F _). Character case is ignored." + 3023 "\n" + 3024 "%s\n" + 3025 " > A system defined constant is a group of words represented by two" + 3026 " words separated by \"::\". Character case is ignored.", 3027 Values: []Element{ 3028 Identifier("Identifier"), 3029 Link("reserved words"), 3030 String("String"), 3031 Integer("Integer"), 3032 Float("Float"), 3033 Ternary("Ternary"), 3034 Datetime("Datetime"), 3035 Null("Null"), 3036 Variable("Variable"), 3037 Flag("Flag"), 3038 Variable("Environment Variable"), 3039 Variable("Runtime Information"), 3040 Variable("System Defined Constant"), 3041 }, 3042 }, 3043 }, 3044 { 3045 Name: "Comments", 3046 Description: Description{ 3047 Template: "" + 3048 "%s\n" + 3049 " > A single line comment starts with a string \"--\" and ends with a line-break character.\n" + 3050 "%s\n" + 3051 " > A block comment starts with a string \"/*\" and ends with a string \"*/\".", 3052 Values: []Element{ 3053 Name("Line Comment"), 3054 Name("Block Comment"), 3055 }, 3056 }, 3057 }, 3058 { 3059 Name: "Special Characters", 3060 Description: Description{ 3061 Template: "In command parameters and statements, following strings represent special characters.\n" + 3062 "\n" + 3063 "```\n" + 3064 " +----+-------------------------------------------+\n" + 3065 " | \\a | U+0007 Bell |\n" + 3066 " | \\b | U+0008 Backspace |\n" + 3067 " | \\f | U+000C Form Feed |\n" + 3068 " | \\n | U+000A Line Feed |\n" + 3069 " | \\r | U+000D Carriage Return |\n" + 3070 " | \\t | U+0009 Horizontal Tab |\n" + 3071 " | \\v | U+000b Vertical Tab |\n" + 3072 " | \\\" | U+0022 Double Quote |\n" + 3073 " | \\' | U+0027 Single Quote (in strings only) |\n" + 3074 " | \\` | U+0060 Grave Accent (in identifiers only) |\n" + 3075 " | \\\\ | U+005c Backslash |\n" + 3076 " +----+-------------------------------------------+\n" + 3077 "```", 3078 }, 3079 }, 3080 { 3081 Name: "Reserved Words", 3082 Description: Description{ 3083 Template: "" + 3084 "ABSOLUTE ADD AFTER AGGREGATE ALTER ALL AND ANY AS ASC AVG BEFORE BEGIN " + 3085 "BETWEEN BREAK BY CASE CHDIR CLOSE COMMIT CONTINUE COUNT CREATE CROSS " + 3086 "CSV_INLINE CUME_DIST CURRENT CURSOR DECLARE DEFAULT DELETE DENSE_RANK DESC DISPOSE " + 3087 "DISTINCT DO DROP DUAL ECHO ELSE ELSEIF END EXCEPT EXECUTE EXISTS " + 3088 "EXIT FALSE FETCH FIRST FIRST_VALUE FOLLOWING FOR FROM FULL FUNCTION " + 3089 "GROUP HAVING IF IGNORE IN INNER INSERT INTERSECT INTO IS JOIN JSONL " + 3090 "JSON_AGG JSON_INLINE JSON_OBJECT JSON_ROW JSON_TABLE LAG LAST LAST_VALUE LATERAL LEAD " + 3091 "LEFT LIKE LIMIT LISTAGG MAX MEDIAN MIN NATURAL NEXT NOT NTH_VALUE " + 3092 "NTILE NULL OFFSET ON ONLY OPEN OR ORDER OUTER OVER PARTITION PERCENT " + 3093 "PERCENT_RANK PRECEDING PREPARE PRINT PRINTF PRIOR PWD RANGE RANK RECURSIVE " + 3094 "RELATIVE RELOAD REMOVE RENAME REPLACE RETURN RIGHT ROLLBACK ROW ROW_NUMBER " + 3095 "SELECT SEPARATOR SET SHOW SOURCE STDEV STDEVP STDIN SUBSTRING SUM SYNTAX TABLE " + 3096 "THEN TO TRIGGER TRUE " + 3097 "UNBOUNDED UNION UNKNOWN UNSET UPDATE USING VALUES VAR VARP VIEW WHEN WHERE " + 3098 "WHILE WITH WITHIN", 3099 }, 3100 }, 3101 }, 3102 }, 3103 { 3104 Label: "Formatting", 3105 Grammar: []Definition{ 3106 { 3107 Name: "String Format Placeholders", 3108 Description: Description{ 3109 Template: "" + 3110 "%%[flag][width][.precision]specifier\n" + 3111 "\n" + 3112 "%s\n" + 3113 "```\n" + 3114 " +--------------------+--------------------------------------+\n" + 3115 " | + | Print a plus sign for numeric values |\n" + 3116 " | ' ' (U+0020 Space) | Print a space instead of a plus sign |\n" + 3117 " | - | Pad on the right |\n" + 3118 " | 0 | Pad with zeros |\n" + 3119 " +--------------------+--------------------------------------+\n" + 3120 "```\n" + 3121 "%s\n" + 3122 " > Width of the replaced string.\n" + 3123 "%s\n" + 3124 " > Number of digits after the decimal point for a float value, or max length for a string value.\n" + 3125 "%s\n" + 3126 "```\n" + 3127 " +---+-----------------------------------------------+\n" + 3128 " | b | Base 2 integer |\n" + 3129 " | o | Base 8 integer |\n" + 3130 " | d | Base 10 integer |\n" + 3131 " | x | Base 16 integer with lower cases |\n" + 3132 " | X | Base 16 integer with upper cases |\n" + 3133 " | e | Exponential notation with lower cases |\n" + 3134 " | E | Exponential notation with upper cases |\n" + 3135 " | f | Floating point decimal number |\n" + 3136 " | s | String representation of the value |\n" + 3137 " | q | Quoted string representation of the value |\n" + 3138 " | i | Quoted identifier representation of the value |\n" + 3139 " | T | Type of the value |\n" + 3140 " | %% | '%%' |\n" + 3141 " +---+-----------------------------------------------+\n" + 3142 "```", 3143 Values: []Element{ 3144 Name("flag"), 3145 Name("width"), 3146 Name("precision"), 3147 Name("specifier"), 3148 }, 3149 }, 3150 }, 3151 { 3152 Name: "Datetime Format Placeholders", 3153 Description: Description{ 3154 Template: "" + 3155 "```\n" + 3156 "+----+-------------------------------------------------------------+\n" + 3157 "| %%a | Abbreviation of week name (Sun, Mon, ...) |\n" + 3158 "| %%b | Abbreviation of month name (Jan, Feb, ...) |\n" + 3159 "| %%c | Month number (0 - 12) |\n" + 3160 "| %%d | Day of month in two digits (01 - 31) |\n" + 3161 "| %%E | Day of month padding with a underscore (_1 - 31) |\n" + 3162 "| %%e | Day of month (1 - 31) |\n" + 3163 "| %%F | Microseconds that drops trailing zeros (empty - .999999) |\n" + 3164 "| %%f | Microseconds (.000000 - .999999) |\n" + 3165 "| %%H | Hour in 24-hour (00 - 23) |\n" + 3166 "| %%h | Hour in two digits 12-hour (01 - 12) |\n" + 3167 "| %%i | Minute in two digits (00 - 59) |\n" + 3168 "| %%l | Hour in 12-hour (1 - 12) |\n" + 3169 "| %%M | Month name (January, February, ...) |\n" + 3170 "| %%m | Month number with two digits (01 - 12) |\n" + 3171 "| %%N | Nanoseconds that drops trailing zeros (empty - .999999999) |\n" + 3172 "| %%n | Nanoseconds (.000000000 - .999999999) |\n" + 3173 "| %%p | Period in a day (AM or PM) |\n" + 3174 "| %%r | Time with a period (%%H:%%i:%%s %%p) |\n" + 3175 "| %%s | Second in two digits (00 - 59) |\n" + 3176 "| %%T | Time (%%H:%%i:%%s) |\n" + 3177 "| %%W | Week name (Sunday, Monday, ...) |\n" + 3178 "| %%Y | Year in four digits |\n" + 3179 "| %%y | Year in two digits |\n" + 3180 "| %%Z | Time zone in time difference |\n" + 3181 "| %%z | Abbreviation of Time zone name |\n" + 3182 "| %%%% | '%%' |\n" + 3183 "+----+-------------------------------------------------------------+\n" + 3184 "```\n" + 3185 "\n" + 3186 "%s\n" + 3187 " > %s\n" + 3188 " > %s\n" + 3189 " > %s\n" + 3190 " > %s\n" + 3191 " > %s\n" + 3192 " > %s\n" + 3193 " > %s\n" + 3194 " > %s\n" + 3195 " > %s\n" + 3196 " > %s\n" + 3197 " > %s\n" + 3198 " > %s\n" + 3199 " > %s\n" + 3200 " > %s\n" + 3201 " > %s\n" + 3202 " > %s\n" + 3203 " > %s\n" + 3204 " > %s\n" + 3205 " > %s\n" + 3206 " > %s", 3207 Values: []Element{ 3208 Name("Preset Datetime Format"), 3209 String("%Y-%m-%d"), 3210 String("%Y/%m/%d"), 3211 String("%Y-%c-%e"), 3212 String("%Y/%c/%e"), 3213 String("%Y-%m-%d %T%N"), 3214 String("%Y/%m/%d %T%N"), 3215 String("%Y-%c-%e %T%N"), 3216 String("%Y/%c/%e %T%N"), 3217 String("%Y-%m-%d %T%N %Z"), 3218 String("%Y/%m/%d %T%N %Z"), 3219 String("%Y-%c-%e %T%N %Z"), 3220 String("%Y/%c/%e %T%N %Z"), 3221 String("%Y-%m-%d %T%N %z"), 3222 String("%Y/%m/%d %T%N %z"), 3223 String("%Y-%c-%e %T%N %z"), 3224 String("%Y/%c/%e %T%N %z"), 3225 String("%Y-%m-%dT%T%N"), 3226 String("%Y-%m-%dT%T%N%Z"), 3227 String("%m %b %y %H:%i %Z"), 3228 String("%m %b %y %H:%i %z"), 3229 }, 3230 }, 3231 }, 3232 }, 3233 }, 3234 { 3235 Label: "Flags of Regular Expressions", 3236 Description: Description{ 3237 Template: "" + 3238 "%s\n" + 3239 " > case-insensitive\n" + 3240 "%s\n" + 3241 " > multi-line mode\n" + 3242 "%s\n" + 3243 " > let . match \\n\n" + 3244 "%s\n" + 3245 " > swap meaning of x* and x*?, x+ and x+?, etc.\n" + 3246 "", 3247 Values: []Element{ 3248 String("i"), 3249 String("m"), 3250 String("s"), 3251 String("U"), 3252 }, 3253 }, 3254 }, 3255 { 3256 Label: "Parameters", 3257 Grammar: []Definition{ 3258 { 3259 Name: "Import Encoding", 3260 Description: Description{ 3261 Template: "" + 3262 "```\n" + 3263 "+----------+---------------------------------------------+\n" + 3264 "| Value | Character Encoding |\n" + 3265 "+----------+---------------------------------------------+\n" + 3266 "| AUTO | Detect encoding automatically |\n" + 3267 "| UTF8 | UTF-8. Detect BOM automatically |\n" + 3268 "| UTF8M | UTF-8 with BOM |\n" + 3269 "| UTF16 | UTF-16. Detect BOM and Endian automatically |\n" + 3270 "| UTF16BE | UTF-16 Big-Endian |\n" + 3271 "| UTF16LE | UTF-16 Little-Endian |\n" + 3272 "| UTF16BEM | UTF-16 Big-Endian with BOM |\n" + 3273 "| UTF16LEM | UTF-16 Little-Endian with BOM |\n" + 3274 "| SJIS | Shift_JIS |\n" + 3275 "+----------+---------------------------------------------+\n" + 3276 "```", 3277 }, 3278 }, 3279 { 3280 Name: "Export Encoding", 3281 Description: Description{ 3282 Template: "" + 3283 "```\n" + 3284 "+----------+----------------------------------+\n" + 3285 "| Value | Character Encoding |\n" + 3286 "+----------+----------------------------------+\n" + 3287 "| UTF8 | UTF-8 |\n" + 3288 "| UTF8M | UTF-8 with BOM |\n" + 3289 "| UTF16 | An alias of UTF16BE |\n" + 3290 "| UTF16BE | UTF-16 Big-Endian |\n" + 3291 "| UTF16LE | UTF-16 Little-Endian |\n" + 3292 "| UTF16BEM | UTF-16 Big-Endian with BOM |\n" + 3293 "| UTF16LEM | UTF-16 Little-Endian with BOM |\n" + 3294 "| SJIS | Shift_JIS |\n" + 3295 "+----------+----------------------------------+\n" + 3296 "```", 3297 }, 3298 }, 3299 { 3300 Name: "Line Break", 3301 Description: Description{ 3302 Template: "" + 3303 "```\n" + 3304 "+-------+----------------------------------------------+\n" + 3305 "| Value | Unicode Characters |\n" + 3306 "+-------+----------------------------------------------+\n" + 3307 "| CRLF | U+000D Carriage Return and U+000A Line Feed |\n" + 3308 "| CR | U+000D Carriage Return |\n" + 3309 "| LF | U+000A Line Feed |\n" + 3310 "+-------+----------------------------------------------+\n" + 3311 "```", 3312 }, 3313 }, 3314 { 3315 Name: "Format", 3316 Description: Description{ 3317 Template: "" + 3318 "```\n" + 3319 "+-------+------------------------------------------+\n" + 3320 "| Value | Format |\n" + 3321 "+-------+------------------------------------------+\n" + 3322 "| CSV | Character separated values |\n" + 3323 "| TSV | Tab separated values |\n" + 3324 "| FIXED | Fixed-Length Format |\n" + 3325 "| JSON | JSON Format |\n" + 3326 "| JSONL | JSON Lines Format |\n" + 3327 "| LTSV | Labeled Tab-separated Values |\n" + 3328 "| GFM | Text Table for GitHub Flavored Markdown |\n" + 3329 "| ORG | Text Table for Emacs Org-mode |\n" + 3330 "| BOX | Text Table using Box-drawing characters |\n" + 3331 "| TEXT | Text Table for console |\n" + 3332 "+-------+------------------------------------------+\n" + 3333 "```", 3334 }, 3335 }, 3336 { 3337 Name: "JSON Escape Type", 3338 Description: Description{ 3339 Template: "" + 3340 "```\n" + 3341 "+-----------+-------------------------------------------------------+\n" + 3342 "| Value | Description |\n" + 3343 "+-----------+-------------------------------------------------------+\n" + 3344 "| BACKSLASH | Escape special characters with Backslashes(U+005C \\) |\n" + 3345 "| HEX | Escape special characters with six-character sequence |\n" + 3346 "| HEXALL | Escape all strings with six-character sequence |\n" + 3347 "+-----------+-------------------------------------------------------+\n" + 3348 "```\n" + 3349 "\n" + 3350 "```\n" + 3351 " Escaped characters in JSON output\n" + 3352 "+------------------------+-----------+--------+-------------------+\n" + 3353 "| Character | BACKSLASH | HEX | HEXALL |\n" + 3354 "+------------------------+-----------+--------+-------------------+\n" + 3355 "| U+0022 Quotation Mark | \\\" | \\u0022 | \\u0022 |\n" + 3356 "| U+005C Backslash | \\\\ | \\u005C | \\u005C |\n" + 3357 "| U+002F Solidus | \\/ | \\u002F | \\u002F |\n" + 3358 "| U+0008 Backspace | \\b | \\u0008 | \\u0008 |\n" + 3359 "| U+000C Form Feed | \\f | \\u000C | \\u000C |\n" + 3360 "| U+000A Line Feed | \\n | \\u000A | \\u000A |\n" + 3361 "| U+000D Carriage Return | \\r | \\u000D | \\u000D |\n" + 3362 "| U+0009 Horizontal Tab | \\t | \\u0009 | \\u0009 |\n" + 3363 "| U+0000 - U+001F | \\uXXXX | \\uXXXX | \\uXXXX |\n" + 3364 "| - U+FFFF | N/A | N/A | \\uXXXX |\n" + 3365 "| U+10000 - | N/A | N/A | \\uXXXX\\uXXXX |\n" + 3366 "| | | | (Surrogate Pair) |\n" + 3367 "+------------------------+-----------+--------+-------------------+\n" + 3368 "```", 3369 }, 3370 }, 3371 { 3372 Name: "Timezone", 3373 Description: Description{ 3374 Template: "" + 3375 "%s, %s or a timezone name in the IANA TimeZone database(in the form of \"Area/Location\". e.g. \"America/Los_Angeles\").\n" + 3376 "\n" + 3377 "The timezone database is required in order to use the timezone names. " + 3378 "Most Unix-like systems provide the database. " + 3379 "But if your system does not provide it and you have not installed Go Lang, " + 3380 "then you must put the database file named zoneinfo.zip to the directory \"$ZONEINFO\" or \"$GOROOT/lib/time/\".", 3381 Values: []Element{ 3382 Keyword("Local"), 3383 Keyword("UTC"), 3384 }, 3385 }, 3386 }, 3387 }, 3388 }, 3389 }