github.com/team-ide/go-dialect@v1.9.20/vitess/sqlparser/constants.go (about) 1 /* 2 Copyright 2019 The Vitess Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package sqlparser 18 19 // String constants to be used in ast. 20 const ( 21 // Select.Distinct 22 AllStr = "all " 23 DistinctStr = "distinct " 24 StraightJoinHint = "straight_join " 25 SQLCalcFoundRowsStr = "sql_calc_found_rows " 26 27 // Select.Lock 28 NoLockStr = "" 29 ForUpdateStr = " for update" 30 ShareModeStr = " lock in share mode" 31 32 // Select.Cache 33 SQLCacheStr = "sql_cache " 34 SQLNoCacheStr = "sql_no_cache " 35 36 // Union.Type 37 UnionStr = "union" 38 UnionAllStr = "union all" 39 UnionDistinctStr = "union distinct" 40 41 // DDL strings. 42 InsertStr = "insert" 43 ReplaceStr = "replace" 44 45 // Set.Scope or Show.Scope 46 SessionStr = "session" 47 GlobalStr = "global" 48 VitessMetadataStr = "vitess_metadata" 49 VariableStr = "variable" 50 LocalStr = "local" 51 ImplicitStr = "" 52 53 // DDL strings. 54 CreateStr = "create" 55 AlterStr = "alter" 56 DropStr = "drop" 57 RenameStr = "rename" 58 TruncateStr = "truncate" 59 FlushStr = "flush" 60 CreateVindexStr = "create vindex" 61 DropVindexStr = "drop vindex" 62 AddVschemaTableStr = "add vschema table" 63 DropVschemaTableStr = "drop vschema table" 64 AddColVindexStr = "on table add vindex" 65 DropColVindexStr = "on table drop vindex" 66 AddSequenceStr = "add sequence" 67 AddAutoIncStr = "add auto_increment" 68 69 // Online DDL hint 70 OnlineStr = "online" 71 72 // Vindex DDL param to specify the owner of a vindex 73 VindexOwnerStr = "owner" 74 75 // Partition strings 76 ReorganizeStr = "reorganize partition" 77 AddStr = "add partition" 78 DiscardStr = "discard partition" 79 DropPartitionStr = "drop partition" 80 ImportStr = "import partition" 81 TruncatePartitionStr = "truncate partition" 82 CoalesceStr = "coalesce partition" 83 ExchangeStr = "exchange partition" 84 AnalyzePartitionStr = "analyze partition" 85 CheckStr = "check partition" 86 OptimizeStr = "optimize partition" 87 RebuildStr = "rebuild partition" 88 RepairStr = "repair partition" 89 RemoveStr = "remove partitioning" 90 UpgradeStr = "upgrade partitioning" 91 92 // JoinTableExpr.Join 93 JoinStr = "join" 94 StraightJoinStr = "straight_join" 95 LeftJoinStr = "left join" 96 RightJoinStr = "right join" 97 NaturalJoinStr = "natural join" 98 NaturalLeftJoinStr = "natural left join" 99 NaturalRightJoinStr = "natural right join" 100 101 // Index hints. 102 UseStr = "use " 103 IgnoreStr = "ignore " 104 ForceStr = "force " 105 106 // Where.Type 107 WhereStr = "where" 108 HavingStr = "having" 109 110 // ComparisonExpr.Operator 111 EqualStr = "=" 112 LessThanStr = "<" 113 GreaterThanStr = ">" 114 LessEqualStr = "<=" 115 GreaterEqualStr = ">=" 116 NotEqualStr = "!=" 117 NullSafeEqualStr = "<=>" 118 InStr = "in" 119 NotInStr = "not in" 120 LikeStr = "like" 121 NotLikeStr = "not like" 122 RegexpStr = "regexp" 123 NotRegexpStr = "not regexp" 124 125 // IsExpr.Operator 126 IsNullStr = "is null" 127 IsNotNullStr = "is not null" 128 IsTrueStr = "is true" 129 IsNotTrueStr = "is not true" 130 IsFalseStr = "is false" 131 IsNotFalseStr = "is not false" 132 133 // BinaryExpr.Operator 134 BitAndStr = "&" 135 BitOrStr = "|" 136 BitXorStr = "^" 137 PlusStr = "+" 138 MinusStr = "-" 139 MultStr = "*" 140 DivStr = "/" 141 IntDivStr = "div" 142 ModStr = "%" 143 ShiftLeftStr = "<<" 144 ShiftRightStr = ">>" 145 JSONExtractOpStr = "->" 146 JSONUnquoteExtractOpStr = "->>" 147 148 // UnaryExpr.Operator 149 UPlusStr = "+" 150 UMinusStr = "-" 151 TildaStr = "~" 152 BangStr = "!" 153 BinaryStr = "binary " 154 Armscii8Str = "_armscii8" 155 ASCIIStr = "_ascii" 156 Big5Str = "_big5" 157 UBinaryStr = "_binary" 158 Cp1250Str = "_cp1250" 159 Cp1251Str = "_cp1251" 160 Cp1256Str = "_cp1256" 161 Cp1257Str = "_cp1257" 162 Cp850Str = "_cp850" 163 Cp852Str = "_cp852" 164 Cp866Str = "_cp866" 165 Cp932Str = "_cp932" 166 Dec8Str = "_dec8" 167 EucjpmsStr = "_eucjpms" 168 EuckrStr = "_euckr" 169 Gb18030Str = "_gb18030" 170 Gb2312Str = "_gb2312" 171 GbkStr = "_gbk" 172 Geostd8Str = "_geostd8" 173 GreekStr = "_greek" 174 HebrewStr = "_hebrew" 175 Hp8Str = "_hp8" 176 Keybcs2Str = "_keybcs2" 177 Koi8rStr = "_koi8r" 178 Koi8uStr = "_koi8u" 179 Latin1Str = "_latin1" 180 Latin2Str = "_latin2" 181 Latin5Str = "_latin5" 182 Latin7Str = "_latin7" 183 MacceStr = "_macce" 184 MacromanStr = "_macroman" 185 SjisStr = "_sjis" 186 Swe7Str = "_swe7" 187 Tis620Str = "_tis620" 188 Ucs2Str = "_ucs2" 189 UjisStr = "_ujis" 190 Utf16Str = "_utf16" 191 Utf16leStr = "_utf16le" 192 Utf32Str = "_utf32" 193 Utf8Str = "_utf8" 194 Utf8mb4Str = "_utf8mb4" 195 NStringStr = "N" 196 197 // ConvertType.Operator 198 CharacterSetStr = " character set" 199 NoOperatorStr = "" 200 201 // CollateAndCharset.Type 202 CollateStr = " collate" 203 204 // MatchExpr.Option 205 NoOptionStr = "" 206 BooleanModeStr = " in boolean mode" 207 NaturalLanguageModeStr = " in natural language mode" 208 NaturalLanguageModeWithQueryExpansionStr = " in natural language mode with query expansion" 209 QueryExpansionStr = " with query expansion" 210 211 // INTO OUTFILE 212 IntoOutfileStr = " into outfile " 213 IntoOutfileS3Str = " into outfile s3 " 214 IntoDumpfileStr = " into dumpfile " 215 216 // Order.Direction 217 AscScr = "asc" 218 DescScr = "desc" 219 220 // SetExpr.Expr, for SET TRANSACTION ... or START TRANSACTION 221 // TransactionStr is the Name for a SET TRANSACTION statement 222 TransactionStr = "transaction" 223 224 // Transaction isolation levels 225 ReadUncommittedStr = "read uncommitted" 226 ReadCommittedStr = "read committed" 227 RepeatableReadStr = "repeatable read" 228 SerializableStr = "serializable" 229 230 TxReadOnly = "read only" 231 TxReadWrite = "read write" 232 233 // Explain formats 234 EmptyStr = "" 235 TreeStr = "tree" 236 JSONStr = "json" 237 VitessStr = "vitess" 238 TraditionalStr = "traditional" 239 AnalyzeStr = "analyze" 240 241 // Lock Types 242 ReadStr = "read" 243 ReadLocalStr = "read local" 244 WriteStr = "write" 245 LowPriorityWriteStr = "low_priority write" 246 247 // ShowCommand Types 248 CharsetStr = " charset" 249 CollationStr = " collation" 250 ColumnStr = " columns" 251 CreateDbStr = " create database" 252 CreateEStr = " create event" 253 CreateFStr = " create function" 254 CreateProcStr = " create procedure" 255 CreateTblStr = " create table" 256 CreateTrStr = " create trigger" 257 CreateVStr = " create view" 258 DatabaseStr = " databases" 259 FunctionCStr = " function code" 260 FunctionStr = " function status" 261 GtidExecGlobalStr = " global gtid_executed" 262 IndexStr = " indexes" 263 OpenTableStr = " open tables" 264 PrivilegeStr = " privileges" 265 ProcedureCStr = " procedure code" 266 ProcedureStr = " procedure status" 267 StatusGlobalStr = " global status" 268 StatusSessionStr = " status" 269 TableStr = " tables" 270 TableStatusStr = " table status" 271 TriggerStr = " triggers" 272 VariableGlobalStr = " global variables" 273 VariableSessionStr = " variables" 274 VGtidExecGlobalStr = " global vgtid_executed" 275 KeyspaceStr = " keyspaces" 276 VitessMigrationsStr = " vitess_migrations" 277 WarningsStr = " warnings" 278 279 // DropKeyType strings 280 PrimaryKeyTypeStr = "primary key" 281 ForeignKeyTypeStr = "foreign key" 282 NormalKeyTypeStr = "key" 283 284 // LockOptionType strings 285 NoneTypeStr = "none" 286 SharedTypeStr = "shared" 287 DefaultTypeStr = "default" 288 ExclusiveTypeStr = "exclusive" 289 290 // IntervalTypes strings 291 DayStr = "day" 292 WeekStr = "week" 293 MonthStr = "month" 294 YearStr = "year" 295 DayHourStr = "day_hour" 296 DayMicrosecondStr = "day_microsecond" 297 DayMinuteStr = "day_minute" 298 DaySecondStr = "day_second" 299 HourStr = "hour" 300 HourMicrosecondStr = "hour_microsecond" 301 HourMinuteStr = "hour_minute" 302 HourSecondStr = "hour_second" 303 MicrosecondStr = "microsecond" 304 MinuteStr = "minute" 305 MinuteMicrosecondStr = "minute_microsecond" 306 MinuteSecondStr = "minute_second" 307 QuarterStr = "quarter" 308 SecondStr = "second" 309 SecondMicrosecondStr = "second_microsecond" 310 YearMonthStr = "year_month" 311 ) 312 313 // Constants for Enum type - AccessMode 314 const ( 315 ReadOnly AccessMode = iota 316 ReadWrite 317 ) 318 319 //Constants for Enum type - IsolationLevel 320 const ( 321 ReadUncommitted IsolationLevel = iota 322 ReadCommitted 323 RepeatableRead 324 Serializable 325 ) 326 327 // Constants for Enum Type - Insert.Action 328 const ( 329 InsertAct InsertAction = iota 330 ReplaceAct 331 ) 332 333 // Constants for Enum Type - DDL.Action 334 const ( 335 CreateDDLAction DDLAction = iota 336 AlterDDLAction 337 DropDDLAction 338 RenameDDLAction 339 TruncateDDLAction 340 CreateVindexDDLAction 341 DropVindexDDLAction 342 AddVschemaTableDDLAction 343 DropVschemaTableDDLAction 344 AddColVindexDDLAction 345 DropColVindexDDLAction 346 AddSequenceDDLAction 347 AddAutoIncDDLAction 348 RevertDDLAction 349 ) 350 351 // Constants for Enum Type - Scope 352 const ( 353 ImplicitScope Scope = iota 354 SessionScope 355 GlobalScope 356 VitessMetadataScope 357 VariableScope 358 LocalScope 359 ) 360 361 // Constants for Enum Type - Lock 362 const ( 363 NoLock Lock = iota 364 ForUpdateLock 365 ShareModeLock 366 ) 367 368 // Constants for Enum Type - WhereType 369 const ( 370 WhereClause WhereType = iota 371 HavingClause 372 ) 373 374 // Constants for Enum Type - JoinType 375 const ( 376 NormalJoinType JoinType = iota 377 StraightJoinType 378 LeftJoinType 379 RightJoinType 380 NaturalJoinType 381 NaturalLeftJoinType 382 NaturalRightJoinType 383 ) 384 385 // Constants for Enum Type - ComparisonExprOperator 386 const ( 387 EqualOp ComparisonExprOperator = iota 388 LessThanOp 389 GreaterThanOp 390 LessEqualOp 391 GreaterEqualOp 392 NotEqualOp 393 NullSafeEqualOp 394 InOp 395 NotInOp 396 LikeOp 397 NotLikeOp 398 RegexpOp 399 NotRegexpOp 400 ) 401 402 // Constant for Enum Type - IsExprOperator 403 const ( 404 IsNullOp IsExprOperator = iota 405 IsNotNullOp 406 IsTrueOp 407 IsNotTrueOp 408 IsFalseOp 409 IsNotFalseOp 410 ) 411 412 // Constant for Enum Type - BinaryExprOperator 413 const ( 414 BitAndOp BinaryExprOperator = iota 415 BitOrOp 416 BitXorOp 417 PlusOp 418 MinusOp 419 MultOp 420 DivOp 421 IntDivOp 422 ModOp 423 ShiftLeftOp 424 ShiftRightOp 425 JSONExtractOp 426 JSONUnquoteExtractOp 427 ) 428 429 // Constant for Enum Type - UnaryExprOperator 430 const ( 431 UPlusOp UnaryExprOperator = iota 432 UMinusOp 433 TildaOp 434 BangOp 435 BinaryOp 436 NStringOp 437 ) 438 439 // Constant for Enum Type - MatchExprOption 440 const ( 441 NoOption MatchExprOption = iota 442 BooleanModeOpt 443 NaturalLanguageModeOpt 444 NaturalLanguageModeWithQueryExpansionOpt 445 QueryExpansionOpt 446 ) 447 448 // Constant for Enum Type - OrderDirection 449 const ( 450 AscOrder OrderDirection = iota 451 DescOrder 452 ) 453 454 // Constant for Enum Type - ConvertTypeOperator 455 const ( 456 NoOperator ConvertTypeOperator = iota 457 CharacterSetOp 458 ) 459 460 // Constant for Enum Type - IndexHintsType 461 const ( 462 UseOp IndexHintsType = iota 463 IgnoreOp 464 ForceOp 465 ) 466 467 // Constant for Enum Type - PartitionSpecAction 468 const ( 469 ReorganizeAction PartitionSpecAction = iota 470 AddAction 471 DiscardAction 472 DropAction 473 ImportAction 474 TruncateAction 475 CoalesceAction 476 ExchangeAction 477 AnalyzeAction 478 CheckAction 479 OptimizeAction 480 RebuildAction 481 RepairAction 482 RemoveAction 483 UpgradeAction 484 ) 485 486 // Constant for Enum Type - ExplainType 487 const ( 488 EmptyType ExplainType = iota 489 TreeType 490 JSONType 491 VitessType 492 TraditionalType 493 AnalyzeType 494 ) 495 496 // Constant for Enum Type - SelectIntoType 497 const ( 498 IntoOutfile SelectIntoType = iota 499 IntoOutfileS3 500 IntoDumpfile 501 ) 502 503 // Constant for Enum Type - CollateAndCharsetType 504 const ( 505 CollateType CollateAndCharsetType = iota 506 CharacterSetType 507 ) 508 509 // LockType constants 510 const ( 511 UnknownLockType LockType = iota 512 Read 513 ReadLocal 514 Write 515 LowPriorityWrite 516 ) 517 518 // ShowCommandType constants 519 const ( 520 UnknownCommandType ShowCommandType = iota 521 Charset 522 Collation 523 Column 524 CreateDb 525 CreateE 526 CreateF 527 CreateProc 528 CreateTbl 529 CreateTr 530 CreateV 531 Database 532 FunctionC 533 Function 534 GtidExecGlobal 535 Index 536 OpenTable 537 Privilege 538 ProcedureC 539 Procedure 540 StatusGlobal 541 StatusSession 542 Table 543 TableStatus 544 Trigger 545 VariableGlobal 546 VariableSession 547 VGtidExecGlobal 548 VitessMigrations 549 Warnings 550 Keyspace 551 ) 552 553 // DropKeyType constants 554 const ( 555 PrimaryKeyType DropKeyType = iota 556 ForeignKeyType 557 NormalKeyType 558 ) 559 560 // LockOptionType constants 561 const ( 562 DefaultType LockOptionType = iota 563 NoneType 564 SharedType 565 ExclusiveType 566 ) 567 568 // AlterMigrationType constants 569 const ( 570 RetryMigrationType AlterMigrationType = iota 571 CompleteMigrationType 572 CancelMigrationType 573 CancelAllMigrationType 574 CleanupMigrationType 575 ) 576 577 // ColumnStorage constants 578 const ( 579 VirtualStorage ColumnStorage = iota 580 StoredStorage 581 ) 582 583 // IntervalTypes constants 584 const ( 585 IntervalYear IntervalTypes = iota 586 IntervalQuarter 587 IntervalMonth 588 IntervalWeek 589 IntervalDay 590 IntervalHour 591 IntervalMinute 592 IntervalSecond 593 IntervalMicrosecond 594 IntervalYearMonth 595 IntervalDayHour 596 IntervalDayMinute 597 IntervalDaySecond 598 IntervalHourMinute 599 IntervalHourSecond 600 IntervalMinuteSecond 601 IntervalDayMicrosecond 602 IntervalHourMicrosecond 603 IntervalMinuteMicrosecond 604 IntervalSecondMicrosecond 605 )