github.com/vedadiyan/sqlparser@v1.0.0/pkg/sqlparser/ast_equals.go (about) 1 /* 2 Copyright 2023 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 // Code generated by ASTHelperGen. DO NOT EDIT. 17 18 package sqlparser 19 20 // SQLNode does deep equals between the two objects. 21 func (cmp *Comparator) SQLNode(inA, inB SQLNode) bool { 22 if inA == nil && inB == nil { 23 return true 24 } 25 if inA == nil || inB == nil { 26 return false 27 } 28 switch a := inA.(type) { 29 case *AddColumns: 30 b, ok := inB.(*AddColumns) 31 if !ok { 32 return false 33 } 34 return cmp.RefOfAddColumns(a, b) 35 case *AddConstraintDefinition: 36 b, ok := inB.(*AddConstraintDefinition) 37 if !ok { 38 return false 39 } 40 return cmp.RefOfAddConstraintDefinition(a, b) 41 case *AddIndexDefinition: 42 b, ok := inB.(*AddIndexDefinition) 43 if !ok { 44 return false 45 } 46 return cmp.RefOfAddIndexDefinition(a, b) 47 case AlgorithmValue: 48 b, ok := inB.(AlgorithmValue) 49 if !ok { 50 return false 51 } 52 return a == b 53 case *AliasedExpr: 54 b, ok := inB.(*AliasedExpr) 55 if !ok { 56 return false 57 } 58 return cmp.RefOfAliasedExpr(a, b) 59 case *AliasedTableExpr: 60 b, ok := inB.(*AliasedTableExpr) 61 if !ok { 62 return false 63 } 64 return cmp.RefOfAliasedTableExpr(a, b) 65 case *AlterCharset: 66 b, ok := inB.(*AlterCharset) 67 if !ok { 68 return false 69 } 70 return cmp.RefOfAlterCharset(a, b) 71 case *AlterCheck: 72 b, ok := inB.(*AlterCheck) 73 if !ok { 74 return false 75 } 76 return cmp.RefOfAlterCheck(a, b) 77 case *AlterColumn: 78 b, ok := inB.(*AlterColumn) 79 if !ok { 80 return false 81 } 82 return cmp.RefOfAlterColumn(a, b) 83 case *AlterDatabase: 84 b, ok := inB.(*AlterDatabase) 85 if !ok { 86 return false 87 } 88 return cmp.RefOfAlterDatabase(a, b) 89 case *AlterIndex: 90 b, ok := inB.(*AlterIndex) 91 if !ok { 92 return false 93 } 94 return cmp.RefOfAlterIndex(a, b) 95 case *AlterMigration: 96 b, ok := inB.(*AlterMigration) 97 if !ok { 98 return false 99 } 100 return cmp.RefOfAlterMigration(a, b) 101 case *AlterTable: 102 b, ok := inB.(*AlterTable) 103 if !ok { 104 return false 105 } 106 return cmp.RefOfAlterTable(a, b) 107 case *AlterView: 108 b, ok := inB.(*AlterView) 109 if !ok { 110 return false 111 } 112 return cmp.RefOfAlterView(a, b) 113 case *AlterVschema: 114 b, ok := inB.(*AlterVschema) 115 if !ok { 116 return false 117 } 118 return cmp.RefOfAlterVschema(a, b) 119 case *AndExpr: 120 b, ok := inB.(*AndExpr) 121 if !ok { 122 return false 123 } 124 return cmp.RefOfAndExpr(a, b) 125 case Argument: 126 b, ok := inB.(Argument) 127 if !ok { 128 return false 129 } 130 return a == b 131 case *ArgumentLessWindowExpr: 132 b, ok := inB.(*ArgumentLessWindowExpr) 133 if !ok { 134 return false 135 } 136 return cmp.RefOfArgumentLessWindowExpr(a, b) 137 case *AutoIncSpec: 138 b, ok := inB.(*AutoIncSpec) 139 if !ok { 140 return false 141 } 142 return cmp.RefOfAutoIncSpec(a, b) 143 case *Avg: 144 b, ok := inB.(*Avg) 145 if !ok { 146 return false 147 } 148 return cmp.RefOfAvg(a, b) 149 case *Begin: 150 b, ok := inB.(*Begin) 151 if !ok { 152 return false 153 } 154 return cmp.RefOfBegin(a, b) 155 case *BetweenExpr: 156 b, ok := inB.(*BetweenExpr) 157 if !ok { 158 return false 159 } 160 return cmp.RefOfBetweenExpr(a, b) 161 case *BinaryExpr: 162 b, ok := inB.(*BinaryExpr) 163 if !ok { 164 return false 165 } 166 return cmp.RefOfBinaryExpr(a, b) 167 case *BitAnd: 168 b, ok := inB.(*BitAnd) 169 if !ok { 170 return false 171 } 172 return cmp.RefOfBitAnd(a, b) 173 case *BitOr: 174 b, ok := inB.(*BitOr) 175 if !ok { 176 return false 177 } 178 return cmp.RefOfBitOr(a, b) 179 case *BitXor: 180 b, ok := inB.(*BitXor) 181 if !ok { 182 return false 183 } 184 return cmp.RefOfBitXor(a, b) 185 case BoolVal: 186 b, ok := inB.(BoolVal) 187 if !ok { 188 return false 189 } 190 return a == b 191 case *CallProc: 192 b, ok := inB.(*CallProc) 193 if !ok { 194 return false 195 } 196 return cmp.RefOfCallProc(a, b) 197 case *CaseExpr: 198 b, ok := inB.(*CaseExpr) 199 if !ok { 200 return false 201 } 202 return cmp.RefOfCaseExpr(a, b) 203 case *CastExpr: 204 b, ok := inB.(*CastExpr) 205 if !ok { 206 return false 207 } 208 return cmp.RefOfCastExpr(a, b) 209 case *ChangeColumn: 210 b, ok := inB.(*ChangeColumn) 211 if !ok { 212 return false 213 } 214 return cmp.RefOfChangeColumn(a, b) 215 case *CharExpr: 216 b, ok := inB.(*CharExpr) 217 if !ok { 218 return false 219 } 220 return cmp.RefOfCharExpr(a, b) 221 case *CheckConstraintDefinition: 222 b, ok := inB.(*CheckConstraintDefinition) 223 if !ok { 224 return false 225 } 226 return cmp.RefOfCheckConstraintDefinition(a, b) 227 case *ColName: 228 b, ok := inB.(*ColName) 229 if !ok { 230 return false 231 } 232 return cmp.RefOfColName(a, b) 233 case *CollateExpr: 234 b, ok := inB.(*CollateExpr) 235 if !ok { 236 return false 237 } 238 return cmp.RefOfCollateExpr(a, b) 239 case *ColumnDefinition: 240 b, ok := inB.(*ColumnDefinition) 241 if !ok { 242 return false 243 } 244 return cmp.RefOfColumnDefinition(a, b) 245 case *ColumnType: 246 b, ok := inB.(*ColumnType) 247 if !ok { 248 return false 249 } 250 return cmp.RefOfColumnType(a, b) 251 case Columns: 252 b, ok := inB.(Columns) 253 if !ok { 254 return false 255 } 256 return cmp.Columns(a, b) 257 case *CommentOnly: 258 b, ok := inB.(*CommentOnly) 259 if !ok { 260 return false 261 } 262 return cmp.RefOfCommentOnly(a, b) 263 case *Commit: 264 b, ok := inB.(*Commit) 265 if !ok { 266 return false 267 } 268 return cmp.RefOfCommit(a, b) 269 case *CommonTableExpr: 270 b, ok := inB.(*CommonTableExpr) 271 if !ok { 272 return false 273 } 274 return cmp.RefOfCommonTableExpr(a, b) 275 case *ComparisonExpr: 276 b, ok := inB.(*ComparisonExpr) 277 if !ok { 278 return false 279 } 280 return cmp.RefOfComparisonExpr(a, b) 281 case *ConstraintDefinition: 282 b, ok := inB.(*ConstraintDefinition) 283 if !ok { 284 return false 285 } 286 return cmp.RefOfConstraintDefinition(a, b) 287 case *ConvertExpr: 288 b, ok := inB.(*ConvertExpr) 289 if !ok { 290 return false 291 } 292 return cmp.RefOfConvertExpr(a, b) 293 case *ConvertType: 294 b, ok := inB.(*ConvertType) 295 if !ok { 296 return false 297 } 298 return cmp.RefOfConvertType(a, b) 299 case *ConvertUsingExpr: 300 b, ok := inB.(*ConvertUsingExpr) 301 if !ok { 302 return false 303 } 304 return cmp.RefOfConvertUsingExpr(a, b) 305 case *Count: 306 b, ok := inB.(*Count) 307 if !ok { 308 return false 309 } 310 return cmp.RefOfCount(a, b) 311 case *CountStar: 312 b, ok := inB.(*CountStar) 313 if !ok { 314 return false 315 } 316 return cmp.RefOfCountStar(a, b) 317 case *CreateDatabase: 318 b, ok := inB.(*CreateDatabase) 319 if !ok { 320 return false 321 } 322 return cmp.RefOfCreateDatabase(a, b) 323 case *CreateTable: 324 b, ok := inB.(*CreateTable) 325 if !ok { 326 return false 327 } 328 return cmp.RefOfCreateTable(a, b) 329 case *CreateView: 330 b, ok := inB.(*CreateView) 331 if !ok { 332 return false 333 } 334 return cmp.RefOfCreateView(a, b) 335 case *CurTimeFuncExpr: 336 b, ok := inB.(*CurTimeFuncExpr) 337 if !ok { 338 return false 339 } 340 return cmp.RefOfCurTimeFuncExpr(a, b) 341 case *DeallocateStmt: 342 b, ok := inB.(*DeallocateStmt) 343 if !ok { 344 return false 345 } 346 return cmp.RefOfDeallocateStmt(a, b) 347 case *Default: 348 b, ok := inB.(*Default) 349 if !ok { 350 return false 351 } 352 return cmp.RefOfDefault(a, b) 353 case *Definer: 354 b, ok := inB.(*Definer) 355 if !ok { 356 return false 357 } 358 return cmp.RefOfDefiner(a, b) 359 case *Delete: 360 b, ok := inB.(*Delete) 361 if !ok { 362 return false 363 } 364 return cmp.RefOfDelete(a, b) 365 case *DerivedTable: 366 b, ok := inB.(*DerivedTable) 367 if !ok { 368 return false 369 } 370 return cmp.RefOfDerivedTable(a, b) 371 case *DropColumn: 372 b, ok := inB.(*DropColumn) 373 if !ok { 374 return false 375 } 376 return cmp.RefOfDropColumn(a, b) 377 case *DropDatabase: 378 b, ok := inB.(*DropDatabase) 379 if !ok { 380 return false 381 } 382 return cmp.RefOfDropDatabase(a, b) 383 case *DropKey: 384 b, ok := inB.(*DropKey) 385 if !ok { 386 return false 387 } 388 return cmp.RefOfDropKey(a, b) 389 case *DropTable: 390 b, ok := inB.(*DropTable) 391 if !ok { 392 return false 393 } 394 return cmp.RefOfDropTable(a, b) 395 case *DropView: 396 b, ok := inB.(*DropView) 397 if !ok { 398 return false 399 } 400 return cmp.RefOfDropView(a, b) 401 case *ExecuteStmt: 402 b, ok := inB.(*ExecuteStmt) 403 if !ok { 404 return false 405 } 406 return cmp.RefOfExecuteStmt(a, b) 407 case *ExistsExpr: 408 b, ok := inB.(*ExistsExpr) 409 if !ok { 410 return false 411 } 412 return cmp.RefOfExistsExpr(a, b) 413 case *ExplainStmt: 414 b, ok := inB.(*ExplainStmt) 415 if !ok { 416 return false 417 } 418 return cmp.RefOfExplainStmt(a, b) 419 case *ExplainTab: 420 b, ok := inB.(*ExplainTab) 421 if !ok { 422 return false 423 } 424 return cmp.RefOfExplainTab(a, b) 425 case Exprs: 426 b, ok := inB.(Exprs) 427 if !ok { 428 return false 429 } 430 return cmp.Exprs(a, b) 431 case *ExtractFuncExpr: 432 b, ok := inB.(*ExtractFuncExpr) 433 if !ok { 434 return false 435 } 436 return cmp.RefOfExtractFuncExpr(a, b) 437 case *ExtractValueExpr: 438 b, ok := inB.(*ExtractValueExpr) 439 if !ok { 440 return false 441 } 442 return cmp.RefOfExtractValueExpr(a, b) 443 case *ExtractedSubquery: 444 b, ok := inB.(*ExtractedSubquery) 445 if !ok { 446 return false 447 } 448 return cmp.RefOfExtractedSubquery(a, b) 449 case *FirstOrLastValueExpr: 450 b, ok := inB.(*FirstOrLastValueExpr) 451 if !ok { 452 return false 453 } 454 return cmp.RefOfFirstOrLastValueExpr(a, b) 455 case *Flush: 456 b, ok := inB.(*Flush) 457 if !ok { 458 return false 459 } 460 return cmp.RefOfFlush(a, b) 461 case *Force: 462 b, ok := inB.(*Force) 463 if !ok { 464 return false 465 } 466 return cmp.RefOfForce(a, b) 467 case *ForeignKeyDefinition: 468 b, ok := inB.(*ForeignKeyDefinition) 469 if !ok { 470 return false 471 } 472 return cmp.RefOfForeignKeyDefinition(a, b) 473 case *FrameClause: 474 b, ok := inB.(*FrameClause) 475 if !ok { 476 return false 477 } 478 return cmp.RefOfFrameClause(a, b) 479 case *FramePoint: 480 b, ok := inB.(*FramePoint) 481 if !ok { 482 return false 483 } 484 return cmp.RefOfFramePoint(a, b) 485 case *FromFirstLastClause: 486 b, ok := inB.(*FromFirstLastClause) 487 if !ok { 488 return false 489 } 490 return cmp.RefOfFromFirstLastClause(a, b) 491 case *FuncExpr: 492 b, ok := inB.(*FuncExpr) 493 if !ok { 494 return false 495 } 496 return cmp.RefOfFuncExpr(a, b) 497 case *GTIDFuncExpr: 498 b, ok := inB.(*GTIDFuncExpr) 499 if !ok { 500 return false 501 } 502 return cmp.RefOfGTIDFuncExpr(a, b) 503 case GroupBy: 504 b, ok := inB.(GroupBy) 505 if !ok { 506 return false 507 } 508 return cmp.GroupBy(a, b) 509 case *GroupConcatExpr: 510 b, ok := inB.(*GroupConcatExpr) 511 if !ok { 512 return false 513 } 514 return cmp.RefOfGroupConcatExpr(a, b) 515 case IdentifierCI: 516 b, ok := inB.(IdentifierCI) 517 if !ok { 518 return false 519 } 520 return cmp.IdentifierCI(a, b) 521 case IdentifierCS: 522 b, ok := inB.(IdentifierCS) 523 if !ok { 524 return false 525 } 526 return cmp.IdentifierCS(a, b) 527 case *IndexDefinition: 528 b, ok := inB.(*IndexDefinition) 529 if !ok { 530 return false 531 } 532 return cmp.RefOfIndexDefinition(a, b) 533 case *IndexHint: 534 b, ok := inB.(*IndexHint) 535 if !ok { 536 return false 537 } 538 return cmp.RefOfIndexHint(a, b) 539 case IndexHints: 540 b, ok := inB.(IndexHints) 541 if !ok { 542 return false 543 } 544 return cmp.IndexHints(a, b) 545 case *IndexInfo: 546 b, ok := inB.(*IndexInfo) 547 if !ok { 548 return false 549 } 550 return cmp.RefOfIndexInfo(a, b) 551 case *Insert: 552 b, ok := inB.(*Insert) 553 if !ok { 554 return false 555 } 556 return cmp.RefOfInsert(a, b) 557 case *InsertExpr: 558 b, ok := inB.(*InsertExpr) 559 if !ok { 560 return false 561 } 562 return cmp.RefOfInsertExpr(a, b) 563 case *IntervalExpr: 564 b, ok := inB.(*IntervalExpr) 565 if !ok { 566 return false 567 } 568 return cmp.RefOfIntervalExpr(a, b) 569 case *IntervalFuncExpr: 570 b, ok := inB.(*IntervalFuncExpr) 571 if !ok { 572 return false 573 } 574 return cmp.RefOfIntervalFuncExpr(a, b) 575 case *IntroducerExpr: 576 b, ok := inB.(*IntroducerExpr) 577 if !ok { 578 return false 579 } 580 return cmp.RefOfIntroducerExpr(a, b) 581 case *IsExpr: 582 b, ok := inB.(*IsExpr) 583 if !ok { 584 return false 585 } 586 return cmp.RefOfIsExpr(a, b) 587 case *JSONArrayExpr: 588 b, ok := inB.(*JSONArrayExpr) 589 if !ok { 590 return false 591 } 592 return cmp.RefOfJSONArrayExpr(a, b) 593 case *JSONAttributesExpr: 594 b, ok := inB.(*JSONAttributesExpr) 595 if !ok { 596 return false 597 } 598 return cmp.RefOfJSONAttributesExpr(a, b) 599 case *JSONContainsExpr: 600 b, ok := inB.(*JSONContainsExpr) 601 if !ok { 602 return false 603 } 604 return cmp.RefOfJSONContainsExpr(a, b) 605 case *JSONContainsPathExpr: 606 b, ok := inB.(*JSONContainsPathExpr) 607 if !ok { 608 return false 609 } 610 return cmp.RefOfJSONContainsPathExpr(a, b) 611 case *JSONExtractExpr: 612 b, ok := inB.(*JSONExtractExpr) 613 if !ok { 614 return false 615 } 616 return cmp.RefOfJSONExtractExpr(a, b) 617 case *JSONKeysExpr: 618 b, ok := inB.(*JSONKeysExpr) 619 if !ok { 620 return false 621 } 622 return cmp.RefOfJSONKeysExpr(a, b) 623 case *JSONObjectExpr: 624 b, ok := inB.(*JSONObjectExpr) 625 if !ok { 626 return false 627 } 628 return cmp.RefOfJSONObjectExpr(a, b) 629 case *JSONObjectParam: 630 b, ok := inB.(*JSONObjectParam) 631 if !ok { 632 return false 633 } 634 return cmp.RefOfJSONObjectParam(a, b) 635 case *JSONOverlapsExpr: 636 b, ok := inB.(*JSONOverlapsExpr) 637 if !ok { 638 return false 639 } 640 return cmp.RefOfJSONOverlapsExpr(a, b) 641 case *JSONPrettyExpr: 642 b, ok := inB.(*JSONPrettyExpr) 643 if !ok { 644 return false 645 } 646 return cmp.RefOfJSONPrettyExpr(a, b) 647 case *JSONQuoteExpr: 648 b, ok := inB.(*JSONQuoteExpr) 649 if !ok { 650 return false 651 } 652 return cmp.RefOfJSONQuoteExpr(a, b) 653 case *JSONRemoveExpr: 654 b, ok := inB.(*JSONRemoveExpr) 655 if !ok { 656 return false 657 } 658 return cmp.RefOfJSONRemoveExpr(a, b) 659 case *JSONSchemaValidFuncExpr: 660 b, ok := inB.(*JSONSchemaValidFuncExpr) 661 if !ok { 662 return false 663 } 664 return cmp.RefOfJSONSchemaValidFuncExpr(a, b) 665 case *JSONSchemaValidationReportFuncExpr: 666 b, ok := inB.(*JSONSchemaValidationReportFuncExpr) 667 if !ok { 668 return false 669 } 670 return cmp.RefOfJSONSchemaValidationReportFuncExpr(a, b) 671 case *JSONSearchExpr: 672 b, ok := inB.(*JSONSearchExpr) 673 if !ok { 674 return false 675 } 676 return cmp.RefOfJSONSearchExpr(a, b) 677 case *JSONStorageFreeExpr: 678 b, ok := inB.(*JSONStorageFreeExpr) 679 if !ok { 680 return false 681 } 682 return cmp.RefOfJSONStorageFreeExpr(a, b) 683 case *JSONStorageSizeExpr: 684 b, ok := inB.(*JSONStorageSizeExpr) 685 if !ok { 686 return false 687 } 688 return cmp.RefOfJSONStorageSizeExpr(a, b) 689 case *JSONTableExpr: 690 b, ok := inB.(*JSONTableExpr) 691 if !ok { 692 return false 693 } 694 return cmp.RefOfJSONTableExpr(a, b) 695 case *JSONUnquoteExpr: 696 b, ok := inB.(*JSONUnquoteExpr) 697 if !ok { 698 return false 699 } 700 return cmp.RefOfJSONUnquoteExpr(a, b) 701 case *JSONValueExpr: 702 b, ok := inB.(*JSONValueExpr) 703 if !ok { 704 return false 705 } 706 return cmp.RefOfJSONValueExpr(a, b) 707 case *JSONValueMergeExpr: 708 b, ok := inB.(*JSONValueMergeExpr) 709 if !ok { 710 return false 711 } 712 return cmp.RefOfJSONValueMergeExpr(a, b) 713 case *JSONValueModifierExpr: 714 b, ok := inB.(*JSONValueModifierExpr) 715 if !ok { 716 return false 717 } 718 return cmp.RefOfJSONValueModifierExpr(a, b) 719 case *JoinCondition: 720 b, ok := inB.(*JoinCondition) 721 if !ok { 722 return false 723 } 724 return cmp.RefOfJoinCondition(a, b) 725 case *JoinTableExpr: 726 b, ok := inB.(*JoinTableExpr) 727 if !ok { 728 return false 729 } 730 return cmp.RefOfJoinTableExpr(a, b) 731 case *JtColumnDefinition: 732 b, ok := inB.(*JtColumnDefinition) 733 if !ok { 734 return false 735 } 736 return cmp.RefOfJtColumnDefinition(a, b) 737 case *JtOnResponse: 738 b, ok := inB.(*JtOnResponse) 739 if !ok { 740 return false 741 } 742 return cmp.RefOfJtOnResponse(a, b) 743 case *KeyState: 744 b, ok := inB.(*KeyState) 745 if !ok { 746 return false 747 } 748 return cmp.RefOfKeyState(a, b) 749 case *LagLeadExpr: 750 b, ok := inB.(*LagLeadExpr) 751 if !ok { 752 return false 753 } 754 return cmp.RefOfLagLeadExpr(a, b) 755 case *Limit: 756 b, ok := inB.(*Limit) 757 if !ok { 758 return false 759 } 760 return cmp.RefOfLimit(a, b) 761 case *LineStringExpr: 762 b, ok := inB.(*LineStringExpr) 763 if !ok { 764 return false 765 } 766 return cmp.RefOfLineStringExpr(a, b) 767 case ListArg: 768 b, ok := inB.(ListArg) 769 if !ok { 770 return false 771 } 772 return a == b 773 case *Literal: 774 b, ok := inB.(*Literal) 775 if !ok { 776 return false 777 } 778 return cmp.RefOfLiteral(a, b) 779 case *Load: 780 b, ok := inB.(*Load) 781 if !ok { 782 return false 783 } 784 return cmp.RefOfLoad(a, b) 785 case *LocateExpr: 786 b, ok := inB.(*LocateExpr) 787 if !ok { 788 return false 789 } 790 return cmp.RefOfLocateExpr(a, b) 791 case *LockOption: 792 b, ok := inB.(*LockOption) 793 if !ok { 794 return false 795 } 796 return cmp.RefOfLockOption(a, b) 797 case *LockTables: 798 b, ok := inB.(*LockTables) 799 if !ok { 800 return false 801 } 802 return cmp.RefOfLockTables(a, b) 803 case *LockingFunc: 804 b, ok := inB.(*LockingFunc) 805 if !ok { 806 return false 807 } 808 return cmp.RefOfLockingFunc(a, b) 809 case MatchAction: 810 b, ok := inB.(MatchAction) 811 if !ok { 812 return false 813 } 814 return a == b 815 case *MatchExpr: 816 b, ok := inB.(*MatchExpr) 817 if !ok { 818 return false 819 } 820 return cmp.RefOfMatchExpr(a, b) 821 case *Max: 822 b, ok := inB.(*Max) 823 if !ok { 824 return false 825 } 826 return cmp.RefOfMax(a, b) 827 case *MemberOfExpr: 828 b, ok := inB.(*MemberOfExpr) 829 if !ok { 830 return false 831 } 832 return cmp.RefOfMemberOfExpr(a, b) 833 case *Min: 834 b, ok := inB.(*Min) 835 if !ok { 836 return false 837 } 838 return cmp.RefOfMin(a, b) 839 case *ModifyColumn: 840 b, ok := inB.(*ModifyColumn) 841 if !ok { 842 return false 843 } 844 return cmp.RefOfModifyColumn(a, b) 845 case *NTHValueExpr: 846 b, ok := inB.(*NTHValueExpr) 847 if !ok { 848 return false 849 } 850 return cmp.RefOfNTHValueExpr(a, b) 851 case *NamedWindow: 852 b, ok := inB.(*NamedWindow) 853 if !ok { 854 return false 855 } 856 return cmp.RefOfNamedWindow(a, b) 857 case NamedWindows: 858 b, ok := inB.(NamedWindows) 859 if !ok { 860 return false 861 } 862 return cmp.NamedWindows(a, b) 863 case *Nextval: 864 b, ok := inB.(*Nextval) 865 if !ok { 866 return false 867 } 868 return cmp.RefOfNextval(a, b) 869 case *NotExpr: 870 b, ok := inB.(*NotExpr) 871 if !ok { 872 return false 873 } 874 return cmp.RefOfNotExpr(a, b) 875 case *NtileExpr: 876 b, ok := inB.(*NtileExpr) 877 if !ok { 878 return false 879 } 880 return cmp.RefOfNtileExpr(a, b) 881 case *NullTreatmentClause: 882 b, ok := inB.(*NullTreatmentClause) 883 if !ok { 884 return false 885 } 886 return cmp.RefOfNullTreatmentClause(a, b) 887 case *NullVal: 888 b, ok := inB.(*NullVal) 889 if !ok { 890 return false 891 } 892 return cmp.RefOfNullVal(a, b) 893 case *Offset: 894 b, ok := inB.(*Offset) 895 if !ok { 896 return false 897 } 898 return cmp.RefOfOffset(a, b) 899 case OnDup: 900 b, ok := inB.(OnDup) 901 if !ok { 902 return false 903 } 904 return cmp.OnDup(a, b) 905 case *OptLike: 906 b, ok := inB.(*OptLike) 907 if !ok { 908 return false 909 } 910 return cmp.RefOfOptLike(a, b) 911 case *OrExpr: 912 b, ok := inB.(*OrExpr) 913 if !ok { 914 return false 915 } 916 return cmp.RefOfOrExpr(a, b) 917 case *Order: 918 b, ok := inB.(*Order) 919 if !ok { 920 return false 921 } 922 return cmp.RefOfOrder(a, b) 923 case OrderBy: 924 b, ok := inB.(OrderBy) 925 if !ok { 926 return false 927 } 928 return cmp.OrderBy(a, b) 929 case *OrderByOption: 930 b, ok := inB.(*OrderByOption) 931 if !ok { 932 return false 933 } 934 return cmp.RefOfOrderByOption(a, b) 935 case *OtherAdmin: 936 b, ok := inB.(*OtherAdmin) 937 if !ok { 938 return false 939 } 940 return cmp.RefOfOtherAdmin(a, b) 941 case *OtherRead: 942 b, ok := inB.(*OtherRead) 943 if !ok { 944 return false 945 } 946 return cmp.RefOfOtherRead(a, b) 947 case *OverClause: 948 b, ok := inB.(*OverClause) 949 if !ok { 950 return false 951 } 952 return cmp.RefOfOverClause(a, b) 953 case *ParenTableExpr: 954 b, ok := inB.(*ParenTableExpr) 955 if !ok { 956 return false 957 } 958 return cmp.RefOfParenTableExpr(a, b) 959 case *ParsedComments: 960 b, ok := inB.(*ParsedComments) 961 if !ok { 962 return false 963 } 964 return cmp.RefOfParsedComments(a, b) 965 case *PartitionDefinition: 966 b, ok := inB.(*PartitionDefinition) 967 if !ok { 968 return false 969 } 970 return cmp.RefOfPartitionDefinition(a, b) 971 case *PartitionDefinitionOptions: 972 b, ok := inB.(*PartitionDefinitionOptions) 973 if !ok { 974 return false 975 } 976 return cmp.RefOfPartitionDefinitionOptions(a, b) 977 case *PartitionEngine: 978 b, ok := inB.(*PartitionEngine) 979 if !ok { 980 return false 981 } 982 return cmp.RefOfPartitionEngine(a, b) 983 case *PartitionOption: 984 b, ok := inB.(*PartitionOption) 985 if !ok { 986 return false 987 } 988 return cmp.RefOfPartitionOption(a, b) 989 case *PartitionSpec: 990 b, ok := inB.(*PartitionSpec) 991 if !ok { 992 return false 993 } 994 return cmp.RefOfPartitionSpec(a, b) 995 case *PartitionValueRange: 996 b, ok := inB.(*PartitionValueRange) 997 if !ok { 998 return false 999 } 1000 return cmp.RefOfPartitionValueRange(a, b) 1001 case Partitions: 1002 b, ok := inB.(Partitions) 1003 if !ok { 1004 return false 1005 } 1006 return cmp.Partitions(a, b) 1007 case *PerformanceSchemaFuncExpr: 1008 b, ok := inB.(*PerformanceSchemaFuncExpr) 1009 if !ok { 1010 return false 1011 } 1012 return cmp.RefOfPerformanceSchemaFuncExpr(a, b) 1013 case *PointExpr: 1014 b, ok := inB.(*PointExpr) 1015 if !ok { 1016 return false 1017 } 1018 return cmp.RefOfPointExpr(a, b) 1019 case *PrepareStmt: 1020 b, ok := inB.(*PrepareStmt) 1021 if !ok { 1022 return false 1023 } 1024 return cmp.RefOfPrepareStmt(a, b) 1025 case ReferenceAction: 1026 b, ok := inB.(ReferenceAction) 1027 if !ok { 1028 return false 1029 } 1030 return a == b 1031 case *ReferenceDefinition: 1032 b, ok := inB.(*ReferenceDefinition) 1033 if !ok { 1034 return false 1035 } 1036 return cmp.RefOfReferenceDefinition(a, b) 1037 case *RegexpInstrExpr: 1038 b, ok := inB.(*RegexpInstrExpr) 1039 if !ok { 1040 return false 1041 } 1042 return cmp.RefOfRegexpInstrExpr(a, b) 1043 case *RegexpLikeExpr: 1044 b, ok := inB.(*RegexpLikeExpr) 1045 if !ok { 1046 return false 1047 } 1048 return cmp.RefOfRegexpLikeExpr(a, b) 1049 case *RegexpReplaceExpr: 1050 b, ok := inB.(*RegexpReplaceExpr) 1051 if !ok { 1052 return false 1053 } 1054 return cmp.RefOfRegexpReplaceExpr(a, b) 1055 case *RegexpSubstrExpr: 1056 b, ok := inB.(*RegexpSubstrExpr) 1057 if !ok { 1058 return false 1059 } 1060 return cmp.RefOfRegexpSubstrExpr(a, b) 1061 case *Release: 1062 b, ok := inB.(*Release) 1063 if !ok { 1064 return false 1065 } 1066 return cmp.RefOfRelease(a, b) 1067 case *RenameColumn: 1068 b, ok := inB.(*RenameColumn) 1069 if !ok { 1070 return false 1071 } 1072 return cmp.RefOfRenameColumn(a, b) 1073 case *RenameIndex: 1074 b, ok := inB.(*RenameIndex) 1075 if !ok { 1076 return false 1077 } 1078 return cmp.RefOfRenameIndex(a, b) 1079 case *RenameTable: 1080 b, ok := inB.(*RenameTable) 1081 if !ok { 1082 return false 1083 } 1084 return cmp.RefOfRenameTable(a, b) 1085 case *RenameTableName: 1086 b, ok := inB.(*RenameTableName) 1087 if !ok { 1088 return false 1089 } 1090 return cmp.RefOfRenameTableName(a, b) 1091 case *RevertMigration: 1092 b, ok := inB.(*RevertMigration) 1093 if !ok { 1094 return false 1095 } 1096 return cmp.RefOfRevertMigration(a, b) 1097 case *Rollback: 1098 b, ok := inB.(*Rollback) 1099 if !ok { 1100 return false 1101 } 1102 return cmp.RefOfRollback(a, b) 1103 case RootNode: 1104 b, ok := inB.(RootNode) 1105 if !ok { 1106 return false 1107 } 1108 return cmp.RootNode(a, b) 1109 case *SRollback: 1110 b, ok := inB.(*SRollback) 1111 if !ok { 1112 return false 1113 } 1114 return cmp.RefOfSRollback(a, b) 1115 case *Savepoint: 1116 b, ok := inB.(*Savepoint) 1117 if !ok { 1118 return false 1119 } 1120 return cmp.RefOfSavepoint(a, b) 1121 case *Select: 1122 b, ok := inB.(*Select) 1123 if !ok { 1124 return false 1125 } 1126 return cmp.RefOfSelect(a, b) 1127 case SelectExprs: 1128 b, ok := inB.(SelectExprs) 1129 if !ok { 1130 return false 1131 } 1132 return cmp.SelectExprs(a, b) 1133 case *SelectInto: 1134 b, ok := inB.(*SelectInto) 1135 if !ok { 1136 return false 1137 } 1138 return cmp.RefOfSelectInto(a, b) 1139 case *Set: 1140 b, ok := inB.(*Set) 1141 if !ok { 1142 return false 1143 } 1144 return cmp.RefOfSet(a, b) 1145 case *SetExpr: 1146 b, ok := inB.(*SetExpr) 1147 if !ok { 1148 return false 1149 } 1150 return cmp.RefOfSetExpr(a, b) 1151 case SetExprs: 1152 b, ok := inB.(SetExprs) 1153 if !ok { 1154 return false 1155 } 1156 return cmp.SetExprs(a, b) 1157 case *Show: 1158 b, ok := inB.(*Show) 1159 if !ok { 1160 return false 1161 } 1162 return cmp.RefOfShow(a, b) 1163 case *ShowBasic: 1164 b, ok := inB.(*ShowBasic) 1165 if !ok { 1166 return false 1167 } 1168 return cmp.RefOfShowBasic(a, b) 1169 case *ShowCreate: 1170 b, ok := inB.(*ShowCreate) 1171 if !ok { 1172 return false 1173 } 1174 return cmp.RefOfShowCreate(a, b) 1175 case *ShowFilter: 1176 b, ok := inB.(*ShowFilter) 1177 if !ok { 1178 return false 1179 } 1180 return cmp.RefOfShowFilter(a, b) 1181 case *ShowMigrationLogs: 1182 b, ok := inB.(*ShowMigrationLogs) 1183 if !ok { 1184 return false 1185 } 1186 return cmp.RefOfShowMigrationLogs(a, b) 1187 case *ShowOther: 1188 b, ok := inB.(*ShowOther) 1189 if !ok { 1190 return false 1191 } 1192 return cmp.RefOfShowOther(a, b) 1193 case *ShowThrottledApps: 1194 b, ok := inB.(*ShowThrottledApps) 1195 if !ok { 1196 return false 1197 } 1198 return cmp.RefOfShowThrottledApps(a, b) 1199 case *ShowThrottlerStatus: 1200 b, ok := inB.(*ShowThrottlerStatus) 1201 if !ok { 1202 return false 1203 } 1204 return cmp.RefOfShowThrottlerStatus(a, b) 1205 case *StarExpr: 1206 b, ok := inB.(*StarExpr) 1207 if !ok { 1208 return false 1209 } 1210 return cmp.RefOfStarExpr(a, b) 1211 case *Std: 1212 b, ok := inB.(*Std) 1213 if !ok { 1214 return false 1215 } 1216 return cmp.RefOfStd(a, b) 1217 case *StdDev: 1218 b, ok := inB.(*StdDev) 1219 if !ok { 1220 return false 1221 } 1222 return cmp.RefOfStdDev(a, b) 1223 case *StdPop: 1224 b, ok := inB.(*StdPop) 1225 if !ok { 1226 return false 1227 } 1228 return cmp.RefOfStdPop(a, b) 1229 case *StdSamp: 1230 b, ok := inB.(*StdSamp) 1231 if !ok { 1232 return false 1233 } 1234 return cmp.RefOfStdSamp(a, b) 1235 case *Stream: 1236 b, ok := inB.(*Stream) 1237 if !ok { 1238 return false 1239 } 1240 return cmp.RefOfStream(a, b) 1241 case *SubPartition: 1242 b, ok := inB.(*SubPartition) 1243 if !ok { 1244 return false 1245 } 1246 return cmp.RefOfSubPartition(a, b) 1247 case *SubPartitionDefinition: 1248 b, ok := inB.(*SubPartitionDefinition) 1249 if !ok { 1250 return false 1251 } 1252 return cmp.RefOfSubPartitionDefinition(a, b) 1253 case *SubPartitionDefinitionOptions: 1254 b, ok := inB.(*SubPartitionDefinitionOptions) 1255 if !ok { 1256 return false 1257 } 1258 return cmp.RefOfSubPartitionDefinitionOptions(a, b) 1259 case SubPartitionDefinitions: 1260 b, ok := inB.(SubPartitionDefinitions) 1261 if !ok { 1262 return false 1263 } 1264 return cmp.SubPartitionDefinitions(a, b) 1265 case *Subquery: 1266 b, ok := inB.(*Subquery) 1267 if !ok { 1268 return false 1269 } 1270 return cmp.RefOfSubquery(a, b) 1271 case *SubstrExpr: 1272 b, ok := inB.(*SubstrExpr) 1273 if !ok { 1274 return false 1275 } 1276 return cmp.RefOfSubstrExpr(a, b) 1277 case *Sum: 1278 b, ok := inB.(*Sum) 1279 if !ok { 1280 return false 1281 } 1282 return cmp.RefOfSum(a, b) 1283 case TableExprs: 1284 b, ok := inB.(TableExprs) 1285 if !ok { 1286 return false 1287 } 1288 return cmp.TableExprs(a, b) 1289 case TableName: 1290 b, ok := inB.(TableName) 1291 if !ok { 1292 return false 1293 } 1294 return cmp.TableName(a, b) 1295 case TableNames: 1296 b, ok := inB.(TableNames) 1297 if !ok { 1298 return false 1299 } 1300 return cmp.TableNames(a, b) 1301 case TableOptions: 1302 b, ok := inB.(TableOptions) 1303 if !ok { 1304 return false 1305 } 1306 return cmp.TableOptions(a, b) 1307 case *TableSpec: 1308 b, ok := inB.(*TableSpec) 1309 if !ok { 1310 return false 1311 } 1312 return cmp.RefOfTableSpec(a, b) 1313 case *TablespaceOperation: 1314 b, ok := inB.(*TablespaceOperation) 1315 if !ok { 1316 return false 1317 } 1318 return cmp.RefOfTablespaceOperation(a, b) 1319 case *TimestampFuncExpr: 1320 b, ok := inB.(*TimestampFuncExpr) 1321 if !ok { 1322 return false 1323 } 1324 return cmp.RefOfTimestampFuncExpr(a, b) 1325 case *TrimFuncExpr: 1326 b, ok := inB.(*TrimFuncExpr) 1327 if !ok { 1328 return false 1329 } 1330 return cmp.RefOfTrimFuncExpr(a, b) 1331 case *TruncateTable: 1332 b, ok := inB.(*TruncateTable) 1333 if !ok { 1334 return false 1335 } 1336 return cmp.RefOfTruncateTable(a, b) 1337 case *UnaryExpr: 1338 b, ok := inB.(*UnaryExpr) 1339 if !ok { 1340 return false 1341 } 1342 return cmp.RefOfUnaryExpr(a, b) 1343 case *Union: 1344 b, ok := inB.(*Union) 1345 if !ok { 1346 return false 1347 } 1348 return cmp.RefOfUnion(a, b) 1349 case *UnlockTables: 1350 b, ok := inB.(*UnlockTables) 1351 if !ok { 1352 return false 1353 } 1354 return cmp.RefOfUnlockTables(a, b) 1355 case *Update: 1356 b, ok := inB.(*Update) 1357 if !ok { 1358 return false 1359 } 1360 return cmp.RefOfUpdate(a, b) 1361 case *UpdateExpr: 1362 b, ok := inB.(*UpdateExpr) 1363 if !ok { 1364 return false 1365 } 1366 return cmp.RefOfUpdateExpr(a, b) 1367 case UpdateExprs: 1368 b, ok := inB.(UpdateExprs) 1369 if !ok { 1370 return false 1371 } 1372 return cmp.UpdateExprs(a, b) 1373 case *UpdateXMLExpr: 1374 b, ok := inB.(*UpdateXMLExpr) 1375 if !ok { 1376 return false 1377 } 1378 return cmp.RefOfUpdateXMLExpr(a, b) 1379 case *Use: 1380 b, ok := inB.(*Use) 1381 if !ok { 1382 return false 1383 } 1384 return cmp.RefOfUse(a, b) 1385 case *VExplainStmt: 1386 b, ok := inB.(*VExplainStmt) 1387 if !ok { 1388 return false 1389 } 1390 return cmp.RefOfVExplainStmt(a, b) 1391 case *VStream: 1392 b, ok := inB.(*VStream) 1393 if !ok { 1394 return false 1395 } 1396 return cmp.RefOfVStream(a, b) 1397 case ValTuple: 1398 b, ok := inB.(ValTuple) 1399 if !ok { 1400 return false 1401 } 1402 return cmp.ValTuple(a, b) 1403 case *Validation: 1404 b, ok := inB.(*Validation) 1405 if !ok { 1406 return false 1407 } 1408 return cmp.RefOfValidation(a, b) 1409 case Values: 1410 b, ok := inB.(Values) 1411 if !ok { 1412 return false 1413 } 1414 return cmp.Values(a, b) 1415 case *ValuesFuncExpr: 1416 b, ok := inB.(*ValuesFuncExpr) 1417 if !ok { 1418 return false 1419 } 1420 return cmp.RefOfValuesFuncExpr(a, b) 1421 case *VarPop: 1422 b, ok := inB.(*VarPop) 1423 if !ok { 1424 return false 1425 } 1426 return cmp.RefOfVarPop(a, b) 1427 case *VarSamp: 1428 b, ok := inB.(*VarSamp) 1429 if !ok { 1430 return false 1431 } 1432 return cmp.RefOfVarSamp(a, b) 1433 case *Variable: 1434 b, ok := inB.(*Variable) 1435 if !ok { 1436 return false 1437 } 1438 return cmp.RefOfVariable(a, b) 1439 case *Variance: 1440 b, ok := inB.(*Variance) 1441 if !ok { 1442 return false 1443 } 1444 return cmp.RefOfVariance(a, b) 1445 case VindexParam: 1446 b, ok := inB.(VindexParam) 1447 if !ok { 1448 return false 1449 } 1450 return cmp.VindexParam(a, b) 1451 case *VindexSpec: 1452 b, ok := inB.(*VindexSpec) 1453 if !ok { 1454 return false 1455 } 1456 return cmp.RefOfVindexSpec(a, b) 1457 case *WeightStringFuncExpr: 1458 b, ok := inB.(*WeightStringFuncExpr) 1459 if !ok { 1460 return false 1461 } 1462 return cmp.RefOfWeightStringFuncExpr(a, b) 1463 case *When: 1464 b, ok := inB.(*When) 1465 if !ok { 1466 return false 1467 } 1468 return cmp.RefOfWhen(a, b) 1469 case *Where: 1470 b, ok := inB.(*Where) 1471 if !ok { 1472 return false 1473 } 1474 return cmp.RefOfWhere(a, b) 1475 case *WindowDefinition: 1476 b, ok := inB.(*WindowDefinition) 1477 if !ok { 1478 return false 1479 } 1480 return cmp.RefOfWindowDefinition(a, b) 1481 case WindowDefinitions: 1482 b, ok := inB.(WindowDefinitions) 1483 if !ok { 1484 return false 1485 } 1486 return cmp.WindowDefinitions(a, b) 1487 case *WindowSpecification: 1488 b, ok := inB.(*WindowSpecification) 1489 if !ok { 1490 return false 1491 } 1492 return cmp.RefOfWindowSpecification(a, b) 1493 case *With: 1494 b, ok := inB.(*With) 1495 if !ok { 1496 return false 1497 } 1498 return cmp.RefOfWith(a, b) 1499 case *XorExpr: 1500 b, ok := inB.(*XorExpr) 1501 if !ok { 1502 return false 1503 } 1504 return cmp.RefOfXorExpr(a, b) 1505 default: 1506 // this should never happen 1507 return false 1508 } 1509 } 1510 1511 // RefOfAddColumns does deep equals between the two objects. 1512 func (cmp *Comparator) RefOfAddColumns(a, b *AddColumns) bool { 1513 if a == b { 1514 return true 1515 } 1516 if a == nil || b == nil { 1517 return false 1518 } 1519 return a.First == b.First && 1520 cmp.SliceOfRefOfColumnDefinition(a.Columns, b.Columns) && 1521 cmp.RefOfColName(a.After, b.After) 1522 } 1523 1524 // RefOfAddConstraintDefinition does deep equals between the two objects. 1525 func (cmp *Comparator) RefOfAddConstraintDefinition(a, b *AddConstraintDefinition) bool { 1526 if a == b { 1527 return true 1528 } 1529 if a == nil || b == nil { 1530 return false 1531 } 1532 return cmp.RefOfConstraintDefinition(a.ConstraintDefinition, b.ConstraintDefinition) 1533 } 1534 1535 // RefOfAddIndexDefinition does deep equals between the two objects. 1536 func (cmp *Comparator) RefOfAddIndexDefinition(a, b *AddIndexDefinition) bool { 1537 if a == b { 1538 return true 1539 } 1540 if a == nil || b == nil { 1541 return false 1542 } 1543 return cmp.RefOfIndexDefinition(a.IndexDefinition, b.IndexDefinition) 1544 } 1545 1546 // RefOfAliasedExpr does deep equals between the two objects. 1547 func (cmp *Comparator) RefOfAliasedExpr(a, b *AliasedExpr) bool { 1548 if a == b { 1549 return true 1550 } 1551 if a == nil || b == nil { 1552 return false 1553 } 1554 return cmp.Expr(a.Expr, b.Expr) && 1555 cmp.IdentifierCI(a.As, b.As) 1556 } 1557 1558 // RefOfAliasedTableExpr does deep equals between the two objects. 1559 func (cmp *Comparator) RefOfAliasedTableExpr(a, b *AliasedTableExpr) bool { 1560 if a == b { 1561 return true 1562 } 1563 if a == nil || b == nil { 1564 return false 1565 } 1566 return cmp.SimpleTableExpr(a.Expr, b.Expr) && 1567 cmp.Partitions(a.Partitions, b.Partitions) && 1568 cmp.IdentifierCS(a.As, b.As) && 1569 cmp.IndexHints(a.Hints, b.Hints) && 1570 cmp.Columns(a.Columns, b.Columns) 1571 } 1572 1573 // RefOfAlterCharset does deep equals between the two objects. 1574 func (cmp *Comparator) RefOfAlterCharset(a, b *AlterCharset) bool { 1575 if a == b { 1576 return true 1577 } 1578 if a == nil || b == nil { 1579 return false 1580 } 1581 return a.CharacterSet == b.CharacterSet && 1582 a.Collate == b.Collate 1583 } 1584 1585 // RefOfAlterCheck does deep equals between the two objects. 1586 func (cmp *Comparator) RefOfAlterCheck(a, b *AlterCheck) bool { 1587 if a == b { 1588 return true 1589 } 1590 if a == nil || b == nil { 1591 return false 1592 } 1593 return a.Enforced == b.Enforced && 1594 cmp.IdentifierCI(a.Name, b.Name) 1595 } 1596 1597 // RefOfAlterColumn does deep equals between the two objects. 1598 func (cmp *Comparator) RefOfAlterColumn(a, b *AlterColumn) bool { 1599 if a == b { 1600 return true 1601 } 1602 if a == nil || b == nil { 1603 return false 1604 } 1605 return a.DropDefault == b.DropDefault && 1606 cmp.RefOfColName(a.Column, b.Column) && 1607 cmp.Expr(a.DefaultVal, b.DefaultVal) && 1608 cmp.RefOfBool(a.Invisible, b.Invisible) 1609 } 1610 1611 // RefOfAlterDatabase does deep equals between the two objects. 1612 func (cmp *Comparator) RefOfAlterDatabase(a, b *AlterDatabase) bool { 1613 if a == b { 1614 return true 1615 } 1616 if a == nil || b == nil { 1617 return false 1618 } 1619 return a.UpdateDataDirectory == b.UpdateDataDirectory && 1620 a.FullyParsed == b.FullyParsed && 1621 cmp.IdentifierCS(a.DBName, b.DBName) && 1622 cmp.SliceOfDatabaseOption(a.AlterOptions, b.AlterOptions) 1623 } 1624 1625 // RefOfAlterIndex does deep equals between the two objects. 1626 func (cmp *Comparator) RefOfAlterIndex(a, b *AlterIndex) bool { 1627 if a == b { 1628 return true 1629 } 1630 if a == nil || b == nil { 1631 return false 1632 } 1633 return a.Invisible == b.Invisible && 1634 cmp.IdentifierCI(a.Name, b.Name) 1635 } 1636 1637 // RefOfAlterMigration does deep equals between the two objects. 1638 func (cmp *Comparator) RefOfAlterMigration(a, b *AlterMigration) bool { 1639 if a == b { 1640 return true 1641 } 1642 if a == nil || b == nil { 1643 return false 1644 } 1645 return a.UUID == b.UUID && 1646 a.Expire == b.Expire && 1647 a.Shards == b.Shards && 1648 a.Type == b.Type && 1649 cmp.RefOfLiteral(a.Ratio, b.Ratio) 1650 } 1651 1652 // RefOfAlterTable does deep equals between the two objects. 1653 func (cmp *Comparator) RefOfAlterTable(a, b *AlterTable) bool { 1654 if a == b { 1655 return true 1656 } 1657 if a == nil || b == nil { 1658 return false 1659 } 1660 return a.FullyParsed == b.FullyParsed && 1661 cmp.TableName(a.Table, b.Table) && 1662 cmp.SliceOfAlterOption(a.AlterOptions, b.AlterOptions) && 1663 cmp.RefOfPartitionSpec(a.PartitionSpec, b.PartitionSpec) && 1664 cmp.RefOfPartitionOption(a.PartitionOption, b.PartitionOption) && 1665 cmp.RefOfParsedComments(a.Comments, b.Comments) 1666 } 1667 1668 // RefOfAlterView does deep equals between the two objects. 1669 func (cmp *Comparator) RefOfAlterView(a, b *AlterView) bool { 1670 if a == b { 1671 return true 1672 } 1673 if a == nil || b == nil { 1674 return false 1675 } 1676 return a.Algorithm == b.Algorithm && 1677 a.Security == b.Security && 1678 a.CheckOption == b.CheckOption && 1679 cmp.TableName(a.ViewName, b.ViewName) && 1680 cmp.RefOfDefiner(a.Definer, b.Definer) && 1681 cmp.Columns(a.Columns, b.Columns) && 1682 cmp.SelectStatement(a.Select, b.Select) && 1683 cmp.RefOfParsedComments(a.Comments, b.Comments) 1684 } 1685 1686 // RefOfAlterVschema does deep equals between the two objects. 1687 func (cmp *Comparator) RefOfAlterVschema(a, b *AlterVschema) bool { 1688 if a == b { 1689 return true 1690 } 1691 if a == nil || b == nil { 1692 return false 1693 } 1694 return a.Action == b.Action && 1695 cmp.TableName(a.Table, b.Table) && 1696 cmp.RefOfVindexSpec(a.VindexSpec, b.VindexSpec) && 1697 cmp.SliceOfIdentifierCI(a.VindexCols, b.VindexCols) && 1698 cmp.RefOfAutoIncSpec(a.AutoIncSpec, b.AutoIncSpec) 1699 } 1700 1701 // RefOfAndExpr does deep equals between the two objects. 1702 func (cmp *Comparator) RefOfAndExpr(a, b *AndExpr) bool { 1703 if a == b { 1704 return true 1705 } 1706 if a == nil || b == nil { 1707 return false 1708 } 1709 return cmp.Expr(a.Left, b.Left) && 1710 cmp.Expr(a.Right, b.Right) 1711 } 1712 1713 // RefOfArgumentLessWindowExpr does deep equals between the two objects. 1714 func (cmp *Comparator) RefOfArgumentLessWindowExpr(a, b *ArgumentLessWindowExpr) bool { 1715 if a == b { 1716 return true 1717 } 1718 if a == nil || b == nil { 1719 return false 1720 } 1721 return a.Type == b.Type && 1722 cmp.RefOfOverClause(a.OverClause, b.OverClause) 1723 } 1724 1725 // RefOfAutoIncSpec does deep equals between the two objects. 1726 func (cmp *Comparator) RefOfAutoIncSpec(a, b *AutoIncSpec) bool { 1727 if a == b { 1728 return true 1729 } 1730 if a == nil || b == nil { 1731 return false 1732 } 1733 return cmp.IdentifierCI(a.Column, b.Column) && 1734 cmp.TableName(a.Sequence, b.Sequence) 1735 } 1736 1737 // RefOfAvg does deep equals between the two objects. 1738 func (cmp *Comparator) RefOfAvg(a, b *Avg) bool { 1739 if a == b { 1740 return true 1741 } 1742 if a == nil || b == nil { 1743 return false 1744 } 1745 return a.Distinct == b.Distinct && 1746 cmp.Expr(a.Arg, b.Arg) 1747 } 1748 1749 // RefOfBegin does deep equals between the two objects. 1750 func (cmp *Comparator) RefOfBegin(a, b *Begin) bool { 1751 if a == b { 1752 return true 1753 } 1754 if a == nil || b == nil { 1755 return false 1756 } 1757 return cmp.SliceOfTxAccessMode(a.TxAccessModes, b.TxAccessModes) 1758 } 1759 1760 // RefOfBetweenExpr does deep equals between the two objects. 1761 func (cmp *Comparator) RefOfBetweenExpr(a, b *BetweenExpr) bool { 1762 if a == b { 1763 return true 1764 } 1765 if a == nil || b == nil { 1766 return false 1767 } 1768 return a.IsBetween == b.IsBetween && 1769 cmp.Expr(a.Left, b.Left) && 1770 cmp.Expr(a.From, b.From) && 1771 cmp.Expr(a.To, b.To) 1772 } 1773 1774 // RefOfBinaryExpr does deep equals between the two objects. 1775 func (cmp *Comparator) RefOfBinaryExpr(a, b *BinaryExpr) bool { 1776 if a == b { 1777 return true 1778 } 1779 if a == nil || b == nil { 1780 return false 1781 } 1782 return a.Operator == b.Operator && 1783 cmp.Expr(a.Left, b.Left) && 1784 cmp.Expr(a.Right, b.Right) 1785 } 1786 1787 // RefOfBitAnd does deep equals between the two objects. 1788 func (cmp *Comparator) RefOfBitAnd(a, b *BitAnd) bool { 1789 if a == b { 1790 return true 1791 } 1792 if a == nil || b == nil { 1793 return false 1794 } 1795 return cmp.Expr(a.Arg, b.Arg) 1796 } 1797 1798 // RefOfBitOr does deep equals between the two objects. 1799 func (cmp *Comparator) RefOfBitOr(a, b *BitOr) bool { 1800 if a == b { 1801 return true 1802 } 1803 if a == nil || b == nil { 1804 return false 1805 } 1806 return cmp.Expr(a.Arg, b.Arg) 1807 } 1808 1809 // RefOfBitXor does deep equals between the two objects. 1810 func (cmp *Comparator) RefOfBitXor(a, b *BitXor) bool { 1811 if a == b { 1812 return true 1813 } 1814 if a == nil || b == nil { 1815 return false 1816 } 1817 return cmp.Expr(a.Arg, b.Arg) 1818 } 1819 1820 // RefOfCallProc does deep equals between the two objects. 1821 func (cmp *Comparator) RefOfCallProc(a, b *CallProc) bool { 1822 if a == b { 1823 return true 1824 } 1825 if a == nil || b == nil { 1826 return false 1827 } 1828 return cmp.TableName(a.Name, b.Name) && 1829 cmp.Exprs(a.Params, b.Params) 1830 } 1831 1832 // RefOfCaseExpr does deep equals between the two objects. 1833 func (cmp *Comparator) RefOfCaseExpr(a, b *CaseExpr) bool { 1834 if a == b { 1835 return true 1836 } 1837 if a == nil || b == nil { 1838 return false 1839 } 1840 return cmp.Expr(a.Expr, b.Expr) && 1841 cmp.SliceOfRefOfWhen(a.Whens, b.Whens) && 1842 cmp.Expr(a.Else, b.Else) 1843 } 1844 1845 // RefOfCastExpr does deep equals between the two objects. 1846 func (cmp *Comparator) RefOfCastExpr(a, b *CastExpr) bool { 1847 if a == b { 1848 return true 1849 } 1850 if a == nil || b == nil { 1851 return false 1852 } 1853 return a.Array == b.Array && 1854 cmp.Expr(a.Expr, b.Expr) && 1855 cmp.RefOfConvertType(a.Type, b.Type) 1856 } 1857 1858 // RefOfChangeColumn does deep equals between the two objects. 1859 func (cmp *Comparator) RefOfChangeColumn(a, b *ChangeColumn) bool { 1860 if a == b { 1861 return true 1862 } 1863 if a == nil || b == nil { 1864 return false 1865 } 1866 return a.First == b.First && 1867 cmp.RefOfColName(a.OldColumn, b.OldColumn) && 1868 cmp.RefOfColumnDefinition(a.NewColDefinition, b.NewColDefinition) && 1869 cmp.RefOfColName(a.After, b.After) 1870 } 1871 1872 // RefOfCharExpr does deep equals between the two objects. 1873 func (cmp *Comparator) RefOfCharExpr(a, b *CharExpr) bool { 1874 if a == b { 1875 return true 1876 } 1877 if a == nil || b == nil { 1878 return false 1879 } 1880 return a.Charset == b.Charset && 1881 cmp.Exprs(a.Exprs, b.Exprs) 1882 } 1883 1884 // RefOfCheckConstraintDefinition does deep equals between the two objects. 1885 func (cmp *Comparator) RefOfCheckConstraintDefinition(a, b *CheckConstraintDefinition) bool { 1886 if a == b { 1887 return true 1888 } 1889 if a == nil || b == nil { 1890 return false 1891 } 1892 return a.Enforced == b.Enforced && 1893 cmp.Expr(a.Expr, b.Expr) 1894 } 1895 1896 // RefOfColName does deep equals between the two objects. 1897 func (cmp *Comparator) RefOfColName(a, b *ColName) bool { 1898 if a == b { 1899 return true 1900 } 1901 if a == nil || b == nil { 1902 return false 1903 } 1904 if cmp.RefOfColName_ != nil { 1905 return cmp.RefOfColName_(a, b) 1906 } 1907 return cmp.IdentifierCI(a.Name, b.Name) && 1908 cmp.TableName(a.Qualifier, b.Qualifier) 1909 } 1910 1911 // RefOfCollateExpr does deep equals between the two objects. 1912 func (cmp *Comparator) RefOfCollateExpr(a, b *CollateExpr) bool { 1913 if a == b { 1914 return true 1915 } 1916 if a == nil || b == nil { 1917 return false 1918 } 1919 return a.Collation == b.Collation && 1920 cmp.Expr(a.Expr, b.Expr) 1921 } 1922 1923 // RefOfColumnDefinition does deep equals between the two objects. 1924 func (cmp *Comparator) RefOfColumnDefinition(a, b *ColumnDefinition) bool { 1925 if a == b { 1926 return true 1927 } 1928 if a == nil || b == nil { 1929 return false 1930 } 1931 return cmp.IdentifierCI(a.Name, b.Name) && 1932 cmp.RefOfColumnType(a.Type, b.Type) 1933 } 1934 1935 // RefOfColumnType does deep equals between the two objects. 1936 func (cmp *Comparator) RefOfColumnType(a, b *ColumnType) bool { 1937 if a == b { 1938 return true 1939 } 1940 if a == nil || b == nil { 1941 return false 1942 } 1943 return a.Type == b.Type && 1944 a.Unsigned == b.Unsigned && 1945 a.Zerofill == b.Zerofill && 1946 cmp.RefOfColumnTypeOptions(a.Options, b.Options) && 1947 cmp.RefOfLiteral(a.Length, b.Length) && 1948 cmp.RefOfLiteral(a.Scale, b.Scale) && 1949 cmp.ColumnCharset(a.Charset, b.Charset) && 1950 cmp.SliceOfString(a.EnumValues, b.EnumValues) 1951 } 1952 1953 // Columns does deep equals between the two objects. 1954 func (cmp *Comparator) Columns(a, b Columns) bool { 1955 if len(a) != len(b) { 1956 return false 1957 } 1958 for i := 0; i < len(a); i++ { 1959 if !cmp.IdentifierCI(a[i], b[i]) { 1960 return false 1961 } 1962 } 1963 return true 1964 } 1965 1966 // RefOfCommentOnly does deep equals between the two objects. 1967 func (cmp *Comparator) RefOfCommentOnly(a, b *CommentOnly) bool { 1968 if a == b { 1969 return true 1970 } 1971 if a == nil || b == nil { 1972 return false 1973 } 1974 return cmp.SliceOfString(a.Comments, b.Comments) 1975 } 1976 1977 // RefOfCommit does deep equals between the two objects. 1978 func (cmp *Comparator) RefOfCommit(a, b *Commit) bool { 1979 if a == b { 1980 return true 1981 } 1982 if a == nil || b == nil { 1983 return false 1984 } 1985 return true 1986 } 1987 1988 // RefOfCommonTableExpr does deep equals between the two objects. 1989 func (cmp *Comparator) RefOfCommonTableExpr(a, b *CommonTableExpr) bool { 1990 if a == b { 1991 return true 1992 } 1993 if a == nil || b == nil { 1994 return false 1995 } 1996 return cmp.IdentifierCS(a.ID, b.ID) && 1997 cmp.Columns(a.Columns, b.Columns) && 1998 cmp.RefOfSubquery(a.Subquery, b.Subquery) 1999 } 2000 2001 // RefOfComparisonExpr does deep equals between the two objects. 2002 func (cmp *Comparator) RefOfComparisonExpr(a, b *ComparisonExpr) bool { 2003 if a == b { 2004 return true 2005 } 2006 if a == nil || b == nil { 2007 return false 2008 } 2009 return a.Operator == b.Operator && 2010 cmp.Expr(a.Left, b.Left) && 2011 cmp.Expr(a.Right, b.Right) && 2012 cmp.Expr(a.Escape, b.Escape) 2013 } 2014 2015 // RefOfConstraintDefinition does deep equals between the two objects. 2016 func (cmp *Comparator) RefOfConstraintDefinition(a, b *ConstraintDefinition) bool { 2017 if a == b { 2018 return true 2019 } 2020 if a == nil || b == nil { 2021 return false 2022 } 2023 return cmp.IdentifierCI(a.Name, b.Name) && 2024 cmp.ConstraintInfo(a.Details, b.Details) 2025 } 2026 2027 // RefOfConvertExpr does deep equals between the two objects. 2028 func (cmp *Comparator) RefOfConvertExpr(a, b *ConvertExpr) bool { 2029 if a == b { 2030 return true 2031 } 2032 if a == nil || b == nil { 2033 return false 2034 } 2035 return cmp.Expr(a.Expr, b.Expr) && 2036 cmp.RefOfConvertType(a.Type, b.Type) 2037 } 2038 2039 // RefOfConvertType does deep equals between the two objects. 2040 func (cmp *Comparator) RefOfConvertType(a, b *ConvertType) bool { 2041 if a == b { 2042 return true 2043 } 2044 if a == nil || b == nil { 2045 return false 2046 } 2047 return a.Type == b.Type && 2048 cmp.RefOfLiteral(a.Length, b.Length) && 2049 cmp.RefOfLiteral(a.Scale, b.Scale) && 2050 cmp.ColumnCharset(a.Charset, b.Charset) 2051 } 2052 2053 // RefOfConvertUsingExpr does deep equals between the two objects. 2054 func (cmp *Comparator) RefOfConvertUsingExpr(a, b *ConvertUsingExpr) bool { 2055 if a == b { 2056 return true 2057 } 2058 if a == nil || b == nil { 2059 return false 2060 } 2061 return a.Type == b.Type && 2062 cmp.Expr(a.Expr, b.Expr) 2063 } 2064 2065 // RefOfCount does deep equals between the two objects. 2066 func (cmp *Comparator) RefOfCount(a, b *Count) bool { 2067 if a == b { 2068 return true 2069 } 2070 if a == nil || b == nil { 2071 return false 2072 } 2073 return a.Distinct == b.Distinct && 2074 cmp.Exprs(a.Args, b.Args) 2075 } 2076 2077 // RefOfCountStar does deep equals between the two objects. 2078 func (cmp *Comparator) RefOfCountStar(a, b *CountStar) bool { 2079 if a == b { 2080 return true 2081 } 2082 if a == nil || b == nil { 2083 return false 2084 } 2085 return true 2086 } 2087 2088 // RefOfCreateDatabase does deep equals between the two objects. 2089 func (cmp *Comparator) RefOfCreateDatabase(a, b *CreateDatabase) bool { 2090 if a == b { 2091 return true 2092 } 2093 if a == nil || b == nil { 2094 return false 2095 } 2096 return a.IfNotExists == b.IfNotExists && 2097 a.FullyParsed == b.FullyParsed && 2098 cmp.RefOfParsedComments(a.Comments, b.Comments) && 2099 cmp.IdentifierCS(a.DBName, b.DBName) && 2100 cmp.SliceOfDatabaseOption(a.CreateOptions, b.CreateOptions) 2101 } 2102 2103 // RefOfCreateTable does deep equals between the two objects. 2104 func (cmp *Comparator) RefOfCreateTable(a, b *CreateTable) bool { 2105 if a == b { 2106 return true 2107 } 2108 if a == nil || b == nil { 2109 return false 2110 } 2111 return a.Temp == b.Temp && 2112 a.IfNotExists == b.IfNotExists && 2113 a.FullyParsed == b.FullyParsed && 2114 cmp.TableName(a.Table, b.Table) && 2115 cmp.RefOfTableSpec(a.TableSpec, b.TableSpec) && 2116 cmp.RefOfOptLike(a.OptLike, b.OptLike) && 2117 cmp.RefOfParsedComments(a.Comments, b.Comments) 2118 } 2119 2120 // RefOfCreateView does deep equals between the two objects. 2121 func (cmp *Comparator) RefOfCreateView(a, b *CreateView) bool { 2122 if a == b { 2123 return true 2124 } 2125 if a == nil || b == nil { 2126 return false 2127 } 2128 return a.Algorithm == b.Algorithm && 2129 a.Security == b.Security && 2130 a.CheckOption == b.CheckOption && 2131 a.IsReplace == b.IsReplace && 2132 cmp.TableName(a.ViewName, b.ViewName) && 2133 cmp.RefOfDefiner(a.Definer, b.Definer) && 2134 cmp.Columns(a.Columns, b.Columns) && 2135 cmp.SelectStatement(a.Select, b.Select) && 2136 cmp.RefOfParsedComments(a.Comments, b.Comments) 2137 } 2138 2139 // RefOfCurTimeFuncExpr does deep equals between the two objects. 2140 func (cmp *Comparator) RefOfCurTimeFuncExpr(a, b *CurTimeFuncExpr) bool { 2141 if a == b { 2142 return true 2143 } 2144 if a == nil || b == nil { 2145 return false 2146 } 2147 return cmp.IdentifierCI(a.Name, b.Name) && 2148 cmp.Expr(a.Fsp, b.Fsp) 2149 } 2150 2151 // RefOfDeallocateStmt does deep equals between the two objects. 2152 func (cmp *Comparator) RefOfDeallocateStmt(a, b *DeallocateStmt) bool { 2153 if a == b { 2154 return true 2155 } 2156 if a == nil || b == nil { 2157 return false 2158 } 2159 return a.Type == b.Type && 2160 cmp.RefOfParsedComments(a.Comments, b.Comments) && 2161 cmp.IdentifierCI(a.Name, b.Name) 2162 } 2163 2164 // RefOfDefault does deep equals between the two objects. 2165 func (cmp *Comparator) RefOfDefault(a, b *Default) bool { 2166 if a == b { 2167 return true 2168 } 2169 if a == nil || b == nil { 2170 return false 2171 } 2172 return a.ColName == b.ColName 2173 } 2174 2175 // RefOfDefiner does deep equals between the two objects. 2176 func (cmp *Comparator) RefOfDefiner(a, b *Definer) bool { 2177 if a == b { 2178 return true 2179 } 2180 if a == nil || b == nil { 2181 return false 2182 } 2183 return a.Name == b.Name && 2184 a.Address == b.Address 2185 } 2186 2187 // RefOfDelete does deep equals between the two objects. 2188 func (cmp *Comparator) RefOfDelete(a, b *Delete) bool { 2189 if a == b { 2190 return true 2191 } 2192 if a == nil || b == nil { 2193 return false 2194 } 2195 return cmp.RefOfWith(a.With, b.With) && 2196 a.Ignore == b.Ignore && 2197 cmp.RefOfParsedComments(a.Comments, b.Comments) && 2198 cmp.TableNames(a.Targets, b.Targets) && 2199 cmp.TableExprs(a.TableExprs, b.TableExprs) && 2200 cmp.Partitions(a.Partitions, b.Partitions) && 2201 cmp.RefOfWhere(a.Where, b.Where) && 2202 cmp.OrderBy(a.OrderBy, b.OrderBy) && 2203 cmp.RefOfLimit(a.Limit, b.Limit) 2204 } 2205 2206 // RefOfDerivedTable does deep equals between the two objects. 2207 func (cmp *Comparator) RefOfDerivedTable(a, b *DerivedTable) bool { 2208 if a == b { 2209 return true 2210 } 2211 if a == nil || b == nil { 2212 return false 2213 } 2214 return a.Lateral == b.Lateral && 2215 cmp.SelectStatement(a.Select, b.Select) 2216 } 2217 2218 // RefOfDropColumn does deep equals between the two objects. 2219 func (cmp *Comparator) RefOfDropColumn(a, b *DropColumn) bool { 2220 if a == b { 2221 return true 2222 } 2223 if a == nil || b == nil { 2224 return false 2225 } 2226 return cmp.RefOfColName(a.Name, b.Name) 2227 } 2228 2229 // RefOfDropDatabase does deep equals between the two objects. 2230 func (cmp *Comparator) RefOfDropDatabase(a, b *DropDatabase) bool { 2231 if a == b { 2232 return true 2233 } 2234 if a == nil || b == nil { 2235 return false 2236 } 2237 return a.IfExists == b.IfExists && 2238 cmp.RefOfParsedComments(a.Comments, b.Comments) && 2239 cmp.IdentifierCS(a.DBName, b.DBName) 2240 } 2241 2242 // RefOfDropKey does deep equals between the two objects. 2243 func (cmp *Comparator) RefOfDropKey(a, b *DropKey) bool { 2244 if a == b { 2245 return true 2246 } 2247 if a == nil || b == nil { 2248 return false 2249 } 2250 return a.Type == b.Type && 2251 cmp.IdentifierCI(a.Name, b.Name) 2252 } 2253 2254 // RefOfDropTable does deep equals between the two objects. 2255 func (cmp *Comparator) RefOfDropTable(a, b *DropTable) bool { 2256 if a == b { 2257 return true 2258 } 2259 if a == nil || b == nil { 2260 return false 2261 } 2262 return a.Temp == b.Temp && 2263 a.IfExists == b.IfExists && 2264 cmp.TableNames(a.FromTables, b.FromTables) && 2265 cmp.RefOfParsedComments(a.Comments, b.Comments) 2266 } 2267 2268 // RefOfDropView does deep equals between the two objects. 2269 func (cmp *Comparator) RefOfDropView(a, b *DropView) bool { 2270 if a == b { 2271 return true 2272 } 2273 if a == nil || b == nil { 2274 return false 2275 } 2276 return a.IfExists == b.IfExists && 2277 cmp.TableNames(a.FromTables, b.FromTables) && 2278 cmp.RefOfParsedComments(a.Comments, b.Comments) 2279 } 2280 2281 // RefOfExecuteStmt does deep equals between the two objects. 2282 func (cmp *Comparator) RefOfExecuteStmt(a, b *ExecuteStmt) bool { 2283 if a == b { 2284 return true 2285 } 2286 if a == nil || b == nil { 2287 return false 2288 } 2289 return cmp.IdentifierCI(a.Name, b.Name) && 2290 cmp.RefOfParsedComments(a.Comments, b.Comments) && 2291 cmp.SliceOfRefOfVariable(a.Arguments, b.Arguments) 2292 } 2293 2294 // RefOfExistsExpr does deep equals between the two objects. 2295 func (cmp *Comparator) RefOfExistsExpr(a, b *ExistsExpr) bool { 2296 if a == b { 2297 return true 2298 } 2299 if a == nil || b == nil { 2300 return false 2301 } 2302 return cmp.RefOfSubquery(a.Subquery, b.Subquery) 2303 } 2304 2305 // RefOfExplainStmt does deep equals between the two objects. 2306 func (cmp *Comparator) RefOfExplainStmt(a, b *ExplainStmt) bool { 2307 if a == b { 2308 return true 2309 } 2310 if a == nil || b == nil { 2311 return false 2312 } 2313 return a.Type == b.Type && 2314 cmp.Statement(a.Statement, b.Statement) && 2315 cmp.RefOfParsedComments(a.Comments, b.Comments) 2316 } 2317 2318 // RefOfExplainTab does deep equals between the two objects. 2319 func (cmp *Comparator) RefOfExplainTab(a, b *ExplainTab) bool { 2320 if a == b { 2321 return true 2322 } 2323 if a == nil || b == nil { 2324 return false 2325 } 2326 return a.Wild == b.Wild && 2327 cmp.TableName(a.Table, b.Table) 2328 } 2329 2330 // Exprs does deep equals between the two objects. 2331 func (cmp *Comparator) Exprs(a, b Exprs) bool { 2332 if len(a) != len(b) { 2333 return false 2334 } 2335 for i := 0; i < len(a); i++ { 2336 if !cmp.Expr(a[i], b[i]) { 2337 return false 2338 } 2339 } 2340 return true 2341 } 2342 2343 // RefOfExtractFuncExpr does deep equals between the two objects. 2344 func (cmp *Comparator) RefOfExtractFuncExpr(a, b *ExtractFuncExpr) bool { 2345 if a == b { 2346 return true 2347 } 2348 if a == nil || b == nil { 2349 return false 2350 } 2351 return a.IntervalTypes == b.IntervalTypes && 2352 cmp.Expr(a.Expr, b.Expr) 2353 } 2354 2355 // RefOfExtractValueExpr does deep equals between the two objects. 2356 func (cmp *Comparator) RefOfExtractValueExpr(a, b *ExtractValueExpr) bool { 2357 if a == b { 2358 return true 2359 } 2360 if a == nil || b == nil { 2361 return false 2362 } 2363 return cmp.Expr(a.Fragment, b.Fragment) && 2364 cmp.Expr(a.XPathExpr, b.XPathExpr) 2365 } 2366 2367 // RefOfExtractedSubquery does deep equals between the two objects. 2368 func (cmp *Comparator) RefOfExtractedSubquery(a, b *ExtractedSubquery) bool { 2369 if a == b { 2370 return true 2371 } 2372 if a == nil || b == nil { 2373 return false 2374 } 2375 return a.OpCode == b.OpCode && 2376 a.NeedsRewrite == b.NeedsRewrite && 2377 a.hasValuesArg == b.hasValuesArg && 2378 a.argName == b.argName && 2379 cmp.Expr(a.Original, b.Original) && 2380 cmp.RefOfSubquery(a.Subquery, b.Subquery) && 2381 cmp.Expr(a.OtherSide, b.OtherSide) && 2382 cmp.Expr(a.alternative, b.alternative) 2383 } 2384 2385 // RefOfFirstOrLastValueExpr does deep equals between the two objects. 2386 func (cmp *Comparator) RefOfFirstOrLastValueExpr(a, b *FirstOrLastValueExpr) bool { 2387 if a == b { 2388 return true 2389 } 2390 if a == nil || b == nil { 2391 return false 2392 } 2393 return a.Type == b.Type && 2394 cmp.Expr(a.Expr, b.Expr) && 2395 cmp.RefOfNullTreatmentClause(a.NullTreatmentClause, b.NullTreatmentClause) && 2396 cmp.RefOfOverClause(a.OverClause, b.OverClause) 2397 } 2398 2399 // RefOfFlush does deep equals between the two objects. 2400 func (cmp *Comparator) RefOfFlush(a, b *Flush) bool { 2401 if a == b { 2402 return true 2403 } 2404 if a == nil || b == nil { 2405 return false 2406 } 2407 return a.IsLocal == b.IsLocal && 2408 a.WithLock == b.WithLock && 2409 a.ForExport == b.ForExport && 2410 cmp.SliceOfString(a.FlushOptions, b.FlushOptions) && 2411 cmp.TableNames(a.TableNames, b.TableNames) 2412 } 2413 2414 // RefOfForce does deep equals between the two objects. 2415 func (cmp *Comparator) RefOfForce(a, b *Force) bool { 2416 if a == b { 2417 return true 2418 } 2419 if a == nil || b == nil { 2420 return false 2421 } 2422 return true 2423 } 2424 2425 // RefOfForeignKeyDefinition does deep equals between the two objects. 2426 func (cmp *Comparator) RefOfForeignKeyDefinition(a, b *ForeignKeyDefinition) bool { 2427 if a == b { 2428 return true 2429 } 2430 if a == nil || b == nil { 2431 return false 2432 } 2433 return cmp.Columns(a.Source, b.Source) && 2434 cmp.IdentifierCI(a.IndexName, b.IndexName) && 2435 cmp.RefOfReferenceDefinition(a.ReferenceDefinition, b.ReferenceDefinition) 2436 } 2437 2438 // RefOfFrameClause does deep equals between the two objects. 2439 func (cmp *Comparator) RefOfFrameClause(a, b *FrameClause) bool { 2440 if a == b { 2441 return true 2442 } 2443 if a == nil || b == nil { 2444 return false 2445 } 2446 return a.Unit == b.Unit && 2447 cmp.RefOfFramePoint(a.Start, b.Start) && 2448 cmp.RefOfFramePoint(a.End, b.End) 2449 } 2450 2451 // RefOfFramePoint does deep equals between the two objects. 2452 func (cmp *Comparator) RefOfFramePoint(a, b *FramePoint) bool { 2453 if a == b { 2454 return true 2455 } 2456 if a == nil || b == nil { 2457 return false 2458 } 2459 return a.Type == b.Type && 2460 cmp.Expr(a.Expr, b.Expr) 2461 } 2462 2463 // RefOfFromFirstLastClause does deep equals between the two objects. 2464 func (cmp *Comparator) RefOfFromFirstLastClause(a, b *FromFirstLastClause) bool { 2465 if a == b { 2466 return true 2467 } 2468 if a == nil || b == nil { 2469 return false 2470 } 2471 return a.Type == b.Type 2472 } 2473 2474 // RefOfFuncExpr does deep equals between the two objects. 2475 func (cmp *Comparator) RefOfFuncExpr(a, b *FuncExpr) bool { 2476 if a == b { 2477 return true 2478 } 2479 if a == nil || b == nil { 2480 return false 2481 } 2482 return cmp.IdentifierCS(a.Qualifier, b.Qualifier) && 2483 cmp.IdentifierCI(a.Name, b.Name) && 2484 cmp.SelectExprs(a.Exprs, b.Exprs) 2485 } 2486 2487 // RefOfGTIDFuncExpr does deep equals between the two objects. 2488 func (cmp *Comparator) RefOfGTIDFuncExpr(a, b *GTIDFuncExpr) bool { 2489 if a == b { 2490 return true 2491 } 2492 if a == nil || b == nil { 2493 return false 2494 } 2495 return a.Type == b.Type && 2496 cmp.Expr(a.Set1, b.Set1) && 2497 cmp.Expr(a.Set2, b.Set2) && 2498 cmp.Expr(a.Timeout, b.Timeout) && 2499 cmp.Expr(a.Channel, b.Channel) 2500 } 2501 2502 // GroupBy does deep equals between the two objects. 2503 func (cmp *Comparator) GroupBy(a, b GroupBy) bool { 2504 if len(a) != len(b) { 2505 return false 2506 } 2507 for i := 0; i < len(a); i++ { 2508 if !cmp.Expr(a[i], b[i]) { 2509 return false 2510 } 2511 } 2512 return true 2513 } 2514 2515 // RefOfGroupConcatExpr does deep equals between the two objects. 2516 func (cmp *Comparator) RefOfGroupConcatExpr(a, b *GroupConcatExpr) bool { 2517 if a == b { 2518 return true 2519 } 2520 if a == nil || b == nil { 2521 return false 2522 } 2523 return a.Distinct == b.Distinct && 2524 a.Separator == b.Separator && 2525 cmp.Exprs(a.Exprs, b.Exprs) && 2526 cmp.OrderBy(a.OrderBy, b.OrderBy) && 2527 cmp.RefOfLimit(a.Limit, b.Limit) 2528 } 2529 2530 // IdentifierCI does deep equals between the two objects. 2531 func (cmp *Comparator) IdentifierCI(a, b IdentifierCI) bool { 2532 return a.val == b.val && 2533 a.lowered == b.lowered 2534 } 2535 2536 // IdentifierCS does deep equals between the two objects. 2537 func (cmp *Comparator) IdentifierCS(a, b IdentifierCS) bool { 2538 return a.v == b.v 2539 } 2540 2541 // RefOfIndexDefinition does deep equals between the two objects. 2542 func (cmp *Comparator) RefOfIndexDefinition(a, b *IndexDefinition) bool { 2543 if a == b { 2544 return true 2545 } 2546 if a == nil || b == nil { 2547 return false 2548 } 2549 return cmp.RefOfIndexInfo(a.Info, b.Info) && 2550 cmp.SliceOfRefOfIndexColumn(a.Columns, b.Columns) && 2551 cmp.SliceOfRefOfIndexOption(a.Options, b.Options) 2552 } 2553 2554 // RefOfIndexHint does deep equals between the two objects. 2555 func (cmp *Comparator) RefOfIndexHint(a, b *IndexHint) bool { 2556 if a == b { 2557 return true 2558 } 2559 if a == nil || b == nil { 2560 return false 2561 } 2562 return a.Type == b.Type && 2563 a.ForType == b.ForType && 2564 cmp.SliceOfIdentifierCI(a.Indexes, b.Indexes) 2565 } 2566 2567 // IndexHints does deep equals between the two objects. 2568 func (cmp *Comparator) IndexHints(a, b IndexHints) bool { 2569 if len(a) != len(b) { 2570 return false 2571 } 2572 for i := 0; i < len(a); i++ { 2573 if !cmp.RefOfIndexHint(a[i], b[i]) { 2574 return false 2575 } 2576 } 2577 return true 2578 } 2579 2580 // RefOfIndexInfo does deep equals between the two objects. 2581 func (cmp *Comparator) RefOfIndexInfo(a, b *IndexInfo) bool { 2582 if a == b { 2583 return true 2584 } 2585 if a == nil || b == nil { 2586 return false 2587 } 2588 return a.Type == b.Type && 2589 a.Primary == b.Primary && 2590 a.Spatial == b.Spatial && 2591 a.Fulltext == b.Fulltext && 2592 a.Unique == b.Unique && 2593 cmp.IdentifierCI(a.Name, b.Name) && 2594 cmp.IdentifierCI(a.ConstraintName, b.ConstraintName) 2595 } 2596 2597 // RefOfInsert does deep equals between the two objects. 2598 func (cmp *Comparator) RefOfInsert(a, b *Insert) bool { 2599 if a == b { 2600 return true 2601 } 2602 if a == nil || b == nil { 2603 return false 2604 } 2605 return a.Action == b.Action && 2606 cmp.RefOfParsedComments(a.Comments, b.Comments) && 2607 a.Ignore == b.Ignore && 2608 cmp.TableName(a.Table, b.Table) && 2609 cmp.Partitions(a.Partitions, b.Partitions) && 2610 cmp.Columns(a.Columns, b.Columns) && 2611 cmp.InsertRows(a.Rows, b.Rows) && 2612 cmp.OnDup(a.OnDup, b.OnDup) 2613 } 2614 2615 // RefOfInsertExpr does deep equals between the two objects. 2616 func (cmp *Comparator) RefOfInsertExpr(a, b *InsertExpr) bool { 2617 if a == b { 2618 return true 2619 } 2620 if a == nil || b == nil { 2621 return false 2622 } 2623 return cmp.Expr(a.Str, b.Str) && 2624 cmp.Expr(a.Pos, b.Pos) && 2625 cmp.Expr(a.Len, b.Len) && 2626 cmp.Expr(a.NewStr, b.NewStr) 2627 } 2628 2629 // RefOfIntervalExpr does deep equals between the two objects. 2630 func (cmp *Comparator) RefOfIntervalExpr(a, b *IntervalExpr) bool { 2631 if a == b { 2632 return true 2633 } 2634 if a == nil || b == nil { 2635 return false 2636 } 2637 return a.Unit == b.Unit && 2638 cmp.Expr(a.Expr, b.Expr) 2639 } 2640 2641 // RefOfIntervalFuncExpr does deep equals between the two objects. 2642 func (cmp *Comparator) RefOfIntervalFuncExpr(a, b *IntervalFuncExpr) bool { 2643 if a == b { 2644 return true 2645 } 2646 if a == nil || b == nil { 2647 return false 2648 } 2649 return cmp.Expr(a.Expr, b.Expr) && 2650 cmp.Exprs(a.Exprs, b.Exprs) 2651 } 2652 2653 // RefOfIntroducerExpr does deep equals between the two objects. 2654 func (cmp *Comparator) RefOfIntroducerExpr(a, b *IntroducerExpr) bool { 2655 if a == b { 2656 return true 2657 } 2658 if a == nil || b == nil { 2659 return false 2660 } 2661 return a.CharacterSet == b.CharacterSet && 2662 cmp.Expr(a.Expr, b.Expr) 2663 } 2664 2665 // RefOfIsExpr does deep equals between the two objects. 2666 func (cmp *Comparator) RefOfIsExpr(a, b *IsExpr) bool { 2667 if a == b { 2668 return true 2669 } 2670 if a == nil || b == nil { 2671 return false 2672 } 2673 return cmp.Expr(a.Left, b.Left) && 2674 a.Right == b.Right 2675 } 2676 2677 // RefOfJSONArrayExpr does deep equals between the two objects. 2678 func (cmp *Comparator) RefOfJSONArrayExpr(a, b *JSONArrayExpr) bool { 2679 if a == b { 2680 return true 2681 } 2682 if a == nil || b == nil { 2683 return false 2684 } 2685 return cmp.Exprs(a.Params, b.Params) 2686 } 2687 2688 // RefOfJSONAttributesExpr does deep equals between the two objects. 2689 func (cmp *Comparator) RefOfJSONAttributesExpr(a, b *JSONAttributesExpr) bool { 2690 if a == b { 2691 return true 2692 } 2693 if a == nil || b == nil { 2694 return false 2695 } 2696 return a.Type == b.Type && 2697 cmp.Expr(a.JSONDoc, b.JSONDoc) && 2698 cmp.Expr(a.Path, b.Path) 2699 } 2700 2701 // RefOfJSONContainsExpr does deep equals between the two objects. 2702 func (cmp *Comparator) RefOfJSONContainsExpr(a, b *JSONContainsExpr) bool { 2703 if a == b { 2704 return true 2705 } 2706 if a == nil || b == nil { 2707 return false 2708 } 2709 return cmp.Expr(a.Target, b.Target) && 2710 cmp.Expr(a.Candidate, b.Candidate) && 2711 cmp.SliceOfExpr(a.PathList, b.PathList) 2712 } 2713 2714 // RefOfJSONContainsPathExpr does deep equals between the two objects. 2715 func (cmp *Comparator) RefOfJSONContainsPathExpr(a, b *JSONContainsPathExpr) bool { 2716 if a == b { 2717 return true 2718 } 2719 if a == nil || b == nil { 2720 return false 2721 } 2722 return cmp.Expr(a.JSONDoc, b.JSONDoc) && 2723 cmp.Expr(a.OneOrAll, b.OneOrAll) && 2724 cmp.SliceOfExpr(a.PathList, b.PathList) 2725 } 2726 2727 // RefOfJSONExtractExpr does deep equals between the two objects. 2728 func (cmp *Comparator) RefOfJSONExtractExpr(a, b *JSONExtractExpr) bool { 2729 if a == b { 2730 return true 2731 } 2732 if a == nil || b == nil { 2733 return false 2734 } 2735 return cmp.Expr(a.JSONDoc, b.JSONDoc) && 2736 cmp.SliceOfExpr(a.PathList, b.PathList) 2737 } 2738 2739 // RefOfJSONKeysExpr does deep equals between the two objects. 2740 func (cmp *Comparator) RefOfJSONKeysExpr(a, b *JSONKeysExpr) bool { 2741 if a == b { 2742 return true 2743 } 2744 if a == nil || b == nil { 2745 return false 2746 } 2747 return cmp.Expr(a.JSONDoc, b.JSONDoc) && 2748 cmp.Expr(a.Path, b.Path) 2749 } 2750 2751 // RefOfJSONObjectExpr does deep equals between the two objects. 2752 func (cmp *Comparator) RefOfJSONObjectExpr(a, b *JSONObjectExpr) bool { 2753 if a == b { 2754 return true 2755 } 2756 if a == nil || b == nil { 2757 return false 2758 } 2759 return cmp.SliceOfRefOfJSONObjectParam(a.Params, b.Params) 2760 } 2761 2762 // RefOfJSONObjectParam does deep equals between the two objects. 2763 func (cmp *Comparator) RefOfJSONObjectParam(a, b *JSONObjectParam) bool { 2764 if a == b { 2765 return true 2766 } 2767 if a == nil || b == nil { 2768 return false 2769 } 2770 return cmp.Expr(a.Key, b.Key) && 2771 cmp.Expr(a.Value, b.Value) 2772 } 2773 2774 // RefOfJSONOverlapsExpr does deep equals between the two objects. 2775 func (cmp *Comparator) RefOfJSONOverlapsExpr(a, b *JSONOverlapsExpr) bool { 2776 if a == b { 2777 return true 2778 } 2779 if a == nil || b == nil { 2780 return false 2781 } 2782 return cmp.Expr(a.JSONDoc1, b.JSONDoc1) && 2783 cmp.Expr(a.JSONDoc2, b.JSONDoc2) 2784 } 2785 2786 // RefOfJSONPrettyExpr does deep equals between the two objects. 2787 func (cmp *Comparator) RefOfJSONPrettyExpr(a, b *JSONPrettyExpr) bool { 2788 if a == b { 2789 return true 2790 } 2791 if a == nil || b == nil { 2792 return false 2793 } 2794 return cmp.Expr(a.JSONVal, b.JSONVal) 2795 } 2796 2797 // RefOfJSONQuoteExpr does deep equals between the two objects. 2798 func (cmp *Comparator) RefOfJSONQuoteExpr(a, b *JSONQuoteExpr) bool { 2799 if a == b { 2800 return true 2801 } 2802 if a == nil || b == nil { 2803 return false 2804 } 2805 return cmp.Expr(a.StringArg, b.StringArg) 2806 } 2807 2808 // RefOfJSONRemoveExpr does deep equals between the two objects. 2809 func (cmp *Comparator) RefOfJSONRemoveExpr(a, b *JSONRemoveExpr) bool { 2810 if a == b { 2811 return true 2812 } 2813 if a == nil || b == nil { 2814 return false 2815 } 2816 return cmp.Expr(a.JSONDoc, b.JSONDoc) && 2817 cmp.Exprs(a.PathList, b.PathList) 2818 } 2819 2820 // RefOfJSONSchemaValidFuncExpr does deep equals between the two objects. 2821 func (cmp *Comparator) RefOfJSONSchemaValidFuncExpr(a, b *JSONSchemaValidFuncExpr) bool { 2822 if a == b { 2823 return true 2824 } 2825 if a == nil || b == nil { 2826 return false 2827 } 2828 return cmp.Expr(a.Schema, b.Schema) && 2829 cmp.Expr(a.Document, b.Document) 2830 } 2831 2832 // RefOfJSONSchemaValidationReportFuncExpr does deep equals between the two objects. 2833 func (cmp *Comparator) RefOfJSONSchemaValidationReportFuncExpr(a, b *JSONSchemaValidationReportFuncExpr) bool { 2834 if a == b { 2835 return true 2836 } 2837 if a == nil || b == nil { 2838 return false 2839 } 2840 return cmp.Expr(a.Schema, b.Schema) && 2841 cmp.Expr(a.Document, b.Document) 2842 } 2843 2844 // RefOfJSONSearchExpr does deep equals between the two objects. 2845 func (cmp *Comparator) RefOfJSONSearchExpr(a, b *JSONSearchExpr) bool { 2846 if a == b { 2847 return true 2848 } 2849 if a == nil || b == nil { 2850 return false 2851 } 2852 return cmp.Expr(a.JSONDoc, b.JSONDoc) && 2853 cmp.Expr(a.OneOrAll, b.OneOrAll) && 2854 cmp.Expr(a.SearchStr, b.SearchStr) && 2855 cmp.Expr(a.EscapeChar, b.EscapeChar) && 2856 cmp.SliceOfExpr(a.PathList, b.PathList) 2857 } 2858 2859 // RefOfJSONStorageFreeExpr does deep equals between the two objects. 2860 func (cmp *Comparator) RefOfJSONStorageFreeExpr(a, b *JSONStorageFreeExpr) bool { 2861 if a == b { 2862 return true 2863 } 2864 if a == nil || b == nil { 2865 return false 2866 } 2867 return cmp.Expr(a.JSONVal, b.JSONVal) 2868 } 2869 2870 // RefOfJSONStorageSizeExpr does deep equals between the two objects. 2871 func (cmp *Comparator) RefOfJSONStorageSizeExpr(a, b *JSONStorageSizeExpr) bool { 2872 if a == b { 2873 return true 2874 } 2875 if a == nil || b == nil { 2876 return false 2877 } 2878 return cmp.Expr(a.JSONVal, b.JSONVal) 2879 } 2880 2881 // RefOfJSONTableExpr does deep equals between the two objects. 2882 func (cmp *Comparator) RefOfJSONTableExpr(a, b *JSONTableExpr) bool { 2883 if a == b { 2884 return true 2885 } 2886 if a == nil || b == nil { 2887 return false 2888 } 2889 return cmp.Expr(a.Expr, b.Expr) && 2890 cmp.IdentifierCS(a.Alias, b.Alias) && 2891 cmp.Expr(a.Filter, b.Filter) && 2892 cmp.SliceOfRefOfJtColumnDefinition(a.Columns, b.Columns) 2893 } 2894 2895 // RefOfJSONUnquoteExpr does deep equals between the two objects. 2896 func (cmp *Comparator) RefOfJSONUnquoteExpr(a, b *JSONUnquoteExpr) bool { 2897 if a == b { 2898 return true 2899 } 2900 if a == nil || b == nil { 2901 return false 2902 } 2903 return cmp.Expr(a.JSONValue, b.JSONValue) 2904 } 2905 2906 // RefOfJSONValueExpr does deep equals between the two objects. 2907 func (cmp *Comparator) RefOfJSONValueExpr(a, b *JSONValueExpr) bool { 2908 if a == b { 2909 return true 2910 } 2911 if a == nil || b == nil { 2912 return false 2913 } 2914 return cmp.Expr(a.JSONDoc, b.JSONDoc) && 2915 cmp.Expr(a.Path, b.Path) && 2916 cmp.RefOfConvertType(a.ReturningType, b.ReturningType) && 2917 cmp.RefOfJtOnResponse(a.EmptyOnResponse, b.EmptyOnResponse) && 2918 cmp.RefOfJtOnResponse(a.ErrorOnResponse, b.ErrorOnResponse) 2919 } 2920 2921 // RefOfJSONValueMergeExpr does deep equals between the two objects. 2922 func (cmp *Comparator) RefOfJSONValueMergeExpr(a, b *JSONValueMergeExpr) bool { 2923 if a == b { 2924 return true 2925 } 2926 if a == nil || b == nil { 2927 return false 2928 } 2929 return a.Type == b.Type && 2930 cmp.Expr(a.JSONDoc, b.JSONDoc) && 2931 cmp.Exprs(a.JSONDocList, b.JSONDocList) 2932 } 2933 2934 // RefOfJSONValueModifierExpr does deep equals between the two objects. 2935 func (cmp *Comparator) RefOfJSONValueModifierExpr(a, b *JSONValueModifierExpr) bool { 2936 if a == b { 2937 return true 2938 } 2939 if a == nil || b == nil { 2940 return false 2941 } 2942 return a.Type == b.Type && 2943 cmp.Expr(a.JSONDoc, b.JSONDoc) && 2944 cmp.SliceOfRefOfJSONObjectParam(a.Params, b.Params) 2945 } 2946 2947 // RefOfJoinCondition does deep equals between the two objects. 2948 func (cmp *Comparator) RefOfJoinCondition(a, b *JoinCondition) bool { 2949 if a == b { 2950 return true 2951 } 2952 if a == nil || b == nil { 2953 return false 2954 } 2955 return cmp.Expr(a.On, b.On) && 2956 cmp.Columns(a.Using, b.Using) 2957 } 2958 2959 // RefOfJoinTableExpr does deep equals between the two objects. 2960 func (cmp *Comparator) RefOfJoinTableExpr(a, b *JoinTableExpr) bool { 2961 if a == b { 2962 return true 2963 } 2964 if a == nil || b == nil { 2965 return false 2966 } 2967 return cmp.TableExpr(a.LeftExpr, b.LeftExpr) && 2968 a.Join == b.Join && 2969 cmp.TableExpr(a.RightExpr, b.RightExpr) && 2970 cmp.RefOfJoinCondition(a.Condition, b.Condition) 2971 } 2972 2973 // RefOfJtColumnDefinition does deep equals between the two objects. 2974 func (cmp *Comparator) RefOfJtColumnDefinition(a, b *JtColumnDefinition) bool { 2975 if a == b { 2976 return true 2977 } 2978 if a == nil || b == nil { 2979 return false 2980 } 2981 return cmp.RefOfJtOrdinalColDef(a.JtOrdinal, b.JtOrdinal) && 2982 cmp.RefOfJtPathColDef(a.JtPath, b.JtPath) && 2983 cmp.RefOfJtNestedPathColDef(a.JtNestedPath, b.JtNestedPath) 2984 } 2985 2986 // RefOfJtOnResponse does deep equals between the two objects. 2987 func (cmp *Comparator) RefOfJtOnResponse(a, b *JtOnResponse) bool { 2988 if a == b { 2989 return true 2990 } 2991 if a == nil || b == nil { 2992 return false 2993 } 2994 return a.ResponseType == b.ResponseType && 2995 cmp.Expr(a.Expr, b.Expr) 2996 } 2997 2998 // RefOfKeyState does deep equals between the two objects. 2999 func (cmp *Comparator) RefOfKeyState(a, b *KeyState) bool { 3000 if a == b { 3001 return true 3002 } 3003 if a == nil || b == nil { 3004 return false 3005 } 3006 return a.Enable == b.Enable 3007 } 3008 3009 // RefOfLagLeadExpr does deep equals between the two objects. 3010 func (cmp *Comparator) RefOfLagLeadExpr(a, b *LagLeadExpr) bool { 3011 if a == b { 3012 return true 3013 } 3014 if a == nil || b == nil { 3015 return false 3016 } 3017 return a.Type == b.Type && 3018 cmp.Expr(a.Expr, b.Expr) && 3019 cmp.Expr(a.N, b.N) && 3020 cmp.Expr(a.Default, b.Default) && 3021 cmp.RefOfOverClause(a.OverClause, b.OverClause) && 3022 cmp.RefOfNullTreatmentClause(a.NullTreatmentClause, b.NullTreatmentClause) 3023 } 3024 3025 // RefOfLimit does deep equals between the two objects. 3026 func (cmp *Comparator) RefOfLimit(a, b *Limit) bool { 3027 if a == b { 3028 return true 3029 } 3030 if a == nil || b == nil { 3031 return false 3032 } 3033 return cmp.Expr(a.Offset, b.Offset) && 3034 cmp.Expr(a.Rowcount, b.Rowcount) 3035 } 3036 3037 // RefOfLineStringExpr does deep equals between the two objects. 3038 func (cmp *Comparator) RefOfLineStringExpr(a, b *LineStringExpr) bool { 3039 if a == b { 3040 return true 3041 } 3042 if a == nil || b == nil { 3043 return false 3044 } 3045 return cmp.Exprs(a.PointParams, b.PointParams) 3046 } 3047 3048 // RefOfLiteral does deep equals between the two objects. 3049 func (cmp *Comparator) RefOfLiteral(a, b *Literal) bool { 3050 if a == b { 3051 return true 3052 } 3053 if a == nil || b == nil { 3054 return false 3055 } 3056 return a.Val == b.Val && 3057 a.Type == b.Type 3058 } 3059 3060 // RefOfLoad does deep equals between the two objects. 3061 func (cmp *Comparator) RefOfLoad(a, b *Load) bool { 3062 if a == b { 3063 return true 3064 } 3065 if a == nil || b == nil { 3066 return false 3067 } 3068 return true 3069 } 3070 3071 // RefOfLocateExpr does deep equals between the two objects. 3072 func (cmp *Comparator) RefOfLocateExpr(a, b *LocateExpr) bool { 3073 if a == b { 3074 return true 3075 } 3076 if a == nil || b == nil { 3077 return false 3078 } 3079 return cmp.Expr(a.SubStr, b.SubStr) && 3080 cmp.Expr(a.Str, b.Str) && 3081 cmp.Expr(a.Pos, b.Pos) 3082 } 3083 3084 // RefOfLockOption does deep equals between the two objects. 3085 func (cmp *Comparator) RefOfLockOption(a, b *LockOption) bool { 3086 if a == b { 3087 return true 3088 } 3089 if a == nil || b == nil { 3090 return false 3091 } 3092 return a.Type == b.Type 3093 } 3094 3095 // RefOfLockTables does deep equals between the two objects. 3096 func (cmp *Comparator) RefOfLockTables(a, b *LockTables) bool { 3097 if a == b { 3098 return true 3099 } 3100 if a == nil || b == nil { 3101 return false 3102 } 3103 return cmp.TableAndLockTypes(a.Tables, b.Tables) 3104 } 3105 3106 // RefOfLockingFunc does deep equals between the two objects. 3107 func (cmp *Comparator) RefOfLockingFunc(a, b *LockingFunc) bool { 3108 if a == b { 3109 return true 3110 } 3111 if a == nil || b == nil { 3112 return false 3113 } 3114 return a.Type == b.Type && 3115 cmp.Expr(a.Name, b.Name) && 3116 cmp.Expr(a.Timeout, b.Timeout) 3117 } 3118 3119 // RefOfMatchExpr does deep equals between the two objects. 3120 func (cmp *Comparator) RefOfMatchExpr(a, b *MatchExpr) bool { 3121 if a == b { 3122 return true 3123 } 3124 if a == nil || b == nil { 3125 return false 3126 } 3127 return cmp.SliceOfRefOfColName(a.Columns, b.Columns) && 3128 cmp.Expr(a.Expr, b.Expr) && 3129 a.Option == b.Option 3130 } 3131 3132 // RefOfMax does deep equals between the two objects. 3133 func (cmp *Comparator) RefOfMax(a, b *Max) bool { 3134 if a == b { 3135 return true 3136 } 3137 if a == nil || b == nil { 3138 return false 3139 } 3140 return a.Distinct == b.Distinct && 3141 cmp.Expr(a.Arg, b.Arg) 3142 } 3143 3144 // RefOfMemberOfExpr does deep equals between the two objects. 3145 func (cmp *Comparator) RefOfMemberOfExpr(a, b *MemberOfExpr) bool { 3146 if a == b { 3147 return true 3148 } 3149 if a == nil || b == nil { 3150 return false 3151 } 3152 return cmp.Expr(a.Value, b.Value) && 3153 cmp.Expr(a.JSONArr, b.JSONArr) 3154 } 3155 3156 // RefOfMin does deep equals between the two objects. 3157 func (cmp *Comparator) RefOfMin(a, b *Min) bool { 3158 if a == b { 3159 return true 3160 } 3161 if a == nil || b == nil { 3162 return false 3163 } 3164 return a.Distinct == b.Distinct && 3165 cmp.Expr(a.Arg, b.Arg) 3166 } 3167 3168 // RefOfModifyColumn does deep equals between the two objects. 3169 func (cmp *Comparator) RefOfModifyColumn(a, b *ModifyColumn) bool { 3170 if a == b { 3171 return true 3172 } 3173 if a == nil || b == nil { 3174 return false 3175 } 3176 return a.First == b.First && 3177 cmp.RefOfColumnDefinition(a.NewColDefinition, b.NewColDefinition) && 3178 cmp.RefOfColName(a.After, b.After) 3179 } 3180 3181 // RefOfNTHValueExpr does deep equals between the two objects. 3182 func (cmp *Comparator) RefOfNTHValueExpr(a, b *NTHValueExpr) bool { 3183 if a == b { 3184 return true 3185 } 3186 if a == nil || b == nil { 3187 return false 3188 } 3189 return cmp.Expr(a.Expr, b.Expr) && 3190 cmp.Expr(a.N, b.N) && 3191 cmp.RefOfOverClause(a.OverClause, b.OverClause) && 3192 cmp.RefOfFromFirstLastClause(a.FromFirstLastClause, b.FromFirstLastClause) && 3193 cmp.RefOfNullTreatmentClause(a.NullTreatmentClause, b.NullTreatmentClause) 3194 } 3195 3196 // RefOfNamedWindow does deep equals between the two objects. 3197 func (cmp *Comparator) RefOfNamedWindow(a, b *NamedWindow) bool { 3198 if a == b { 3199 return true 3200 } 3201 if a == nil || b == nil { 3202 return false 3203 } 3204 return cmp.WindowDefinitions(a.Windows, b.Windows) 3205 } 3206 3207 // NamedWindows does deep equals between the two objects. 3208 func (cmp *Comparator) NamedWindows(a, b NamedWindows) bool { 3209 if len(a) != len(b) { 3210 return false 3211 } 3212 for i := 0; i < len(a); i++ { 3213 if !cmp.RefOfNamedWindow(a[i], b[i]) { 3214 return false 3215 } 3216 } 3217 return true 3218 } 3219 3220 // RefOfNextval does deep equals between the two objects. 3221 func (cmp *Comparator) RefOfNextval(a, b *Nextval) bool { 3222 if a == b { 3223 return true 3224 } 3225 if a == nil || b == nil { 3226 return false 3227 } 3228 return cmp.Expr(a.Expr, b.Expr) 3229 } 3230 3231 // RefOfNotExpr does deep equals between the two objects. 3232 func (cmp *Comparator) RefOfNotExpr(a, b *NotExpr) bool { 3233 if a == b { 3234 return true 3235 } 3236 if a == nil || b == nil { 3237 return false 3238 } 3239 return cmp.Expr(a.Expr, b.Expr) 3240 } 3241 3242 // RefOfNtileExpr does deep equals between the two objects. 3243 func (cmp *Comparator) RefOfNtileExpr(a, b *NtileExpr) bool { 3244 if a == b { 3245 return true 3246 } 3247 if a == nil || b == nil { 3248 return false 3249 } 3250 return cmp.Expr(a.N, b.N) && 3251 cmp.RefOfOverClause(a.OverClause, b.OverClause) 3252 } 3253 3254 // RefOfNullTreatmentClause does deep equals between the two objects. 3255 func (cmp *Comparator) RefOfNullTreatmentClause(a, b *NullTreatmentClause) bool { 3256 if a == b { 3257 return true 3258 } 3259 if a == nil || b == nil { 3260 return false 3261 } 3262 return a.Type == b.Type 3263 } 3264 3265 // RefOfNullVal does deep equals between the two objects. 3266 func (cmp *Comparator) RefOfNullVal(a, b *NullVal) bool { 3267 if a == b { 3268 return true 3269 } 3270 if a == nil || b == nil { 3271 return false 3272 } 3273 return true 3274 } 3275 3276 // RefOfOffset does deep equals between the two objects. 3277 func (cmp *Comparator) RefOfOffset(a, b *Offset) bool { 3278 if a == b { 3279 return true 3280 } 3281 if a == nil || b == nil { 3282 return false 3283 } 3284 return a.V == b.V && 3285 a.Original == b.Original 3286 } 3287 3288 // OnDup does deep equals between the two objects. 3289 func (cmp *Comparator) OnDup(a, b OnDup) bool { 3290 if len(a) != len(b) { 3291 return false 3292 } 3293 for i := 0; i < len(a); i++ { 3294 if !cmp.RefOfUpdateExpr(a[i], b[i]) { 3295 return false 3296 } 3297 } 3298 return true 3299 } 3300 3301 // RefOfOptLike does deep equals between the two objects. 3302 func (cmp *Comparator) RefOfOptLike(a, b *OptLike) bool { 3303 if a == b { 3304 return true 3305 } 3306 if a == nil || b == nil { 3307 return false 3308 } 3309 return cmp.TableName(a.LikeTable, b.LikeTable) 3310 } 3311 3312 // RefOfOrExpr does deep equals between the two objects. 3313 func (cmp *Comparator) RefOfOrExpr(a, b *OrExpr) bool { 3314 if a == b { 3315 return true 3316 } 3317 if a == nil || b == nil { 3318 return false 3319 } 3320 return cmp.Expr(a.Left, b.Left) && 3321 cmp.Expr(a.Right, b.Right) 3322 } 3323 3324 // RefOfOrder does deep equals between the two objects. 3325 func (cmp *Comparator) RefOfOrder(a, b *Order) bool { 3326 if a == b { 3327 return true 3328 } 3329 if a == nil || b == nil { 3330 return false 3331 } 3332 return cmp.Expr(a.Expr, b.Expr) && 3333 a.Direction == b.Direction 3334 } 3335 3336 // OrderBy does deep equals between the two objects. 3337 func (cmp *Comparator) OrderBy(a, b OrderBy) bool { 3338 if len(a) != len(b) { 3339 return false 3340 } 3341 for i := 0; i < len(a); i++ { 3342 if !cmp.RefOfOrder(a[i], b[i]) { 3343 return false 3344 } 3345 } 3346 return true 3347 } 3348 3349 // RefOfOrderByOption does deep equals between the two objects. 3350 func (cmp *Comparator) RefOfOrderByOption(a, b *OrderByOption) bool { 3351 if a == b { 3352 return true 3353 } 3354 if a == nil || b == nil { 3355 return false 3356 } 3357 return cmp.Columns(a.Cols, b.Cols) 3358 } 3359 3360 // RefOfOtherAdmin does deep equals between the two objects. 3361 func (cmp *Comparator) RefOfOtherAdmin(a, b *OtherAdmin) bool { 3362 if a == b { 3363 return true 3364 } 3365 if a == nil || b == nil { 3366 return false 3367 } 3368 return true 3369 } 3370 3371 // RefOfOtherRead does deep equals between the two objects. 3372 func (cmp *Comparator) RefOfOtherRead(a, b *OtherRead) bool { 3373 if a == b { 3374 return true 3375 } 3376 if a == nil || b == nil { 3377 return false 3378 } 3379 return true 3380 } 3381 3382 // RefOfOverClause does deep equals between the two objects. 3383 func (cmp *Comparator) RefOfOverClause(a, b *OverClause) bool { 3384 if a == b { 3385 return true 3386 } 3387 if a == nil || b == nil { 3388 return false 3389 } 3390 return cmp.IdentifierCI(a.WindowName, b.WindowName) && 3391 cmp.RefOfWindowSpecification(a.WindowSpec, b.WindowSpec) 3392 } 3393 3394 // RefOfParenTableExpr does deep equals between the two objects. 3395 func (cmp *Comparator) RefOfParenTableExpr(a, b *ParenTableExpr) bool { 3396 if a == b { 3397 return true 3398 } 3399 if a == nil || b == nil { 3400 return false 3401 } 3402 return cmp.TableExprs(a.Exprs, b.Exprs) 3403 } 3404 3405 // RefOfParsedComments does deep equals between the two objects. 3406 func (cmp *Comparator) RefOfParsedComments(a, b *ParsedComments) bool { 3407 if a == b { 3408 return true 3409 } 3410 if a == nil || b == nil { 3411 return false 3412 } 3413 return cmp.Comments(a.comments, b.comments) 3414 } 3415 3416 // RefOfPartitionDefinition does deep equals between the two objects. 3417 func (cmp *Comparator) RefOfPartitionDefinition(a, b *PartitionDefinition) bool { 3418 if a == b { 3419 return true 3420 } 3421 if a == nil || b == nil { 3422 return false 3423 } 3424 return cmp.IdentifierCI(a.Name, b.Name) && 3425 cmp.RefOfPartitionDefinitionOptions(a.Options, b.Options) 3426 } 3427 3428 // RefOfPartitionDefinitionOptions does deep equals between the two objects. 3429 func (cmp *Comparator) RefOfPartitionDefinitionOptions(a, b *PartitionDefinitionOptions) bool { 3430 if a == b { 3431 return true 3432 } 3433 if a == nil || b == nil { 3434 return false 3435 } 3436 return a.TableSpace == b.TableSpace && 3437 cmp.RefOfPartitionValueRange(a.ValueRange, b.ValueRange) && 3438 cmp.RefOfLiteral(a.Comment, b.Comment) && 3439 cmp.RefOfPartitionEngine(a.Engine, b.Engine) && 3440 cmp.RefOfLiteral(a.DataDirectory, b.DataDirectory) && 3441 cmp.RefOfLiteral(a.IndexDirectory, b.IndexDirectory) && 3442 cmp.RefOfInt(a.MaxRows, b.MaxRows) && 3443 cmp.RefOfInt(a.MinRows, b.MinRows) && 3444 cmp.SubPartitionDefinitions(a.SubPartitionDefinitions, b.SubPartitionDefinitions) 3445 } 3446 3447 // RefOfPartitionEngine does deep equals between the two objects. 3448 func (cmp *Comparator) RefOfPartitionEngine(a, b *PartitionEngine) bool { 3449 if a == b { 3450 return true 3451 } 3452 if a == nil || b == nil { 3453 return false 3454 } 3455 return a.Storage == b.Storage && 3456 a.Name == b.Name 3457 } 3458 3459 // RefOfPartitionOption does deep equals between the two objects. 3460 func (cmp *Comparator) RefOfPartitionOption(a, b *PartitionOption) bool { 3461 if a == b { 3462 return true 3463 } 3464 if a == nil || b == nil { 3465 return false 3466 } 3467 return a.IsLinear == b.IsLinear && 3468 a.KeyAlgorithm == b.KeyAlgorithm && 3469 a.Partitions == b.Partitions && 3470 a.Type == b.Type && 3471 cmp.Columns(a.ColList, b.ColList) && 3472 cmp.Expr(a.Expr, b.Expr) && 3473 cmp.RefOfSubPartition(a.SubPartition, b.SubPartition) && 3474 cmp.SliceOfRefOfPartitionDefinition(a.Definitions, b.Definitions) 3475 } 3476 3477 // RefOfPartitionSpec does deep equals between the two objects. 3478 func (cmp *Comparator) RefOfPartitionSpec(a, b *PartitionSpec) bool { 3479 if a == b { 3480 return true 3481 } 3482 if a == nil || b == nil { 3483 return false 3484 } 3485 return a.IsAll == b.IsAll && 3486 a.WithoutValidation == b.WithoutValidation && 3487 a.Action == b.Action && 3488 cmp.Partitions(a.Names, b.Names) && 3489 cmp.RefOfLiteral(a.Number, b.Number) && 3490 cmp.TableName(a.TableName, b.TableName) && 3491 cmp.SliceOfRefOfPartitionDefinition(a.Definitions, b.Definitions) 3492 } 3493 3494 // RefOfPartitionValueRange does deep equals between the two objects. 3495 func (cmp *Comparator) RefOfPartitionValueRange(a, b *PartitionValueRange) bool { 3496 if a == b { 3497 return true 3498 } 3499 if a == nil || b == nil { 3500 return false 3501 } 3502 return a.Maxvalue == b.Maxvalue && 3503 a.Type == b.Type && 3504 cmp.ValTuple(a.Range, b.Range) 3505 } 3506 3507 // Partitions does deep equals between the two objects. 3508 func (cmp *Comparator) Partitions(a, b Partitions) bool { 3509 if len(a) != len(b) { 3510 return false 3511 } 3512 for i := 0; i < len(a); i++ { 3513 if !cmp.IdentifierCI(a[i], b[i]) { 3514 return false 3515 } 3516 } 3517 return true 3518 } 3519 3520 // RefOfPerformanceSchemaFuncExpr does deep equals between the two objects. 3521 func (cmp *Comparator) RefOfPerformanceSchemaFuncExpr(a, b *PerformanceSchemaFuncExpr) bool { 3522 if a == b { 3523 return true 3524 } 3525 if a == nil || b == nil { 3526 return false 3527 } 3528 return a.Type == b.Type && 3529 cmp.Expr(a.Argument, b.Argument) 3530 } 3531 3532 // RefOfPointExpr does deep equals between the two objects. 3533 func (cmp *Comparator) RefOfPointExpr(a, b *PointExpr) bool { 3534 if a == b { 3535 return true 3536 } 3537 if a == nil || b == nil { 3538 return false 3539 } 3540 return cmp.Expr(a.XCordinate, b.XCordinate) && 3541 cmp.Expr(a.YCordinate, b.YCordinate) 3542 } 3543 3544 // RefOfPrepareStmt does deep equals between the two objects. 3545 func (cmp *Comparator) RefOfPrepareStmt(a, b *PrepareStmt) bool { 3546 if a == b { 3547 return true 3548 } 3549 if a == nil || b == nil { 3550 return false 3551 } 3552 return cmp.IdentifierCI(a.Name, b.Name) && 3553 cmp.Expr(a.Statement, b.Statement) && 3554 cmp.RefOfParsedComments(a.Comments, b.Comments) 3555 } 3556 3557 // RefOfReferenceDefinition does deep equals between the two objects. 3558 func (cmp *Comparator) RefOfReferenceDefinition(a, b *ReferenceDefinition) bool { 3559 if a == b { 3560 return true 3561 } 3562 if a == nil || b == nil { 3563 return false 3564 } 3565 return cmp.TableName(a.ReferencedTable, b.ReferencedTable) && 3566 cmp.Columns(a.ReferencedColumns, b.ReferencedColumns) && 3567 a.Match == b.Match && 3568 a.OnDelete == b.OnDelete && 3569 a.OnUpdate == b.OnUpdate 3570 } 3571 3572 // RefOfRegexpInstrExpr does deep equals between the two objects. 3573 func (cmp *Comparator) RefOfRegexpInstrExpr(a, b *RegexpInstrExpr) bool { 3574 if a == b { 3575 return true 3576 } 3577 if a == nil || b == nil { 3578 return false 3579 } 3580 return cmp.Expr(a.Expr, b.Expr) && 3581 cmp.Expr(a.Pattern, b.Pattern) && 3582 cmp.Expr(a.Position, b.Position) && 3583 cmp.Expr(a.Occurrence, b.Occurrence) && 3584 cmp.Expr(a.ReturnOption, b.ReturnOption) && 3585 cmp.Expr(a.MatchType, b.MatchType) 3586 } 3587 3588 // RefOfRegexpLikeExpr does deep equals between the two objects. 3589 func (cmp *Comparator) RefOfRegexpLikeExpr(a, b *RegexpLikeExpr) bool { 3590 if a == b { 3591 return true 3592 } 3593 if a == nil || b == nil { 3594 return false 3595 } 3596 return cmp.Expr(a.Expr, b.Expr) && 3597 cmp.Expr(a.Pattern, b.Pattern) && 3598 cmp.Expr(a.MatchType, b.MatchType) 3599 } 3600 3601 // RefOfRegexpReplaceExpr does deep equals between the two objects. 3602 func (cmp *Comparator) RefOfRegexpReplaceExpr(a, b *RegexpReplaceExpr) bool { 3603 if a == b { 3604 return true 3605 } 3606 if a == nil || b == nil { 3607 return false 3608 } 3609 return cmp.Expr(a.Expr, b.Expr) && 3610 cmp.Expr(a.Pattern, b.Pattern) && 3611 cmp.Expr(a.Repl, b.Repl) && 3612 cmp.Expr(a.Occurrence, b.Occurrence) && 3613 cmp.Expr(a.Position, b.Position) && 3614 cmp.Expr(a.MatchType, b.MatchType) 3615 } 3616 3617 // RefOfRegexpSubstrExpr does deep equals between the two objects. 3618 func (cmp *Comparator) RefOfRegexpSubstrExpr(a, b *RegexpSubstrExpr) bool { 3619 if a == b { 3620 return true 3621 } 3622 if a == nil || b == nil { 3623 return false 3624 } 3625 return cmp.Expr(a.Expr, b.Expr) && 3626 cmp.Expr(a.Pattern, b.Pattern) && 3627 cmp.Expr(a.Occurrence, b.Occurrence) && 3628 cmp.Expr(a.Position, b.Position) && 3629 cmp.Expr(a.MatchType, b.MatchType) 3630 } 3631 3632 // RefOfRelease does deep equals between the two objects. 3633 func (cmp *Comparator) RefOfRelease(a, b *Release) bool { 3634 if a == b { 3635 return true 3636 } 3637 if a == nil || b == nil { 3638 return false 3639 } 3640 return cmp.IdentifierCI(a.Name, b.Name) 3641 } 3642 3643 // RefOfRenameColumn does deep equals between the two objects. 3644 func (cmp *Comparator) RefOfRenameColumn(a, b *RenameColumn) bool { 3645 if a == b { 3646 return true 3647 } 3648 if a == nil || b == nil { 3649 return false 3650 } 3651 return cmp.RefOfColName(a.OldName, b.OldName) && 3652 cmp.RefOfColName(a.NewName, b.NewName) 3653 } 3654 3655 // RefOfRenameIndex does deep equals between the two objects. 3656 func (cmp *Comparator) RefOfRenameIndex(a, b *RenameIndex) bool { 3657 if a == b { 3658 return true 3659 } 3660 if a == nil || b == nil { 3661 return false 3662 } 3663 return cmp.IdentifierCI(a.OldName, b.OldName) && 3664 cmp.IdentifierCI(a.NewName, b.NewName) 3665 } 3666 3667 // RefOfRenameTable does deep equals between the two objects. 3668 func (cmp *Comparator) RefOfRenameTable(a, b *RenameTable) bool { 3669 if a == b { 3670 return true 3671 } 3672 if a == nil || b == nil { 3673 return false 3674 } 3675 return cmp.SliceOfRefOfRenameTablePair(a.TablePairs, b.TablePairs) 3676 } 3677 3678 // RefOfRenameTableName does deep equals between the two objects. 3679 func (cmp *Comparator) RefOfRenameTableName(a, b *RenameTableName) bool { 3680 if a == b { 3681 return true 3682 } 3683 if a == nil || b == nil { 3684 return false 3685 } 3686 return cmp.TableName(a.Table, b.Table) 3687 } 3688 3689 // RefOfRevertMigration does deep equals between the two objects. 3690 func (cmp *Comparator) RefOfRevertMigration(a, b *RevertMigration) bool { 3691 if a == b { 3692 return true 3693 } 3694 if a == nil || b == nil { 3695 return false 3696 } 3697 return a.UUID == b.UUID && 3698 cmp.RefOfParsedComments(a.Comments, b.Comments) 3699 } 3700 3701 // RefOfRollback does deep equals between the two objects. 3702 func (cmp *Comparator) RefOfRollback(a, b *Rollback) bool { 3703 if a == b { 3704 return true 3705 } 3706 if a == nil || b == nil { 3707 return false 3708 } 3709 return true 3710 } 3711 3712 // RootNode does deep equals between the two objects. 3713 func (cmp *Comparator) RootNode(a, b RootNode) bool { 3714 return cmp.SQLNode(a.SQLNode, b.SQLNode) 3715 } 3716 3717 // RefOfSRollback does deep equals between the two objects. 3718 func (cmp *Comparator) RefOfSRollback(a, b *SRollback) bool { 3719 if a == b { 3720 return true 3721 } 3722 if a == nil || b == nil { 3723 return false 3724 } 3725 return cmp.IdentifierCI(a.Name, b.Name) 3726 } 3727 3728 // RefOfSavepoint does deep equals between the two objects. 3729 func (cmp *Comparator) RefOfSavepoint(a, b *Savepoint) bool { 3730 if a == b { 3731 return true 3732 } 3733 if a == nil || b == nil { 3734 return false 3735 } 3736 return cmp.IdentifierCI(a.Name, b.Name) 3737 } 3738 3739 // RefOfSelect does deep equals between the two objects. 3740 func (cmp *Comparator) RefOfSelect(a, b *Select) bool { 3741 if a == b { 3742 return true 3743 } 3744 if a == nil || b == nil { 3745 return false 3746 } 3747 return a.Distinct == b.Distinct && 3748 a.StraightJoinHint == b.StraightJoinHint && 3749 a.SQLCalcFoundRows == b.SQLCalcFoundRows && 3750 cmp.RefOfBool(a.Cache, b.Cache) && 3751 cmp.SliceOfTableExpr(a.From, b.From) && 3752 cmp.RefOfParsedComments(a.Comments, b.Comments) && 3753 cmp.SelectExprs(a.SelectExprs, b.SelectExprs) && 3754 cmp.RefOfWhere(a.Where, b.Where) && 3755 cmp.RefOfWith(a.With, b.With) && 3756 cmp.GroupBy(a.GroupBy, b.GroupBy) && 3757 cmp.RefOfWhere(a.Having, b.Having) && 3758 cmp.NamedWindows(a.Windows, b.Windows) && 3759 cmp.OrderBy(a.OrderBy, b.OrderBy) && 3760 cmp.RefOfLimit(a.Limit, b.Limit) && 3761 a.Lock == b.Lock && 3762 cmp.RefOfSelectInto(a.Into, b.Into) 3763 } 3764 3765 // SelectExprs does deep equals between the two objects. 3766 func (cmp *Comparator) SelectExprs(a, b SelectExprs) bool { 3767 if len(a) != len(b) { 3768 return false 3769 } 3770 for i := 0; i < len(a); i++ { 3771 if !cmp.SelectExpr(a[i], b[i]) { 3772 return false 3773 } 3774 } 3775 return true 3776 } 3777 3778 // RefOfSelectInto does deep equals between the two objects. 3779 func (cmp *Comparator) RefOfSelectInto(a, b *SelectInto) bool { 3780 if a == b { 3781 return true 3782 } 3783 if a == nil || b == nil { 3784 return false 3785 } 3786 return a.FileName == b.FileName && 3787 a.FormatOption == b.FormatOption && 3788 a.ExportOption == b.ExportOption && 3789 a.Manifest == b.Manifest && 3790 a.Overwrite == b.Overwrite && 3791 a.Type == b.Type && 3792 cmp.ColumnCharset(a.Charset, b.Charset) 3793 } 3794 3795 // RefOfSet does deep equals between the two objects. 3796 func (cmp *Comparator) RefOfSet(a, b *Set) bool { 3797 if a == b { 3798 return true 3799 } 3800 if a == nil || b == nil { 3801 return false 3802 } 3803 return cmp.RefOfParsedComments(a.Comments, b.Comments) && 3804 cmp.SetExprs(a.Exprs, b.Exprs) 3805 } 3806 3807 // RefOfSetExpr does deep equals between the two objects. 3808 func (cmp *Comparator) RefOfSetExpr(a, b *SetExpr) bool { 3809 if a == b { 3810 return true 3811 } 3812 if a == nil || b == nil { 3813 return false 3814 } 3815 return cmp.RefOfVariable(a.Var, b.Var) && 3816 cmp.Expr(a.Expr, b.Expr) 3817 } 3818 3819 // SetExprs does deep equals between the two objects. 3820 func (cmp *Comparator) SetExprs(a, b SetExprs) bool { 3821 if len(a) != len(b) { 3822 return false 3823 } 3824 for i := 0; i < len(a); i++ { 3825 if !cmp.RefOfSetExpr(a[i], b[i]) { 3826 return false 3827 } 3828 } 3829 return true 3830 } 3831 3832 // RefOfShow does deep equals between the two objects. 3833 func (cmp *Comparator) RefOfShow(a, b *Show) bool { 3834 if a == b { 3835 return true 3836 } 3837 if a == nil || b == nil { 3838 return false 3839 } 3840 return cmp.ShowInternal(a.Internal, b.Internal) 3841 } 3842 3843 // RefOfShowBasic does deep equals between the two objects. 3844 func (cmp *Comparator) RefOfShowBasic(a, b *ShowBasic) bool { 3845 if a == b { 3846 return true 3847 } 3848 if a == nil || b == nil { 3849 return false 3850 } 3851 return a.Full == b.Full && 3852 a.Command == b.Command && 3853 cmp.TableName(a.Tbl, b.Tbl) && 3854 cmp.IdentifierCS(a.DbName, b.DbName) && 3855 cmp.RefOfShowFilter(a.Filter, b.Filter) 3856 } 3857 3858 // RefOfShowCreate does deep equals between the two objects. 3859 func (cmp *Comparator) RefOfShowCreate(a, b *ShowCreate) bool { 3860 if a == b { 3861 return true 3862 } 3863 if a == nil || b == nil { 3864 return false 3865 } 3866 return a.Command == b.Command && 3867 cmp.TableName(a.Op, b.Op) 3868 } 3869 3870 // RefOfShowFilter does deep equals between the two objects. 3871 func (cmp *Comparator) RefOfShowFilter(a, b *ShowFilter) bool { 3872 if a == b { 3873 return true 3874 } 3875 if a == nil || b == nil { 3876 return false 3877 } 3878 return a.Like == b.Like && 3879 cmp.Expr(a.Filter, b.Filter) 3880 } 3881 3882 // RefOfShowMigrationLogs does deep equals between the two objects. 3883 func (cmp *Comparator) RefOfShowMigrationLogs(a, b *ShowMigrationLogs) bool { 3884 if a == b { 3885 return true 3886 } 3887 if a == nil || b == nil { 3888 return false 3889 } 3890 return a.UUID == b.UUID && 3891 cmp.RefOfParsedComments(a.Comments, b.Comments) 3892 } 3893 3894 // RefOfShowOther does deep equals between the two objects. 3895 func (cmp *Comparator) RefOfShowOther(a, b *ShowOther) bool { 3896 if a == b { 3897 return true 3898 } 3899 if a == nil || b == nil { 3900 return false 3901 } 3902 return a.Command == b.Command 3903 } 3904 3905 // RefOfShowThrottledApps does deep equals between the two objects. 3906 func (cmp *Comparator) RefOfShowThrottledApps(a, b *ShowThrottledApps) bool { 3907 if a == b { 3908 return true 3909 } 3910 if a == nil || b == nil { 3911 return false 3912 } 3913 return cmp.Comments(a.Comments, b.Comments) 3914 } 3915 3916 // RefOfShowThrottlerStatus does deep equals between the two objects. 3917 func (cmp *Comparator) RefOfShowThrottlerStatus(a, b *ShowThrottlerStatus) bool { 3918 if a == b { 3919 return true 3920 } 3921 if a == nil || b == nil { 3922 return false 3923 } 3924 return cmp.Comments(a.Comments, b.Comments) 3925 } 3926 3927 // RefOfStarExpr does deep equals between the two objects. 3928 func (cmp *Comparator) RefOfStarExpr(a, b *StarExpr) bool { 3929 if a == b { 3930 return true 3931 } 3932 if a == nil || b == nil { 3933 return false 3934 } 3935 return cmp.TableName(a.TableName, b.TableName) 3936 } 3937 3938 // RefOfStd does deep equals between the two objects. 3939 func (cmp *Comparator) RefOfStd(a, b *Std) bool { 3940 if a == b { 3941 return true 3942 } 3943 if a == nil || b == nil { 3944 return false 3945 } 3946 return cmp.Expr(a.Arg, b.Arg) 3947 } 3948 3949 // RefOfStdDev does deep equals between the two objects. 3950 func (cmp *Comparator) RefOfStdDev(a, b *StdDev) bool { 3951 if a == b { 3952 return true 3953 } 3954 if a == nil || b == nil { 3955 return false 3956 } 3957 return cmp.Expr(a.Arg, b.Arg) 3958 } 3959 3960 // RefOfStdPop does deep equals between the two objects. 3961 func (cmp *Comparator) RefOfStdPop(a, b *StdPop) bool { 3962 if a == b { 3963 return true 3964 } 3965 if a == nil || b == nil { 3966 return false 3967 } 3968 return cmp.Expr(a.Arg, b.Arg) 3969 } 3970 3971 // RefOfStdSamp does deep equals between the two objects. 3972 func (cmp *Comparator) RefOfStdSamp(a, b *StdSamp) bool { 3973 if a == b { 3974 return true 3975 } 3976 if a == nil || b == nil { 3977 return false 3978 } 3979 return cmp.Expr(a.Arg, b.Arg) 3980 } 3981 3982 // RefOfStream does deep equals between the two objects. 3983 func (cmp *Comparator) RefOfStream(a, b *Stream) bool { 3984 if a == b { 3985 return true 3986 } 3987 if a == nil || b == nil { 3988 return false 3989 } 3990 return cmp.RefOfParsedComments(a.Comments, b.Comments) && 3991 cmp.SelectExpr(a.SelectExpr, b.SelectExpr) && 3992 cmp.TableName(a.Table, b.Table) 3993 } 3994 3995 // RefOfSubPartition does deep equals between the two objects. 3996 func (cmp *Comparator) RefOfSubPartition(a, b *SubPartition) bool { 3997 if a == b { 3998 return true 3999 } 4000 if a == nil || b == nil { 4001 return false 4002 } 4003 return a.IsLinear == b.IsLinear && 4004 a.KeyAlgorithm == b.KeyAlgorithm && 4005 a.SubPartitions == b.SubPartitions && 4006 a.Type == b.Type && 4007 cmp.Columns(a.ColList, b.ColList) && 4008 cmp.Expr(a.Expr, b.Expr) 4009 } 4010 4011 // RefOfSubPartitionDefinition does deep equals between the two objects. 4012 func (cmp *Comparator) RefOfSubPartitionDefinition(a, b *SubPartitionDefinition) bool { 4013 if a == b { 4014 return true 4015 } 4016 if a == nil || b == nil { 4017 return false 4018 } 4019 return cmp.IdentifierCI(a.Name, b.Name) && 4020 cmp.RefOfSubPartitionDefinitionOptions(a.Options, b.Options) 4021 } 4022 4023 // RefOfSubPartitionDefinitionOptions does deep equals between the two objects. 4024 func (cmp *Comparator) RefOfSubPartitionDefinitionOptions(a, b *SubPartitionDefinitionOptions) bool { 4025 if a == b { 4026 return true 4027 } 4028 if a == nil || b == nil { 4029 return false 4030 } 4031 return a.TableSpace == b.TableSpace && 4032 cmp.RefOfLiteral(a.Comment, b.Comment) && 4033 cmp.RefOfPartitionEngine(a.Engine, b.Engine) && 4034 cmp.RefOfLiteral(a.DataDirectory, b.DataDirectory) && 4035 cmp.RefOfLiteral(a.IndexDirectory, b.IndexDirectory) && 4036 cmp.RefOfInt(a.MaxRows, b.MaxRows) && 4037 cmp.RefOfInt(a.MinRows, b.MinRows) 4038 } 4039 4040 // SubPartitionDefinitions does deep equals between the two objects. 4041 func (cmp *Comparator) SubPartitionDefinitions(a, b SubPartitionDefinitions) bool { 4042 if len(a) != len(b) { 4043 return false 4044 } 4045 for i := 0; i < len(a); i++ { 4046 if !cmp.RefOfSubPartitionDefinition(a[i], b[i]) { 4047 return false 4048 } 4049 } 4050 return true 4051 } 4052 4053 // RefOfSubquery does deep equals between the two objects. 4054 func (cmp *Comparator) RefOfSubquery(a, b *Subquery) bool { 4055 if a == b { 4056 return true 4057 } 4058 if a == nil || b == nil { 4059 return false 4060 } 4061 return cmp.SelectStatement(a.Select, b.Select) 4062 } 4063 4064 // RefOfSubstrExpr does deep equals between the two objects. 4065 func (cmp *Comparator) RefOfSubstrExpr(a, b *SubstrExpr) bool { 4066 if a == b { 4067 return true 4068 } 4069 if a == nil || b == nil { 4070 return false 4071 } 4072 return cmp.Expr(a.Name, b.Name) && 4073 cmp.Expr(a.From, b.From) && 4074 cmp.Expr(a.To, b.To) 4075 } 4076 4077 // RefOfSum does deep equals between the two objects. 4078 func (cmp *Comparator) RefOfSum(a, b *Sum) bool { 4079 if a == b { 4080 return true 4081 } 4082 if a == nil || b == nil { 4083 return false 4084 } 4085 return a.Distinct == b.Distinct && 4086 cmp.Expr(a.Arg, b.Arg) 4087 } 4088 4089 // TableExprs does deep equals between the two objects. 4090 func (cmp *Comparator) TableExprs(a, b TableExprs) bool { 4091 if len(a) != len(b) { 4092 return false 4093 } 4094 for i := 0; i < len(a); i++ { 4095 if !cmp.TableExpr(a[i], b[i]) { 4096 return false 4097 } 4098 } 4099 return true 4100 } 4101 4102 // TableName does deep equals between the two objects. 4103 func (cmp *Comparator) TableName(a, b TableName) bool { 4104 return cmp.IdentifierCS(a.Name, b.Name) && 4105 cmp.IdentifierCS(a.Qualifier, b.Qualifier) 4106 } 4107 4108 // TableNames does deep equals between the two objects. 4109 func (cmp *Comparator) TableNames(a, b TableNames) bool { 4110 if len(a) != len(b) { 4111 return false 4112 } 4113 for i := 0; i < len(a); i++ { 4114 if !cmp.TableName(a[i], b[i]) { 4115 return false 4116 } 4117 } 4118 return true 4119 } 4120 4121 // TableOptions does deep equals between the two objects. 4122 func (cmp *Comparator) TableOptions(a, b TableOptions) bool { 4123 if len(a) != len(b) { 4124 return false 4125 } 4126 for i := 0; i < len(a); i++ { 4127 if !cmp.RefOfTableOption(a[i], b[i]) { 4128 return false 4129 } 4130 } 4131 return true 4132 } 4133 4134 // RefOfTableSpec does deep equals between the two objects. 4135 func (cmp *Comparator) RefOfTableSpec(a, b *TableSpec) bool { 4136 if a == b { 4137 return true 4138 } 4139 if a == nil || b == nil { 4140 return false 4141 } 4142 return cmp.SliceOfRefOfColumnDefinition(a.Columns, b.Columns) && 4143 cmp.SliceOfRefOfIndexDefinition(a.Indexes, b.Indexes) && 4144 cmp.SliceOfRefOfConstraintDefinition(a.Constraints, b.Constraints) && 4145 cmp.TableOptions(a.Options, b.Options) && 4146 cmp.RefOfPartitionOption(a.PartitionOption, b.PartitionOption) 4147 } 4148 4149 // RefOfTablespaceOperation does deep equals between the two objects. 4150 func (cmp *Comparator) RefOfTablespaceOperation(a, b *TablespaceOperation) bool { 4151 if a == b { 4152 return true 4153 } 4154 if a == nil || b == nil { 4155 return false 4156 } 4157 return a.Import == b.Import 4158 } 4159 4160 // RefOfTimestampFuncExpr does deep equals between the two objects. 4161 func (cmp *Comparator) RefOfTimestampFuncExpr(a, b *TimestampFuncExpr) bool { 4162 if a == b { 4163 return true 4164 } 4165 if a == nil || b == nil { 4166 return false 4167 } 4168 return a.Name == b.Name && 4169 a.Unit == b.Unit && 4170 cmp.Expr(a.Expr1, b.Expr1) && 4171 cmp.Expr(a.Expr2, b.Expr2) 4172 } 4173 4174 // RefOfTrimFuncExpr does deep equals between the two objects. 4175 func (cmp *Comparator) RefOfTrimFuncExpr(a, b *TrimFuncExpr) bool { 4176 if a == b { 4177 return true 4178 } 4179 if a == nil || b == nil { 4180 return false 4181 } 4182 return a.TrimFuncType == b.TrimFuncType && 4183 a.Type == b.Type && 4184 cmp.Expr(a.TrimArg, b.TrimArg) && 4185 cmp.Expr(a.StringArg, b.StringArg) 4186 } 4187 4188 // RefOfTruncateTable does deep equals between the two objects. 4189 func (cmp *Comparator) RefOfTruncateTable(a, b *TruncateTable) bool { 4190 if a == b { 4191 return true 4192 } 4193 if a == nil || b == nil { 4194 return false 4195 } 4196 return cmp.TableName(a.Table, b.Table) 4197 } 4198 4199 // RefOfUnaryExpr does deep equals between the two objects. 4200 func (cmp *Comparator) RefOfUnaryExpr(a, b *UnaryExpr) bool { 4201 if a == b { 4202 return true 4203 } 4204 if a == nil || b == nil { 4205 return false 4206 } 4207 return a.Operator == b.Operator && 4208 cmp.Expr(a.Expr, b.Expr) 4209 } 4210 4211 // RefOfUnion does deep equals between the two objects. 4212 func (cmp *Comparator) RefOfUnion(a, b *Union) bool { 4213 if a == b { 4214 return true 4215 } 4216 if a == nil || b == nil { 4217 return false 4218 } 4219 return a.Distinct == b.Distinct && 4220 cmp.SelectStatement(a.Left, b.Left) && 4221 cmp.SelectStatement(a.Right, b.Right) && 4222 cmp.OrderBy(a.OrderBy, b.OrderBy) && 4223 cmp.RefOfWith(a.With, b.With) && 4224 cmp.RefOfLimit(a.Limit, b.Limit) && 4225 a.Lock == b.Lock && 4226 cmp.RefOfSelectInto(a.Into, b.Into) 4227 } 4228 4229 // RefOfUnlockTables does deep equals between the two objects. 4230 func (cmp *Comparator) RefOfUnlockTables(a, b *UnlockTables) bool { 4231 if a == b { 4232 return true 4233 } 4234 if a == nil || b == nil { 4235 return false 4236 } 4237 return true 4238 } 4239 4240 // RefOfUpdate does deep equals between the two objects. 4241 func (cmp *Comparator) RefOfUpdate(a, b *Update) bool { 4242 if a == b { 4243 return true 4244 } 4245 if a == nil || b == nil { 4246 return false 4247 } 4248 return cmp.RefOfWith(a.With, b.With) && 4249 cmp.RefOfParsedComments(a.Comments, b.Comments) && 4250 a.Ignore == b.Ignore && 4251 cmp.TableExprs(a.TableExprs, b.TableExprs) && 4252 cmp.UpdateExprs(a.Exprs, b.Exprs) && 4253 cmp.RefOfWhere(a.Where, b.Where) && 4254 cmp.OrderBy(a.OrderBy, b.OrderBy) && 4255 cmp.RefOfLimit(a.Limit, b.Limit) 4256 } 4257 4258 // RefOfUpdateExpr does deep equals between the two objects. 4259 func (cmp *Comparator) RefOfUpdateExpr(a, b *UpdateExpr) bool { 4260 if a == b { 4261 return true 4262 } 4263 if a == nil || b == nil { 4264 return false 4265 } 4266 return cmp.RefOfColName(a.Name, b.Name) && 4267 cmp.Expr(a.Expr, b.Expr) 4268 } 4269 4270 // UpdateExprs does deep equals between the two objects. 4271 func (cmp *Comparator) UpdateExprs(a, b UpdateExprs) bool { 4272 if len(a) != len(b) { 4273 return false 4274 } 4275 for i := 0; i < len(a); i++ { 4276 if !cmp.RefOfUpdateExpr(a[i], b[i]) { 4277 return false 4278 } 4279 } 4280 return true 4281 } 4282 4283 // RefOfUpdateXMLExpr does deep equals between the two objects. 4284 func (cmp *Comparator) RefOfUpdateXMLExpr(a, b *UpdateXMLExpr) bool { 4285 if a == b { 4286 return true 4287 } 4288 if a == nil || b == nil { 4289 return false 4290 } 4291 return cmp.Expr(a.Target, b.Target) && 4292 cmp.Expr(a.XPathExpr, b.XPathExpr) && 4293 cmp.Expr(a.NewXML, b.NewXML) 4294 } 4295 4296 // RefOfUse does deep equals between the two objects. 4297 func (cmp *Comparator) RefOfUse(a, b *Use) bool { 4298 if a == b { 4299 return true 4300 } 4301 if a == nil || b == nil { 4302 return false 4303 } 4304 return cmp.IdentifierCS(a.DBName, b.DBName) 4305 } 4306 4307 // RefOfVExplainStmt does deep equals between the two objects. 4308 func (cmp *Comparator) RefOfVExplainStmt(a, b *VExplainStmt) bool { 4309 if a == b { 4310 return true 4311 } 4312 if a == nil || b == nil { 4313 return false 4314 } 4315 return a.Type == b.Type && 4316 cmp.Statement(a.Statement, b.Statement) && 4317 cmp.RefOfParsedComments(a.Comments, b.Comments) 4318 } 4319 4320 // RefOfVStream does deep equals between the two objects. 4321 func (cmp *Comparator) RefOfVStream(a, b *VStream) bool { 4322 if a == b { 4323 return true 4324 } 4325 if a == nil || b == nil { 4326 return false 4327 } 4328 return cmp.RefOfParsedComments(a.Comments, b.Comments) && 4329 cmp.SelectExpr(a.SelectExpr, b.SelectExpr) && 4330 cmp.TableName(a.Table, b.Table) && 4331 cmp.RefOfWhere(a.Where, b.Where) && 4332 cmp.RefOfLimit(a.Limit, b.Limit) 4333 } 4334 4335 // ValTuple does deep equals between the two objects. 4336 func (cmp *Comparator) ValTuple(a, b ValTuple) bool { 4337 if len(a) != len(b) { 4338 return false 4339 } 4340 for i := 0; i < len(a); i++ { 4341 if !cmp.Expr(a[i], b[i]) { 4342 return false 4343 } 4344 } 4345 return true 4346 } 4347 4348 // RefOfValidation does deep equals between the two objects. 4349 func (cmp *Comparator) RefOfValidation(a, b *Validation) bool { 4350 if a == b { 4351 return true 4352 } 4353 if a == nil || b == nil { 4354 return false 4355 } 4356 return a.With == b.With 4357 } 4358 4359 // Values does deep equals between the two objects. 4360 func (cmp *Comparator) Values(a, b Values) bool { 4361 if len(a) != len(b) { 4362 return false 4363 } 4364 for i := 0; i < len(a); i++ { 4365 if !cmp.ValTuple(a[i], b[i]) { 4366 return false 4367 } 4368 } 4369 return true 4370 } 4371 4372 // RefOfValuesFuncExpr does deep equals between the two objects. 4373 func (cmp *Comparator) RefOfValuesFuncExpr(a, b *ValuesFuncExpr) bool { 4374 if a == b { 4375 return true 4376 } 4377 if a == nil || b == nil { 4378 return false 4379 } 4380 return cmp.RefOfColName(a.Name, b.Name) 4381 } 4382 4383 // RefOfVarPop does deep equals between the two objects. 4384 func (cmp *Comparator) RefOfVarPop(a, b *VarPop) bool { 4385 if a == b { 4386 return true 4387 } 4388 if a == nil || b == nil { 4389 return false 4390 } 4391 return cmp.Expr(a.Arg, b.Arg) 4392 } 4393 4394 // RefOfVarSamp does deep equals between the two objects. 4395 func (cmp *Comparator) RefOfVarSamp(a, b *VarSamp) bool { 4396 if a == b { 4397 return true 4398 } 4399 if a == nil || b == nil { 4400 return false 4401 } 4402 return cmp.Expr(a.Arg, b.Arg) 4403 } 4404 4405 // RefOfVariable does deep equals between the two objects. 4406 func (cmp *Comparator) RefOfVariable(a, b *Variable) bool { 4407 if a == b { 4408 return true 4409 } 4410 if a == nil || b == nil { 4411 return false 4412 } 4413 return a.Scope == b.Scope && 4414 cmp.IdentifierCI(a.Name, b.Name) 4415 } 4416 4417 // RefOfVariance does deep equals between the two objects. 4418 func (cmp *Comparator) RefOfVariance(a, b *Variance) bool { 4419 if a == b { 4420 return true 4421 } 4422 if a == nil || b == nil { 4423 return false 4424 } 4425 return cmp.Expr(a.Arg, b.Arg) 4426 } 4427 4428 // VindexParam does deep equals between the two objects. 4429 func (cmp *Comparator) VindexParam(a, b VindexParam) bool { 4430 return a.Val == b.Val && 4431 cmp.IdentifierCI(a.Key, b.Key) 4432 } 4433 4434 // RefOfVindexSpec does deep equals between the two objects. 4435 func (cmp *Comparator) RefOfVindexSpec(a, b *VindexSpec) bool { 4436 if a == b { 4437 return true 4438 } 4439 if a == nil || b == nil { 4440 return false 4441 } 4442 return cmp.IdentifierCI(a.Name, b.Name) && 4443 cmp.IdentifierCI(a.Type, b.Type) && 4444 cmp.SliceOfVindexParam(a.Params, b.Params) 4445 } 4446 4447 // RefOfWeightStringFuncExpr does deep equals between the two objects. 4448 func (cmp *Comparator) RefOfWeightStringFuncExpr(a, b *WeightStringFuncExpr) bool { 4449 if a == b { 4450 return true 4451 } 4452 if a == nil || b == nil { 4453 return false 4454 } 4455 return cmp.Expr(a.Expr, b.Expr) && 4456 cmp.RefOfConvertType(a.As, b.As) 4457 } 4458 4459 // RefOfWhen does deep equals between the two objects. 4460 func (cmp *Comparator) RefOfWhen(a, b *When) bool { 4461 if a == b { 4462 return true 4463 } 4464 if a == nil || b == nil { 4465 return false 4466 } 4467 return cmp.Expr(a.Cond, b.Cond) && 4468 cmp.Expr(a.Val, b.Val) 4469 } 4470 4471 // RefOfWhere does deep equals between the two objects. 4472 func (cmp *Comparator) RefOfWhere(a, b *Where) bool { 4473 if a == b { 4474 return true 4475 } 4476 if a == nil || b == nil { 4477 return false 4478 } 4479 return a.Type == b.Type && 4480 cmp.Expr(a.Expr, b.Expr) 4481 } 4482 4483 // RefOfWindowDefinition does deep equals between the two objects. 4484 func (cmp *Comparator) RefOfWindowDefinition(a, b *WindowDefinition) bool { 4485 if a == b { 4486 return true 4487 } 4488 if a == nil || b == nil { 4489 return false 4490 } 4491 return cmp.IdentifierCI(a.Name, b.Name) && 4492 cmp.RefOfWindowSpecification(a.WindowSpec, b.WindowSpec) 4493 } 4494 4495 // WindowDefinitions does deep equals between the two objects. 4496 func (cmp *Comparator) WindowDefinitions(a, b WindowDefinitions) bool { 4497 if len(a) != len(b) { 4498 return false 4499 } 4500 for i := 0; i < len(a); i++ { 4501 if !cmp.RefOfWindowDefinition(a[i], b[i]) { 4502 return false 4503 } 4504 } 4505 return true 4506 } 4507 4508 // RefOfWindowSpecification does deep equals between the two objects. 4509 func (cmp *Comparator) RefOfWindowSpecification(a, b *WindowSpecification) bool { 4510 if a == b { 4511 return true 4512 } 4513 if a == nil || b == nil { 4514 return false 4515 } 4516 return cmp.IdentifierCI(a.Name, b.Name) && 4517 cmp.Exprs(a.PartitionClause, b.PartitionClause) && 4518 cmp.OrderBy(a.OrderClause, b.OrderClause) && 4519 cmp.RefOfFrameClause(a.FrameClause, b.FrameClause) 4520 } 4521 4522 // RefOfWith does deep equals between the two objects. 4523 func (cmp *Comparator) RefOfWith(a, b *With) bool { 4524 if a == b { 4525 return true 4526 } 4527 if a == nil || b == nil { 4528 return false 4529 } 4530 return a.Recursive == b.Recursive && 4531 cmp.SliceOfRefOfCommonTableExpr(a.Ctes, b.Ctes) 4532 } 4533 4534 // RefOfXorExpr does deep equals between the two objects. 4535 func (cmp *Comparator) RefOfXorExpr(a, b *XorExpr) bool { 4536 if a == b { 4537 return true 4538 } 4539 if a == nil || b == nil { 4540 return false 4541 } 4542 return cmp.Expr(a.Left, b.Left) && 4543 cmp.Expr(a.Right, b.Right) 4544 } 4545 4546 // AggrFunc does deep equals between the two objects. 4547 func (cmp *Comparator) AggrFunc(inA, inB AggrFunc) bool { 4548 if inA == nil && inB == nil { 4549 return true 4550 } 4551 if inA == nil || inB == nil { 4552 return false 4553 } 4554 switch a := inA.(type) { 4555 case *Avg: 4556 b, ok := inB.(*Avg) 4557 if !ok { 4558 return false 4559 } 4560 return cmp.RefOfAvg(a, b) 4561 case *BitAnd: 4562 b, ok := inB.(*BitAnd) 4563 if !ok { 4564 return false 4565 } 4566 return cmp.RefOfBitAnd(a, b) 4567 case *BitOr: 4568 b, ok := inB.(*BitOr) 4569 if !ok { 4570 return false 4571 } 4572 return cmp.RefOfBitOr(a, b) 4573 case *BitXor: 4574 b, ok := inB.(*BitXor) 4575 if !ok { 4576 return false 4577 } 4578 return cmp.RefOfBitXor(a, b) 4579 case *Count: 4580 b, ok := inB.(*Count) 4581 if !ok { 4582 return false 4583 } 4584 return cmp.RefOfCount(a, b) 4585 case *CountStar: 4586 b, ok := inB.(*CountStar) 4587 if !ok { 4588 return false 4589 } 4590 return cmp.RefOfCountStar(a, b) 4591 case *GroupConcatExpr: 4592 b, ok := inB.(*GroupConcatExpr) 4593 if !ok { 4594 return false 4595 } 4596 return cmp.RefOfGroupConcatExpr(a, b) 4597 case *Max: 4598 b, ok := inB.(*Max) 4599 if !ok { 4600 return false 4601 } 4602 return cmp.RefOfMax(a, b) 4603 case *Min: 4604 b, ok := inB.(*Min) 4605 if !ok { 4606 return false 4607 } 4608 return cmp.RefOfMin(a, b) 4609 case *Std: 4610 b, ok := inB.(*Std) 4611 if !ok { 4612 return false 4613 } 4614 return cmp.RefOfStd(a, b) 4615 case *StdDev: 4616 b, ok := inB.(*StdDev) 4617 if !ok { 4618 return false 4619 } 4620 return cmp.RefOfStdDev(a, b) 4621 case *StdPop: 4622 b, ok := inB.(*StdPop) 4623 if !ok { 4624 return false 4625 } 4626 return cmp.RefOfStdPop(a, b) 4627 case *StdSamp: 4628 b, ok := inB.(*StdSamp) 4629 if !ok { 4630 return false 4631 } 4632 return cmp.RefOfStdSamp(a, b) 4633 case *Sum: 4634 b, ok := inB.(*Sum) 4635 if !ok { 4636 return false 4637 } 4638 return cmp.RefOfSum(a, b) 4639 case *VarPop: 4640 b, ok := inB.(*VarPop) 4641 if !ok { 4642 return false 4643 } 4644 return cmp.RefOfVarPop(a, b) 4645 case *VarSamp: 4646 b, ok := inB.(*VarSamp) 4647 if !ok { 4648 return false 4649 } 4650 return cmp.RefOfVarSamp(a, b) 4651 case *Variance: 4652 b, ok := inB.(*Variance) 4653 if !ok { 4654 return false 4655 } 4656 return cmp.RefOfVariance(a, b) 4657 default: 4658 // this should never happen 4659 return false 4660 } 4661 } 4662 4663 // AlterOption does deep equals between the two objects. 4664 func (cmp *Comparator) AlterOption(inA, inB AlterOption) bool { 4665 if inA == nil && inB == nil { 4666 return true 4667 } 4668 if inA == nil || inB == nil { 4669 return false 4670 } 4671 switch a := inA.(type) { 4672 case *AddColumns: 4673 b, ok := inB.(*AddColumns) 4674 if !ok { 4675 return false 4676 } 4677 return cmp.RefOfAddColumns(a, b) 4678 case *AddConstraintDefinition: 4679 b, ok := inB.(*AddConstraintDefinition) 4680 if !ok { 4681 return false 4682 } 4683 return cmp.RefOfAddConstraintDefinition(a, b) 4684 case *AddIndexDefinition: 4685 b, ok := inB.(*AddIndexDefinition) 4686 if !ok { 4687 return false 4688 } 4689 return cmp.RefOfAddIndexDefinition(a, b) 4690 case AlgorithmValue: 4691 b, ok := inB.(AlgorithmValue) 4692 if !ok { 4693 return false 4694 } 4695 return a == b 4696 case *AlterCharset: 4697 b, ok := inB.(*AlterCharset) 4698 if !ok { 4699 return false 4700 } 4701 return cmp.RefOfAlterCharset(a, b) 4702 case *AlterCheck: 4703 b, ok := inB.(*AlterCheck) 4704 if !ok { 4705 return false 4706 } 4707 return cmp.RefOfAlterCheck(a, b) 4708 case *AlterColumn: 4709 b, ok := inB.(*AlterColumn) 4710 if !ok { 4711 return false 4712 } 4713 return cmp.RefOfAlterColumn(a, b) 4714 case *AlterIndex: 4715 b, ok := inB.(*AlterIndex) 4716 if !ok { 4717 return false 4718 } 4719 return cmp.RefOfAlterIndex(a, b) 4720 case *ChangeColumn: 4721 b, ok := inB.(*ChangeColumn) 4722 if !ok { 4723 return false 4724 } 4725 return cmp.RefOfChangeColumn(a, b) 4726 case *DropColumn: 4727 b, ok := inB.(*DropColumn) 4728 if !ok { 4729 return false 4730 } 4731 return cmp.RefOfDropColumn(a, b) 4732 case *DropKey: 4733 b, ok := inB.(*DropKey) 4734 if !ok { 4735 return false 4736 } 4737 return cmp.RefOfDropKey(a, b) 4738 case *Force: 4739 b, ok := inB.(*Force) 4740 if !ok { 4741 return false 4742 } 4743 return cmp.RefOfForce(a, b) 4744 case *KeyState: 4745 b, ok := inB.(*KeyState) 4746 if !ok { 4747 return false 4748 } 4749 return cmp.RefOfKeyState(a, b) 4750 case *LockOption: 4751 b, ok := inB.(*LockOption) 4752 if !ok { 4753 return false 4754 } 4755 return cmp.RefOfLockOption(a, b) 4756 case *ModifyColumn: 4757 b, ok := inB.(*ModifyColumn) 4758 if !ok { 4759 return false 4760 } 4761 return cmp.RefOfModifyColumn(a, b) 4762 case *OrderByOption: 4763 b, ok := inB.(*OrderByOption) 4764 if !ok { 4765 return false 4766 } 4767 return cmp.RefOfOrderByOption(a, b) 4768 case *RenameColumn: 4769 b, ok := inB.(*RenameColumn) 4770 if !ok { 4771 return false 4772 } 4773 return cmp.RefOfRenameColumn(a, b) 4774 case *RenameIndex: 4775 b, ok := inB.(*RenameIndex) 4776 if !ok { 4777 return false 4778 } 4779 return cmp.RefOfRenameIndex(a, b) 4780 case *RenameTableName: 4781 b, ok := inB.(*RenameTableName) 4782 if !ok { 4783 return false 4784 } 4785 return cmp.RefOfRenameTableName(a, b) 4786 case TableOptions: 4787 b, ok := inB.(TableOptions) 4788 if !ok { 4789 return false 4790 } 4791 return cmp.TableOptions(a, b) 4792 case *TablespaceOperation: 4793 b, ok := inB.(*TablespaceOperation) 4794 if !ok { 4795 return false 4796 } 4797 return cmp.RefOfTablespaceOperation(a, b) 4798 case *Validation: 4799 b, ok := inB.(*Validation) 4800 if !ok { 4801 return false 4802 } 4803 return cmp.RefOfValidation(a, b) 4804 default: 4805 // this should never happen 4806 return false 4807 } 4808 } 4809 4810 // Callable does deep equals between the two objects. 4811 func (cmp *Comparator) Callable(inA, inB Callable) bool { 4812 if inA == nil && inB == nil { 4813 return true 4814 } 4815 if inA == nil || inB == nil { 4816 return false 4817 } 4818 switch a := inA.(type) { 4819 case *ArgumentLessWindowExpr: 4820 b, ok := inB.(*ArgumentLessWindowExpr) 4821 if !ok { 4822 return false 4823 } 4824 return cmp.RefOfArgumentLessWindowExpr(a, b) 4825 case *Avg: 4826 b, ok := inB.(*Avg) 4827 if !ok { 4828 return false 4829 } 4830 return cmp.RefOfAvg(a, b) 4831 case *CharExpr: 4832 b, ok := inB.(*CharExpr) 4833 if !ok { 4834 return false 4835 } 4836 return cmp.RefOfCharExpr(a, b) 4837 case *ConvertExpr: 4838 b, ok := inB.(*ConvertExpr) 4839 if !ok { 4840 return false 4841 } 4842 return cmp.RefOfConvertExpr(a, b) 4843 case *ConvertUsingExpr: 4844 b, ok := inB.(*ConvertUsingExpr) 4845 if !ok { 4846 return false 4847 } 4848 return cmp.RefOfConvertUsingExpr(a, b) 4849 case *Count: 4850 b, ok := inB.(*Count) 4851 if !ok { 4852 return false 4853 } 4854 return cmp.RefOfCount(a, b) 4855 case *CountStar: 4856 b, ok := inB.(*CountStar) 4857 if !ok { 4858 return false 4859 } 4860 return cmp.RefOfCountStar(a, b) 4861 case *CurTimeFuncExpr: 4862 b, ok := inB.(*CurTimeFuncExpr) 4863 if !ok { 4864 return false 4865 } 4866 return cmp.RefOfCurTimeFuncExpr(a, b) 4867 case *ExtractFuncExpr: 4868 b, ok := inB.(*ExtractFuncExpr) 4869 if !ok { 4870 return false 4871 } 4872 return cmp.RefOfExtractFuncExpr(a, b) 4873 case *ExtractValueExpr: 4874 b, ok := inB.(*ExtractValueExpr) 4875 if !ok { 4876 return false 4877 } 4878 return cmp.RefOfExtractValueExpr(a, b) 4879 case *FirstOrLastValueExpr: 4880 b, ok := inB.(*FirstOrLastValueExpr) 4881 if !ok { 4882 return false 4883 } 4884 return cmp.RefOfFirstOrLastValueExpr(a, b) 4885 case *FuncExpr: 4886 b, ok := inB.(*FuncExpr) 4887 if !ok { 4888 return false 4889 } 4890 return cmp.RefOfFuncExpr(a, b) 4891 case *GTIDFuncExpr: 4892 b, ok := inB.(*GTIDFuncExpr) 4893 if !ok { 4894 return false 4895 } 4896 return cmp.RefOfGTIDFuncExpr(a, b) 4897 case *GroupConcatExpr: 4898 b, ok := inB.(*GroupConcatExpr) 4899 if !ok { 4900 return false 4901 } 4902 return cmp.RefOfGroupConcatExpr(a, b) 4903 case *InsertExpr: 4904 b, ok := inB.(*InsertExpr) 4905 if !ok { 4906 return false 4907 } 4908 return cmp.RefOfInsertExpr(a, b) 4909 case *IntervalFuncExpr: 4910 b, ok := inB.(*IntervalFuncExpr) 4911 if !ok { 4912 return false 4913 } 4914 return cmp.RefOfIntervalFuncExpr(a, b) 4915 case *JSONArrayExpr: 4916 b, ok := inB.(*JSONArrayExpr) 4917 if !ok { 4918 return false 4919 } 4920 return cmp.RefOfJSONArrayExpr(a, b) 4921 case *JSONAttributesExpr: 4922 b, ok := inB.(*JSONAttributesExpr) 4923 if !ok { 4924 return false 4925 } 4926 return cmp.RefOfJSONAttributesExpr(a, b) 4927 case *JSONContainsExpr: 4928 b, ok := inB.(*JSONContainsExpr) 4929 if !ok { 4930 return false 4931 } 4932 return cmp.RefOfJSONContainsExpr(a, b) 4933 case *JSONContainsPathExpr: 4934 b, ok := inB.(*JSONContainsPathExpr) 4935 if !ok { 4936 return false 4937 } 4938 return cmp.RefOfJSONContainsPathExpr(a, b) 4939 case *JSONExtractExpr: 4940 b, ok := inB.(*JSONExtractExpr) 4941 if !ok { 4942 return false 4943 } 4944 return cmp.RefOfJSONExtractExpr(a, b) 4945 case *JSONKeysExpr: 4946 b, ok := inB.(*JSONKeysExpr) 4947 if !ok { 4948 return false 4949 } 4950 return cmp.RefOfJSONKeysExpr(a, b) 4951 case *JSONObjectExpr: 4952 b, ok := inB.(*JSONObjectExpr) 4953 if !ok { 4954 return false 4955 } 4956 return cmp.RefOfJSONObjectExpr(a, b) 4957 case *JSONOverlapsExpr: 4958 b, ok := inB.(*JSONOverlapsExpr) 4959 if !ok { 4960 return false 4961 } 4962 return cmp.RefOfJSONOverlapsExpr(a, b) 4963 case *JSONPrettyExpr: 4964 b, ok := inB.(*JSONPrettyExpr) 4965 if !ok { 4966 return false 4967 } 4968 return cmp.RefOfJSONPrettyExpr(a, b) 4969 case *JSONQuoteExpr: 4970 b, ok := inB.(*JSONQuoteExpr) 4971 if !ok { 4972 return false 4973 } 4974 return cmp.RefOfJSONQuoteExpr(a, b) 4975 case *JSONRemoveExpr: 4976 b, ok := inB.(*JSONRemoveExpr) 4977 if !ok { 4978 return false 4979 } 4980 return cmp.RefOfJSONRemoveExpr(a, b) 4981 case *JSONSchemaValidFuncExpr: 4982 b, ok := inB.(*JSONSchemaValidFuncExpr) 4983 if !ok { 4984 return false 4985 } 4986 return cmp.RefOfJSONSchemaValidFuncExpr(a, b) 4987 case *JSONSchemaValidationReportFuncExpr: 4988 b, ok := inB.(*JSONSchemaValidationReportFuncExpr) 4989 if !ok { 4990 return false 4991 } 4992 return cmp.RefOfJSONSchemaValidationReportFuncExpr(a, b) 4993 case *JSONSearchExpr: 4994 b, ok := inB.(*JSONSearchExpr) 4995 if !ok { 4996 return false 4997 } 4998 return cmp.RefOfJSONSearchExpr(a, b) 4999 case *JSONStorageFreeExpr: 5000 b, ok := inB.(*JSONStorageFreeExpr) 5001 if !ok { 5002 return false 5003 } 5004 return cmp.RefOfJSONStorageFreeExpr(a, b) 5005 case *JSONStorageSizeExpr: 5006 b, ok := inB.(*JSONStorageSizeExpr) 5007 if !ok { 5008 return false 5009 } 5010 return cmp.RefOfJSONStorageSizeExpr(a, b) 5011 case *JSONUnquoteExpr: 5012 b, ok := inB.(*JSONUnquoteExpr) 5013 if !ok { 5014 return false 5015 } 5016 return cmp.RefOfJSONUnquoteExpr(a, b) 5017 case *JSONValueExpr: 5018 b, ok := inB.(*JSONValueExpr) 5019 if !ok { 5020 return false 5021 } 5022 return cmp.RefOfJSONValueExpr(a, b) 5023 case *JSONValueMergeExpr: 5024 b, ok := inB.(*JSONValueMergeExpr) 5025 if !ok { 5026 return false 5027 } 5028 return cmp.RefOfJSONValueMergeExpr(a, b) 5029 case *JSONValueModifierExpr: 5030 b, ok := inB.(*JSONValueModifierExpr) 5031 if !ok { 5032 return false 5033 } 5034 return cmp.RefOfJSONValueModifierExpr(a, b) 5035 case *LagLeadExpr: 5036 b, ok := inB.(*LagLeadExpr) 5037 if !ok { 5038 return false 5039 } 5040 return cmp.RefOfLagLeadExpr(a, b) 5041 case *LineStringExpr: 5042 b, ok := inB.(*LineStringExpr) 5043 if !ok { 5044 return false 5045 } 5046 return cmp.RefOfLineStringExpr(a, b) 5047 case *LocateExpr: 5048 b, ok := inB.(*LocateExpr) 5049 if !ok { 5050 return false 5051 } 5052 return cmp.RefOfLocateExpr(a, b) 5053 case *MatchExpr: 5054 b, ok := inB.(*MatchExpr) 5055 if !ok { 5056 return false 5057 } 5058 return cmp.RefOfMatchExpr(a, b) 5059 case *Max: 5060 b, ok := inB.(*Max) 5061 if !ok { 5062 return false 5063 } 5064 return cmp.RefOfMax(a, b) 5065 case *MemberOfExpr: 5066 b, ok := inB.(*MemberOfExpr) 5067 if !ok { 5068 return false 5069 } 5070 return cmp.RefOfMemberOfExpr(a, b) 5071 case *Min: 5072 b, ok := inB.(*Min) 5073 if !ok { 5074 return false 5075 } 5076 return cmp.RefOfMin(a, b) 5077 case *NTHValueExpr: 5078 b, ok := inB.(*NTHValueExpr) 5079 if !ok { 5080 return false 5081 } 5082 return cmp.RefOfNTHValueExpr(a, b) 5083 case *NamedWindow: 5084 b, ok := inB.(*NamedWindow) 5085 if !ok { 5086 return false 5087 } 5088 return cmp.RefOfNamedWindow(a, b) 5089 case *NtileExpr: 5090 b, ok := inB.(*NtileExpr) 5091 if !ok { 5092 return false 5093 } 5094 return cmp.RefOfNtileExpr(a, b) 5095 case *PerformanceSchemaFuncExpr: 5096 b, ok := inB.(*PerformanceSchemaFuncExpr) 5097 if !ok { 5098 return false 5099 } 5100 return cmp.RefOfPerformanceSchemaFuncExpr(a, b) 5101 case *PointExpr: 5102 b, ok := inB.(*PointExpr) 5103 if !ok { 5104 return false 5105 } 5106 return cmp.RefOfPointExpr(a, b) 5107 case *RegexpInstrExpr: 5108 b, ok := inB.(*RegexpInstrExpr) 5109 if !ok { 5110 return false 5111 } 5112 return cmp.RefOfRegexpInstrExpr(a, b) 5113 case *RegexpLikeExpr: 5114 b, ok := inB.(*RegexpLikeExpr) 5115 if !ok { 5116 return false 5117 } 5118 return cmp.RefOfRegexpLikeExpr(a, b) 5119 case *RegexpReplaceExpr: 5120 b, ok := inB.(*RegexpReplaceExpr) 5121 if !ok { 5122 return false 5123 } 5124 return cmp.RefOfRegexpReplaceExpr(a, b) 5125 case *RegexpSubstrExpr: 5126 b, ok := inB.(*RegexpSubstrExpr) 5127 if !ok { 5128 return false 5129 } 5130 return cmp.RefOfRegexpSubstrExpr(a, b) 5131 case *SubstrExpr: 5132 b, ok := inB.(*SubstrExpr) 5133 if !ok { 5134 return false 5135 } 5136 return cmp.RefOfSubstrExpr(a, b) 5137 case *Sum: 5138 b, ok := inB.(*Sum) 5139 if !ok { 5140 return false 5141 } 5142 return cmp.RefOfSum(a, b) 5143 case *TimestampFuncExpr: 5144 b, ok := inB.(*TimestampFuncExpr) 5145 if !ok { 5146 return false 5147 } 5148 return cmp.RefOfTimestampFuncExpr(a, b) 5149 case *TrimFuncExpr: 5150 b, ok := inB.(*TrimFuncExpr) 5151 if !ok { 5152 return false 5153 } 5154 return cmp.RefOfTrimFuncExpr(a, b) 5155 case *UpdateXMLExpr: 5156 b, ok := inB.(*UpdateXMLExpr) 5157 if !ok { 5158 return false 5159 } 5160 return cmp.RefOfUpdateXMLExpr(a, b) 5161 case *ValuesFuncExpr: 5162 b, ok := inB.(*ValuesFuncExpr) 5163 if !ok { 5164 return false 5165 } 5166 return cmp.RefOfValuesFuncExpr(a, b) 5167 case *WeightStringFuncExpr: 5168 b, ok := inB.(*WeightStringFuncExpr) 5169 if !ok { 5170 return false 5171 } 5172 return cmp.RefOfWeightStringFuncExpr(a, b) 5173 default: 5174 // this should never happen 5175 return false 5176 } 5177 } 5178 5179 // ColTuple does deep equals between the two objects. 5180 func (cmp *Comparator) ColTuple(inA, inB ColTuple) bool { 5181 if inA == nil && inB == nil { 5182 return true 5183 } 5184 if inA == nil || inB == nil { 5185 return false 5186 } 5187 switch a := inA.(type) { 5188 case ListArg: 5189 b, ok := inB.(ListArg) 5190 if !ok { 5191 return false 5192 } 5193 return a == b 5194 case *Subquery: 5195 b, ok := inB.(*Subquery) 5196 if !ok { 5197 return false 5198 } 5199 return cmp.RefOfSubquery(a, b) 5200 case ValTuple: 5201 b, ok := inB.(ValTuple) 5202 if !ok { 5203 return false 5204 } 5205 return cmp.ValTuple(a, b) 5206 default: 5207 // this should never happen 5208 return false 5209 } 5210 } 5211 5212 // ConstraintInfo does deep equals between the two objects. 5213 func (cmp *Comparator) ConstraintInfo(inA, inB ConstraintInfo) bool { 5214 if inA == nil && inB == nil { 5215 return true 5216 } 5217 if inA == nil || inB == nil { 5218 return false 5219 } 5220 switch a := inA.(type) { 5221 case *CheckConstraintDefinition: 5222 b, ok := inB.(*CheckConstraintDefinition) 5223 if !ok { 5224 return false 5225 } 5226 return cmp.RefOfCheckConstraintDefinition(a, b) 5227 case *ForeignKeyDefinition: 5228 b, ok := inB.(*ForeignKeyDefinition) 5229 if !ok { 5230 return false 5231 } 5232 return cmp.RefOfForeignKeyDefinition(a, b) 5233 default: 5234 // this should never happen 5235 return false 5236 } 5237 } 5238 5239 // DBDDLStatement does deep equals between the two objects. 5240 func (cmp *Comparator) DBDDLStatement(inA, inB DBDDLStatement) bool { 5241 if inA == nil && inB == nil { 5242 return true 5243 } 5244 if inA == nil || inB == nil { 5245 return false 5246 } 5247 switch a := inA.(type) { 5248 case *AlterDatabase: 5249 b, ok := inB.(*AlterDatabase) 5250 if !ok { 5251 return false 5252 } 5253 return cmp.RefOfAlterDatabase(a, b) 5254 case *CreateDatabase: 5255 b, ok := inB.(*CreateDatabase) 5256 if !ok { 5257 return false 5258 } 5259 return cmp.RefOfCreateDatabase(a, b) 5260 case *DropDatabase: 5261 b, ok := inB.(*DropDatabase) 5262 if !ok { 5263 return false 5264 } 5265 return cmp.RefOfDropDatabase(a, b) 5266 default: 5267 // this should never happen 5268 return false 5269 } 5270 } 5271 5272 // DDLStatement does deep equals between the two objects. 5273 func (cmp *Comparator) DDLStatement(inA, inB DDLStatement) bool { 5274 if inA == nil && inB == nil { 5275 return true 5276 } 5277 if inA == nil || inB == nil { 5278 return false 5279 } 5280 switch a := inA.(type) { 5281 case *AlterTable: 5282 b, ok := inB.(*AlterTable) 5283 if !ok { 5284 return false 5285 } 5286 return cmp.RefOfAlterTable(a, b) 5287 case *AlterView: 5288 b, ok := inB.(*AlterView) 5289 if !ok { 5290 return false 5291 } 5292 return cmp.RefOfAlterView(a, b) 5293 case *CreateTable: 5294 b, ok := inB.(*CreateTable) 5295 if !ok { 5296 return false 5297 } 5298 return cmp.RefOfCreateTable(a, b) 5299 case *CreateView: 5300 b, ok := inB.(*CreateView) 5301 if !ok { 5302 return false 5303 } 5304 return cmp.RefOfCreateView(a, b) 5305 case *DropTable: 5306 b, ok := inB.(*DropTable) 5307 if !ok { 5308 return false 5309 } 5310 return cmp.RefOfDropTable(a, b) 5311 case *DropView: 5312 b, ok := inB.(*DropView) 5313 if !ok { 5314 return false 5315 } 5316 return cmp.RefOfDropView(a, b) 5317 case *RenameTable: 5318 b, ok := inB.(*RenameTable) 5319 if !ok { 5320 return false 5321 } 5322 return cmp.RefOfRenameTable(a, b) 5323 case *TruncateTable: 5324 b, ok := inB.(*TruncateTable) 5325 if !ok { 5326 return false 5327 } 5328 return cmp.RefOfTruncateTable(a, b) 5329 default: 5330 // this should never happen 5331 return false 5332 } 5333 } 5334 5335 // Explain does deep equals between the two objects. 5336 func (cmp *Comparator) Explain(inA, inB Explain) bool { 5337 if inA == nil && inB == nil { 5338 return true 5339 } 5340 if inA == nil || inB == nil { 5341 return false 5342 } 5343 switch a := inA.(type) { 5344 case *ExplainStmt: 5345 b, ok := inB.(*ExplainStmt) 5346 if !ok { 5347 return false 5348 } 5349 return cmp.RefOfExplainStmt(a, b) 5350 case *ExplainTab: 5351 b, ok := inB.(*ExplainTab) 5352 if !ok { 5353 return false 5354 } 5355 return cmp.RefOfExplainTab(a, b) 5356 default: 5357 // this should never happen 5358 return false 5359 } 5360 } 5361 5362 // Expr does deep equals between the two objects. 5363 func (cmp *Comparator) Expr(inA, inB Expr) bool { 5364 if inA == nil && inB == nil { 5365 return true 5366 } 5367 if inA == nil || inB == nil { 5368 return false 5369 } 5370 switch a := inA.(type) { 5371 case *AndExpr: 5372 b, ok := inB.(*AndExpr) 5373 if !ok { 5374 return false 5375 } 5376 return cmp.RefOfAndExpr(a, b) 5377 case Argument: 5378 b, ok := inB.(Argument) 5379 if !ok { 5380 return false 5381 } 5382 return a == b 5383 case *ArgumentLessWindowExpr: 5384 b, ok := inB.(*ArgumentLessWindowExpr) 5385 if !ok { 5386 return false 5387 } 5388 return cmp.RefOfArgumentLessWindowExpr(a, b) 5389 case *Avg: 5390 b, ok := inB.(*Avg) 5391 if !ok { 5392 return false 5393 } 5394 return cmp.RefOfAvg(a, b) 5395 case *BetweenExpr: 5396 b, ok := inB.(*BetweenExpr) 5397 if !ok { 5398 return false 5399 } 5400 return cmp.RefOfBetweenExpr(a, b) 5401 case *BinaryExpr: 5402 b, ok := inB.(*BinaryExpr) 5403 if !ok { 5404 return false 5405 } 5406 return cmp.RefOfBinaryExpr(a, b) 5407 case *BitAnd: 5408 b, ok := inB.(*BitAnd) 5409 if !ok { 5410 return false 5411 } 5412 return cmp.RefOfBitAnd(a, b) 5413 case *BitOr: 5414 b, ok := inB.(*BitOr) 5415 if !ok { 5416 return false 5417 } 5418 return cmp.RefOfBitOr(a, b) 5419 case *BitXor: 5420 b, ok := inB.(*BitXor) 5421 if !ok { 5422 return false 5423 } 5424 return cmp.RefOfBitXor(a, b) 5425 case BoolVal: 5426 b, ok := inB.(BoolVal) 5427 if !ok { 5428 return false 5429 } 5430 return a == b 5431 case *CaseExpr: 5432 b, ok := inB.(*CaseExpr) 5433 if !ok { 5434 return false 5435 } 5436 return cmp.RefOfCaseExpr(a, b) 5437 case *CastExpr: 5438 b, ok := inB.(*CastExpr) 5439 if !ok { 5440 return false 5441 } 5442 return cmp.RefOfCastExpr(a, b) 5443 case *CharExpr: 5444 b, ok := inB.(*CharExpr) 5445 if !ok { 5446 return false 5447 } 5448 return cmp.RefOfCharExpr(a, b) 5449 case *ColName: 5450 b, ok := inB.(*ColName) 5451 if !ok { 5452 return false 5453 } 5454 return cmp.RefOfColName(a, b) 5455 case *CollateExpr: 5456 b, ok := inB.(*CollateExpr) 5457 if !ok { 5458 return false 5459 } 5460 return cmp.RefOfCollateExpr(a, b) 5461 case *ComparisonExpr: 5462 b, ok := inB.(*ComparisonExpr) 5463 if !ok { 5464 return false 5465 } 5466 return cmp.RefOfComparisonExpr(a, b) 5467 case *ConvertExpr: 5468 b, ok := inB.(*ConvertExpr) 5469 if !ok { 5470 return false 5471 } 5472 return cmp.RefOfConvertExpr(a, b) 5473 case *ConvertUsingExpr: 5474 b, ok := inB.(*ConvertUsingExpr) 5475 if !ok { 5476 return false 5477 } 5478 return cmp.RefOfConvertUsingExpr(a, b) 5479 case *Count: 5480 b, ok := inB.(*Count) 5481 if !ok { 5482 return false 5483 } 5484 return cmp.RefOfCount(a, b) 5485 case *CountStar: 5486 b, ok := inB.(*CountStar) 5487 if !ok { 5488 return false 5489 } 5490 return cmp.RefOfCountStar(a, b) 5491 case *CurTimeFuncExpr: 5492 b, ok := inB.(*CurTimeFuncExpr) 5493 if !ok { 5494 return false 5495 } 5496 return cmp.RefOfCurTimeFuncExpr(a, b) 5497 case *Default: 5498 b, ok := inB.(*Default) 5499 if !ok { 5500 return false 5501 } 5502 return cmp.RefOfDefault(a, b) 5503 case *ExistsExpr: 5504 b, ok := inB.(*ExistsExpr) 5505 if !ok { 5506 return false 5507 } 5508 return cmp.RefOfExistsExpr(a, b) 5509 case *ExtractFuncExpr: 5510 b, ok := inB.(*ExtractFuncExpr) 5511 if !ok { 5512 return false 5513 } 5514 return cmp.RefOfExtractFuncExpr(a, b) 5515 case *ExtractValueExpr: 5516 b, ok := inB.(*ExtractValueExpr) 5517 if !ok { 5518 return false 5519 } 5520 return cmp.RefOfExtractValueExpr(a, b) 5521 case *ExtractedSubquery: 5522 b, ok := inB.(*ExtractedSubquery) 5523 if !ok { 5524 return false 5525 } 5526 return cmp.RefOfExtractedSubquery(a, b) 5527 case *FirstOrLastValueExpr: 5528 b, ok := inB.(*FirstOrLastValueExpr) 5529 if !ok { 5530 return false 5531 } 5532 return cmp.RefOfFirstOrLastValueExpr(a, b) 5533 case *FuncExpr: 5534 b, ok := inB.(*FuncExpr) 5535 if !ok { 5536 return false 5537 } 5538 return cmp.RefOfFuncExpr(a, b) 5539 case *GTIDFuncExpr: 5540 b, ok := inB.(*GTIDFuncExpr) 5541 if !ok { 5542 return false 5543 } 5544 return cmp.RefOfGTIDFuncExpr(a, b) 5545 case *GroupConcatExpr: 5546 b, ok := inB.(*GroupConcatExpr) 5547 if !ok { 5548 return false 5549 } 5550 return cmp.RefOfGroupConcatExpr(a, b) 5551 case *InsertExpr: 5552 b, ok := inB.(*InsertExpr) 5553 if !ok { 5554 return false 5555 } 5556 return cmp.RefOfInsertExpr(a, b) 5557 case *IntervalExpr: 5558 b, ok := inB.(*IntervalExpr) 5559 if !ok { 5560 return false 5561 } 5562 return cmp.RefOfIntervalExpr(a, b) 5563 case *IntervalFuncExpr: 5564 b, ok := inB.(*IntervalFuncExpr) 5565 if !ok { 5566 return false 5567 } 5568 return cmp.RefOfIntervalFuncExpr(a, b) 5569 case *IntroducerExpr: 5570 b, ok := inB.(*IntroducerExpr) 5571 if !ok { 5572 return false 5573 } 5574 return cmp.RefOfIntroducerExpr(a, b) 5575 case *IsExpr: 5576 b, ok := inB.(*IsExpr) 5577 if !ok { 5578 return false 5579 } 5580 return cmp.RefOfIsExpr(a, b) 5581 case *JSONArrayExpr: 5582 b, ok := inB.(*JSONArrayExpr) 5583 if !ok { 5584 return false 5585 } 5586 return cmp.RefOfJSONArrayExpr(a, b) 5587 case *JSONAttributesExpr: 5588 b, ok := inB.(*JSONAttributesExpr) 5589 if !ok { 5590 return false 5591 } 5592 return cmp.RefOfJSONAttributesExpr(a, b) 5593 case *JSONContainsExpr: 5594 b, ok := inB.(*JSONContainsExpr) 5595 if !ok { 5596 return false 5597 } 5598 return cmp.RefOfJSONContainsExpr(a, b) 5599 case *JSONContainsPathExpr: 5600 b, ok := inB.(*JSONContainsPathExpr) 5601 if !ok { 5602 return false 5603 } 5604 return cmp.RefOfJSONContainsPathExpr(a, b) 5605 case *JSONExtractExpr: 5606 b, ok := inB.(*JSONExtractExpr) 5607 if !ok { 5608 return false 5609 } 5610 return cmp.RefOfJSONExtractExpr(a, b) 5611 case *JSONKeysExpr: 5612 b, ok := inB.(*JSONKeysExpr) 5613 if !ok { 5614 return false 5615 } 5616 return cmp.RefOfJSONKeysExpr(a, b) 5617 case *JSONObjectExpr: 5618 b, ok := inB.(*JSONObjectExpr) 5619 if !ok { 5620 return false 5621 } 5622 return cmp.RefOfJSONObjectExpr(a, b) 5623 case *JSONOverlapsExpr: 5624 b, ok := inB.(*JSONOverlapsExpr) 5625 if !ok { 5626 return false 5627 } 5628 return cmp.RefOfJSONOverlapsExpr(a, b) 5629 case *JSONPrettyExpr: 5630 b, ok := inB.(*JSONPrettyExpr) 5631 if !ok { 5632 return false 5633 } 5634 return cmp.RefOfJSONPrettyExpr(a, b) 5635 case *JSONQuoteExpr: 5636 b, ok := inB.(*JSONQuoteExpr) 5637 if !ok { 5638 return false 5639 } 5640 return cmp.RefOfJSONQuoteExpr(a, b) 5641 case *JSONRemoveExpr: 5642 b, ok := inB.(*JSONRemoveExpr) 5643 if !ok { 5644 return false 5645 } 5646 return cmp.RefOfJSONRemoveExpr(a, b) 5647 case *JSONSchemaValidFuncExpr: 5648 b, ok := inB.(*JSONSchemaValidFuncExpr) 5649 if !ok { 5650 return false 5651 } 5652 return cmp.RefOfJSONSchemaValidFuncExpr(a, b) 5653 case *JSONSchemaValidationReportFuncExpr: 5654 b, ok := inB.(*JSONSchemaValidationReportFuncExpr) 5655 if !ok { 5656 return false 5657 } 5658 return cmp.RefOfJSONSchemaValidationReportFuncExpr(a, b) 5659 case *JSONSearchExpr: 5660 b, ok := inB.(*JSONSearchExpr) 5661 if !ok { 5662 return false 5663 } 5664 return cmp.RefOfJSONSearchExpr(a, b) 5665 case *JSONStorageFreeExpr: 5666 b, ok := inB.(*JSONStorageFreeExpr) 5667 if !ok { 5668 return false 5669 } 5670 return cmp.RefOfJSONStorageFreeExpr(a, b) 5671 case *JSONStorageSizeExpr: 5672 b, ok := inB.(*JSONStorageSizeExpr) 5673 if !ok { 5674 return false 5675 } 5676 return cmp.RefOfJSONStorageSizeExpr(a, b) 5677 case *JSONUnquoteExpr: 5678 b, ok := inB.(*JSONUnquoteExpr) 5679 if !ok { 5680 return false 5681 } 5682 return cmp.RefOfJSONUnquoteExpr(a, b) 5683 case *JSONValueExpr: 5684 b, ok := inB.(*JSONValueExpr) 5685 if !ok { 5686 return false 5687 } 5688 return cmp.RefOfJSONValueExpr(a, b) 5689 case *JSONValueMergeExpr: 5690 b, ok := inB.(*JSONValueMergeExpr) 5691 if !ok { 5692 return false 5693 } 5694 return cmp.RefOfJSONValueMergeExpr(a, b) 5695 case *JSONValueModifierExpr: 5696 b, ok := inB.(*JSONValueModifierExpr) 5697 if !ok { 5698 return false 5699 } 5700 return cmp.RefOfJSONValueModifierExpr(a, b) 5701 case *LagLeadExpr: 5702 b, ok := inB.(*LagLeadExpr) 5703 if !ok { 5704 return false 5705 } 5706 return cmp.RefOfLagLeadExpr(a, b) 5707 case *LineStringExpr: 5708 b, ok := inB.(*LineStringExpr) 5709 if !ok { 5710 return false 5711 } 5712 return cmp.RefOfLineStringExpr(a, b) 5713 case ListArg: 5714 b, ok := inB.(ListArg) 5715 if !ok { 5716 return false 5717 } 5718 return a == b 5719 case *Literal: 5720 b, ok := inB.(*Literal) 5721 if !ok { 5722 return false 5723 } 5724 return cmp.RefOfLiteral(a, b) 5725 case *LocateExpr: 5726 b, ok := inB.(*LocateExpr) 5727 if !ok { 5728 return false 5729 } 5730 return cmp.RefOfLocateExpr(a, b) 5731 case *LockingFunc: 5732 b, ok := inB.(*LockingFunc) 5733 if !ok { 5734 return false 5735 } 5736 return cmp.RefOfLockingFunc(a, b) 5737 case *MatchExpr: 5738 b, ok := inB.(*MatchExpr) 5739 if !ok { 5740 return false 5741 } 5742 return cmp.RefOfMatchExpr(a, b) 5743 case *Max: 5744 b, ok := inB.(*Max) 5745 if !ok { 5746 return false 5747 } 5748 return cmp.RefOfMax(a, b) 5749 case *MemberOfExpr: 5750 b, ok := inB.(*MemberOfExpr) 5751 if !ok { 5752 return false 5753 } 5754 return cmp.RefOfMemberOfExpr(a, b) 5755 case *Min: 5756 b, ok := inB.(*Min) 5757 if !ok { 5758 return false 5759 } 5760 return cmp.RefOfMin(a, b) 5761 case *NTHValueExpr: 5762 b, ok := inB.(*NTHValueExpr) 5763 if !ok { 5764 return false 5765 } 5766 return cmp.RefOfNTHValueExpr(a, b) 5767 case *NamedWindow: 5768 b, ok := inB.(*NamedWindow) 5769 if !ok { 5770 return false 5771 } 5772 return cmp.RefOfNamedWindow(a, b) 5773 case *NotExpr: 5774 b, ok := inB.(*NotExpr) 5775 if !ok { 5776 return false 5777 } 5778 return cmp.RefOfNotExpr(a, b) 5779 case *NtileExpr: 5780 b, ok := inB.(*NtileExpr) 5781 if !ok { 5782 return false 5783 } 5784 return cmp.RefOfNtileExpr(a, b) 5785 case *NullVal: 5786 b, ok := inB.(*NullVal) 5787 if !ok { 5788 return false 5789 } 5790 return cmp.RefOfNullVal(a, b) 5791 case *Offset: 5792 b, ok := inB.(*Offset) 5793 if !ok { 5794 return false 5795 } 5796 return cmp.RefOfOffset(a, b) 5797 case *OrExpr: 5798 b, ok := inB.(*OrExpr) 5799 if !ok { 5800 return false 5801 } 5802 return cmp.RefOfOrExpr(a, b) 5803 case *PerformanceSchemaFuncExpr: 5804 b, ok := inB.(*PerformanceSchemaFuncExpr) 5805 if !ok { 5806 return false 5807 } 5808 return cmp.RefOfPerformanceSchemaFuncExpr(a, b) 5809 case *PointExpr: 5810 b, ok := inB.(*PointExpr) 5811 if !ok { 5812 return false 5813 } 5814 return cmp.RefOfPointExpr(a, b) 5815 case *RegexpInstrExpr: 5816 b, ok := inB.(*RegexpInstrExpr) 5817 if !ok { 5818 return false 5819 } 5820 return cmp.RefOfRegexpInstrExpr(a, b) 5821 case *RegexpLikeExpr: 5822 b, ok := inB.(*RegexpLikeExpr) 5823 if !ok { 5824 return false 5825 } 5826 return cmp.RefOfRegexpLikeExpr(a, b) 5827 case *RegexpReplaceExpr: 5828 b, ok := inB.(*RegexpReplaceExpr) 5829 if !ok { 5830 return false 5831 } 5832 return cmp.RefOfRegexpReplaceExpr(a, b) 5833 case *RegexpSubstrExpr: 5834 b, ok := inB.(*RegexpSubstrExpr) 5835 if !ok { 5836 return false 5837 } 5838 return cmp.RefOfRegexpSubstrExpr(a, b) 5839 case *Std: 5840 b, ok := inB.(*Std) 5841 if !ok { 5842 return false 5843 } 5844 return cmp.RefOfStd(a, b) 5845 case *StdDev: 5846 b, ok := inB.(*StdDev) 5847 if !ok { 5848 return false 5849 } 5850 return cmp.RefOfStdDev(a, b) 5851 case *StdPop: 5852 b, ok := inB.(*StdPop) 5853 if !ok { 5854 return false 5855 } 5856 return cmp.RefOfStdPop(a, b) 5857 case *StdSamp: 5858 b, ok := inB.(*StdSamp) 5859 if !ok { 5860 return false 5861 } 5862 return cmp.RefOfStdSamp(a, b) 5863 case *Subquery: 5864 b, ok := inB.(*Subquery) 5865 if !ok { 5866 return false 5867 } 5868 return cmp.RefOfSubquery(a, b) 5869 case *SubstrExpr: 5870 b, ok := inB.(*SubstrExpr) 5871 if !ok { 5872 return false 5873 } 5874 return cmp.RefOfSubstrExpr(a, b) 5875 case *Sum: 5876 b, ok := inB.(*Sum) 5877 if !ok { 5878 return false 5879 } 5880 return cmp.RefOfSum(a, b) 5881 case *TimestampFuncExpr: 5882 b, ok := inB.(*TimestampFuncExpr) 5883 if !ok { 5884 return false 5885 } 5886 return cmp.RefOfTimestampFuncExpr(a, b) 5887 case *TrimFuncExpr: 5888 b, ok := inB.(*TrimFuncExpr) 5889 if !ok { 5890 return false 5891 } 5892 return cmp.RefOfTrimFuncExpr(a, b) 5893 case *UnaryExpr: 5894 b, ok := inB.(*UnaryExpr) 5895 if !ok { 5896 return false 5897 } 5898 return cmp.RefOfUnaryExpr(a, b) 5899 case *UpdateXMLExpr: 5900 b, ok := inB.(*UpdateXMLExpr) 5901 if !ok { 5902 return false 5903 } 5904 return cmp.RefOfUpdateXMLExpr(a, b) 5905 case ValTuple: 5906 b, ok := inB.(ValTuple) 5907 if !ok { 5908 return false 5909 } 5910 return cmp.ValTuple(a, b) 5911 case *ValuesFuncExpr: 5912 b, ok := inB.(*ValuesFuncExpr) 5913 if !ok { 5914 return false 5915 } 5916 return cmp.RefOfValuesFuncExpr(a, b) 5917 case *VarPop: 5918 b, ok := inB.(*VarPop) 5919 if !ok { 5920 return false 5921 } 5922 return cmp.RefOfVarPop(a, b) 5923 case *VarSamp: 5924 b, ok := inB.(*VarSamp) 5925 if !ok { 5926 return false 5927 } 5928 return cmp.RefOfVarSamp(a, b) 5929 case *Variable: 5930 b, ok := inB.(*Variable) 5931 if !ok { 5932 return false 5933 } 5934 return cmp.RefOfVariable(a, b) 5935 case *Variance: 5936 b, ok := inB.(*Variance) 5937 if !ok { 5938 return false 5939 } 5940 return cmp.RefOfVariance(a, b) 5941 case *WeightStringFuncExpr: 5942 b, ok := inB.(*WeightStringFuncExpr) 5943 if !ok { 5944 return false 5945 } 5946 return cmp.RefOfWeightStringFuncExpr(a, b) 5947 case *XorExpr: 5948 b, ok := inB.(*XorExpr) 5949 if !ok { 5950 return false 5951 } 5952 return cmp.RefOfXorExpr(a, b) 5953 default: 5954 // this should never happen 5955 return false 5956 } 5957 } 5958 5959 // InsertRows does deep equals between the two objects. 5960 func (cmp *Comparator) InsertRows(inA, inB InsertRows) bool { 5961 if inA == nil && inB == nil { 5962 return true 5963 } 5964 if inA == nil || inB == nil { 5965 return false 5966 } 5967 switch a := inA.(type) { 5968 case *Select: 5969 b, ok := inB.(*Select) 5970 if !ok { 5971 return false 5972 } 5973 return cmp.RefOfSelect(a, b) 5974 case *Union: 5975 b, ok := inB.(*Union) 5976 if !ok { 5977 return false 5978 } 5979 return cmp.RefOfUnion(a, b) 5980 case Values: 5981 b, ok := inB.(Values) 5982 if !ok { 5983 return false 5984 } 5985 return cmp.Values(a, b) 5986 default: 5987 // this should never happen 5988 return false 5989 } 5990 } 5991 5992 // SelectExpr does deep equals between the two objects. 5993 func (cmp *Comparator) SelectExpr(inA, inB SelectExpr) bool { 5994 if inA == nil && inB == nil { 5995 return true 5996 } 5997 if inA == nil || inB == nil { 5998 return false 5999 } 6000 switch a := inA.(type) { 6001 case *AliasedExpr: 6002 b, ok := inB.(*AliasedExpr) 6003 if !ok { 6004 return false 6005 } 6006 return cmp.RefOfAliasedExpr(a, b) 6007 case *Nextval: 6008 b, ok := inB.(*Nextval) 6009 if !ok { 6010 return false 6011 } 6012 return cmp.RefOfNextval(a, b) 6013 case *StarExpr: 6014 b, ok := inB.(*StarExpr) 6015 if !ok { 6016 return false 6017 } 6018 return cmp.RefOfStarExpr(a, b) 6019 default: 6020 // this should never happen 6021 return false 6022 } 6023 } 6024 6025 // SelectStatement does deep equals between the two objects. 6026 func (cmp *Comparator) SelectStatement(inA, inB SelectStatement) bool { 6027 if inA == nil && inB == nil { 6028 return true 6029 } 6030 if inA == nil || inB == nil { 6031 return false 6032 } 6033 switch a := inA.(type) { 6034 case *Select: 6035 b, ok := inB.(*Select) 6036 if !ok { 6037 return false 6038 } 6039 return cmp.RefOfSelect(a, b) 6040 case *Union: 6041 b, ok := inB.(*Union) 6042 if !ok { 6043 return false 6044 } 6045 return cmp.RefOfUnion(a, b) 6046 default: 6047 // this should never happen 6048 return false 6049 } 6050 } 6051 6052 // ShowInternal does deep equals between the two objects. 6053 func (cmp *Comparator) ShowInternal(inA, inB ShowInternal) bool { 6054 if inA == nil && inB == nil { 6055 return true 6056 } 6057 if inA == nil || inB == nil { 6058 return false 6059 } 6060 switch a := inA.(type) { 6061 case *ShowBasic: 6062 b, ok := inB.(*ShowBasic) 6063 if !ok { 6064 return false 6065 } 6066 return cmp.RefOfShowBasic(a, b) 6067 case *ShowCreate: 6068 b, ok := inB.(*ShowCreate) 6069 if !ok { 6070 return false 6071 } 6072 return cmp.RefOfShowCreate(a, b) 6073 case *ShowOther: 6074 b, ok := inB.(*ShowOther) 6075 if !ok { 6076 return false 6077 } 6078 return cmp.RefOfShowOther(a, b) 6079 default: 6080 // this should never happen 6081 return false 6082 } 6083 } 6084 6085 // SimpleTableExpr does deep equals between the two objects. 6086 func (cmp *Comparator) SimpleTableExpr(inA, inB SimpleTableExpr) bool { 6087 if inA == nil && inB == nil { 6088 return true 6089 } 6090 if inA == nil || inB == nil { 6091 return false 6092 } 6093 switch a := inA.(type) { 6094 case *DerivedTable: 6095 b, ok := inB.(*DerivedTable) 6096 if !ok { 6097 return false 6098 } 6099 return cmp.RefOfDerivedTable(a, b) 6100 case TableName: 6101 b, ok := inB.(TableName) 6102 if !ok { 6103 return false 6104 } 6105 return cmp.TableName(a, b) 6106 default: 6107 // this should never happen 6108 return false 6109 } 6110 } 6111 6112 // Statement does deep equals between the two objects. 6113 func (cmp *Comparator) Statement(inA, inB Statement) bool { 6114 if inA == nil && inB == nil { 6115 return true 6116 } 6117 if inA == nil || inB == nil { 6118 return false 6119 } 6120 switch a := inA.(type) { 6121 case *AlterDatabase: 6122 b, ok := inB.(*AlterDatabase) 6123 if !ok { 6124 return false 6125 } 6126 return cmp.RefOfAlterDatabase(a, b) 6127 case *AlterMigration: 6128 b, ok := inB.(*AlterMigration) 6129 if !ok { 6130 return false 6131 } 6132 return cmp.RefOfAlterMigration(a, b) 6133 case *AlterTable: 6134 b, ok := inB.(*AlterTable) 6135 if !ok { 6136 return false 6137 } 6138 return cmp.RefOfAlterTable(a, b) 6139 case *AlterView: 6140 b, ok := inB.(*AlterView) 6141 if !ok { 6142 return false 6143 } 6144 return cmp.RefOfAlterView(a, b) 6145 case *AlterVschema: 6146 b, ok := inB.(*AlterVschema) 6147 if !ok { 6148 return false 6149 } 6150 return cmp.RefOfAlterVschema(a, b) 6151 case *Begin: 6152 b, ok := inB.(*Begin) 6153 if !ok { 6154 return false 6155 } 6156 return cmp.RefOfBegin(a, b) 6157 case *CallProc: 6158 b, ok := inB.(*CallProc) 6159 if !ok { 6160 return false 6161 } 6162 return cmp.RefOfCallProc(a, b) 6163 case *CommentOnly: 6164 b, ok := inB.(*CommentOnly) 6165 if !ok { 6166 return false 6167 } 6168 return cmp.RefOfCommentOnly(a, b) 6169 case *Commit: 6170 b, ok := inB.(*Commit) 6171 if !ok { 6172 return false 6173 } 6174 return cmp.RefOfCommit(a, b) 6175 case *CreateDatabase: 6176 b, ok := inB.(*CreateDatabase) 6177 if !ok { 6178 return false 6179 } 6180 return cmp.RefOfCreateDatabase(a, b) 6181 case *CreateTable: 6182 b, ok := inB.(*CreateTable) 6183 if !ok { 6184 return false 6185 } 6186 return cmp.RefOfCreateTable(a, b) 6187 case *CreateView: 6188 b, ok := inB.(*CreateView) 6189 if !ok { 6190 return false 6191 } 6192 return cmp.RefOfCreateView(a, b) 6193 case *DeallocateStmt: 6194 b, ok := inB.(*DeallocateStmt) 6195 if !ok { 6196 return false 6197 } 6198 return cmp.RefOfDeallocateStmt(a, b) 6199 case *Delete: 6200 b, ok := inB.(*Delete) 6201 if !ok { 6202 return false 6203 } 6204 return cmp.RefOfDelete(a, b) 6205 case *DropDatabase: 6206 b, ok := inB.(*DropDatabase) 6207 if !ok { 6208 return false 6209 } 6210 return cmp.RefOfDropDatabase(a, b) 6211 case *DropTable: 6212 b, ok := inB.(*DropTable) 6213 if !ok { 6214 return false 6215 } 6216 return cmp.RefOfDropTable(a, b) 6217 case *DropView: 6218 b, ok := inB.(*DropView) 6219 if !ok { 6220 return false 6221 } 6222 return cmp.RefOfDropView(a, b) 6223 case *ExecuteStmt: 6224 b, ok := inB.(*ExecuteStmt) 6225 if !ok { 6226 return false 6227 } 6228 return cmp.RefOfExecuteStmt(a, b) 6229 case *ExplainStmt: 6230 b, ok := inB.(*ExplainStmt) 6231 if !ok { 6232 return false 6233 } 6234 return cmp.RefOfExplainStmt(a, b) 6235 case *ExplainTab: 6236 b, ok := inB.(*ExplainTab) 6237 if !ok { 6238 return false 6239 } 6240 return cmp.RefOfExplainTab(a, b) 6241 case *Flush: 6242 b, ok := inB.(*Flush) 6243 if !ok { 6244 return false 6245 } 6246 return cmp.RefOfFlush(a, b) 6247 case *Insert: 6248 b, ok := inB.(*Insert) 6249 if !ok { 6250 return false 6251 } 6252 return cmp.RefOfInsert(a, b) 6253 case *Load: 6254 b, ok := inB.(*Load) 6255 if !ok { 6256 return false 6257 } 6258 return cmp.RefOfLoad(a, b) 6259 case *LockTables: 6260 b, ok := inB.(*LockTables) 6261 if !ok { 6262 return false 6263 } 6264 return cmp.RefOfLockTables(a, b) 6265 case *OtherAdmin: 6266 b, ok := inB.(*OtherAdmin) 6267 if !ok { 6268 return false 6269 } 6270 return cmp.RefOfOtherAdmin(a, b) 6271 case *OtherRead: 6272 b, ok := inB.(*OtherRead) 6273 if !ok { 6274 return false 6275 } 6276 return cmp.RefOfOtherRead(a, b) 6277 case *PrepareStmt: 6278 b, ok := inB.(*PrepareStmt) 6279 if !ok { 6280 return false 6281 } 6282 return cmp.RefOfPrepareStmt(a, b) 6283 case *Release: 6284 b, ok := inB.(*Release) 6285 if !ok { 6286 return false 6287 } 6288 return cmp.RefOfRelease(a, b) 6289 case *RenameTable: 6290 b, ok := inB.(*RenameTable) 6291 if !ok { 6292 return false 6293 } 6294 return cmp.RefOfRenameTable(a, b) 6295 case *RevertMigration: 6296 b, ok := inB.(*RevertMigration) 6297 if !ok { 6298 return false 6299 } 6300 return cmp.RefOfRevertMigration(a, b) 6301 case *Rollback: 6302 b, ok := inB.(*Rollback) 6303 if !ok { 6304 return false 6305 } 6306 return cmp.RefOfRollback(a, b) 6307 case *SRollback: 6308 b, ok := inB.(*SRollback) 6309 if !ok { 6310 return false 6311 } 6312 return cmp.RefOfSRollback(a, b) 6313 case *Savepoint: 6314 b, ok := inB.(*Savepoint) 6315 if !ok { 6316 return false 6317 } 6318 return cmp.RefOfSavepoint(a, b) 6319 case *Select: 6320 b, ok := inB.(*Select) 6321 if !ok { 6322 return false 6323 } 6324 return cmp.RefOfSelect(a, b) 6325 case *Set: 6326 b, ok := inB.(*Set) 6327 if !ok { 6328 return false 6329 } 6330 return cmp.RefOfSet(a, b) 6331 case *Show: 6332 b, ok := inB.(*Show) 6333 if !ok { 6334 return false 6335 } 6336 return cmp.RefOfShow(a, b) 6337 case *ShowMigrationLogs: 6338 b, ok := inB.(*ShowMigrationLogs) 6339 if !ok { 6340 return false 6341 } 6342 return cmp.RefOfShowMigrationLogs(a, b) 6343 case *ShowThrottledApps: 6344 b, ok := inB.(*ShowThrottledApps) 6345 if !ok { 6346 return false 6347 } 6348 return cmp.RefOfShowThrottledApps(a, b) 6349 case *ShowThrottlerStatus: 6350 b, ok := inB.(*ShowThrottlerStatus) 6351 if !ok { 6352 return false 6353 } 6354 return cmp.RefOfShowThrottlerStatus(a, b) 6355 case *Stream: 6356 b, ok := inB.(*Stream) 6357 if !ok { 6358 return false 6359 } 6360 return cmp.RefOfStream(a, b) 6361 case *TruncateTable: 6362 b, ok := inB.(*TruncateTable) 6363 if !ok { 6364 return false 6365 } 6366 return cmp.RefOfTruncateTable(a, b) 6367 case *Union: 6368 b, ok := inB.(*Union) 6369 if !ok { 6370 return false 6371 } 6372 return cmp.RefOfUnion(a, b) 6373 case *UnlockTables: 6374 b, ok := inB.(*UnlockTables) 6375 if !ok { 6376 return false 6377 } 6378 return cmp.RefOfUnlockTables(a, b) 6379 case *Update: 6380 b, ok := inB.(*Update) 6381 if !ok { 6382 return false 6383 } 6384 return cmp.RefOfUpdate(a, b) 6385 case *Use: 6386 b, ok := inB.(*Use) 6387 if !ok { 6388 return false 6389 } 6390 return cmp.RefOfUse(a, b) 6391 case *VExplainStmt: 6392 b, ok := inB.(*VExplainStmt) 6393 if !ok { 6394 return false 6395 } 6396 return cmp.RefOfVExplainStmt(a, b) 6397 case *VStream: 6398 b, ok := inB.(*VStream) 6399 if !ok { 6400 return false 6401 } 6402 return cmp.RefOfVStream(a, b) 6403 default: 6404 // this should never happen 6405 return false 6406 } 6407 } 6408 6409 // TableExpr does deep equals between the two objects. 6410 func (cmp *Comparator) TableExpr(inA, inB TableExpr) bool { 6411 if inA == nil && inB == nil { 6412 return true 6413 } 6414 if inA == nil || inB == nil { 6415 return false 6416 } 6417 switch a := inA.(type) { 6418 case *AliasedTableExpr: 6419 b, ok := inB.(*AliasedTableExpr) 6420 if !ok { 6421 return false 6422 } 6423 return cmp.RefOfAliasedTableExpr(a, b) 6424 case *JSONTableExpr: 6425 b, ok := inB.(*JSONTableExpr) 6426 if !ok { 6427 return false 6428 } 6429 return cmp.RefOfJSONTableExpr(a, b) 6430 case *JoinTableExpr: 6431 b, ok := inB.(*JoinTableExpr) 6432 if !ok { 6433 return false 6434 } 6435 return cmp.RefOfJoinTableExpr(a, b) 6436 case *ParenTableExpr: 6437 b, ok := inB.(*ParenTableExpr) 6438 if !ok { 6439 return false 6440 } 6441 return cmp.RefOfParenTableExpr(a, b) 6442 default: 6443 // this should never happen 6444 return false 6445 } 6446 } 6447 6448 // SliceOfRefOfColumnDefinition does deep equals between the two objects. 6449 func (cmp *Comparator) SliceOfRefOfColumnDefinition(a, b []*ColumnDefinition) bool { 6450 if len(a) != len(b) { 6451 return false 6452 } 6453 for i := 0; i < len(a); i++ { 6454 if !cmp.RefOfColumnDefinition(a[i], b[i]) { 6455 return false 6456 } 6457 } 6458 return true 6459 } 6460 6461 // RefOfBool does deep equals between the two objects. 6462 func (cmp *Comparator) RefOfBool(a, b *bool) bool { 6463 if a == b { 6464 return true 6465 } 6466 if a == nil || b == nil { 6467 return false 6468 } 6469 return *a == *b 6470 } 6471 6472 // SliceOfDatabaseOption does deep equals between the two objects. 6473 func (cmp *Comparator) SliceOfDatabaseOption(a, b []DatabaseOption) bool { 6474 if len(a) != len(b) { 6475 return false 6476 } 6477 for i := 0; i < len(a); i++ { 6478 if !cmp.DatabaseOption(a[i], b[i]) { 6479 return false 6480 } 6481 } 6482 return true 6483 } 6484 6485 // SliceOfAlterOption does deep equals between the two objects. 6486 func (cmp *Comparator) SliceOfAlterOption(a, b []AlterOption) bool { 6487 if len(a) != len(b) { 6488 return false 6489 } 6490 for i := 0; i < len(a); i++ { 6491 if !cmp.AlterOption(a[i], b[i]) { 6492 return false 6493 } 6494 } 6495 return true 6496 } 6497 6498 // SliceOfIdentifierCI does deep equals between the two objects. 6499 func (cmp *Comparator) SliceOfIdentifierCI(a, b []IdentifierCI) bool { 6500 if len(a) != len(b) { 6501 return false 6502 } 6503 for i := 0; i < len(a); i++ { 6504 if !cmp.IdentifierCI(a[i], b[i]) { 6505 return false 6506 } 6507 } 6508 return true 6509 } 6510 6511 // SliceOfTxAccessMode does deep equals between the two objects. 6512 func (cmp *Comparator) SliceOfTxAccessMode(a, b []TxAccessMode) bool { 6513 if len(a) != len(b) { 6514 return false 6515 } 6516 for i := 0; i < len(a); i++ { 6517 if a[i] != b[i] { 6518 return false 6519 } 6520 } 6521 return true 6522 } 6523 6524 // SliceOfRefOfWhen does deep equals between the two objects. 6525 func (cmp *Comparator) SliceOfRefOfWhen(a, b []*When) bool { 6526 if len(a) != len(b) { 6527 return false 6528 } 6529 for i := 0; i < len(a); i++ { 6530 if !cmp.RefOfWhen(a[i], b[i]) { 6531 return false 6532 } 6533 } 6534 return true 6535 } 6536 6537 // RefOfColumnTypeOptions does deep equals between the two objects. 6538 func (cmp *Comparator) RefOfColumnTypeOptions(a, b *ColumnTypeOptions) bool { 6539 if a == b { 6540 return true 6541 } 6542 if a == nil || b == nil { 6543 return false 6544 } 6545 return a.Autoincrement == b.Autoincrement && 6546 a.Collate == b.Collate && 6547 cmp.RefOfBool(a.Null, b.Null) && 6548 cmp.Expr(a.Default, b.Default) && 6549 cmp.Expr(a.OnUpdate, b.OnUpdate) && 6550 cmp.Expr(a.As, b.As) && 6551 cmp.RefOfLiteral(a.Comment, b.Comment) && 6552 a.Storage == b.Storage && 6553 cmp.RefOfReferenceDefinition(a.Reference, b.Reference) && 6554 a.KeyOpt == b.KeyOpt && 6555 cmp.RefOfBool(a.Invisible, b.Invisible) && 6556 a.Format == b.Format && 6557 cmp.RefOfLiteral(a.EngineAttribute, b.EngineAttribute) && 6558 cmp.RefOfLiteral(a.SecondaryEngineAttribute, b.SecondaryEngineAttribute) && 6559 cmp.RefOfLiteral(a.SRID, b.SRID) 6560 } 6561 6562 // ColumnCharset does deep equals between the two objects. 6563 func (cmp *Comparator) ColumnCharset(a, b ColumnCharset) bool { 6564 return a.Name == b.Name && 6565 a.Binary == b.Binary 6566 } 6567 6568 // SliceOfString does deep equals between the two objects. 6569 func (cmp *Comparator) SliceOfString(a, b []string) bool { 6570 if len(a) != len(b) { 6571 return false 6572 } 6573 for i := 0; i < len(a); i++ { 6574 if a[i] != b[i] { 6575 return false 6576 } 6577 } 6578 return true 6579 } 6580 6581 // SliceOfRefOfVariable does deep equals between the two objects. 6582 func (cmp *Comparator) SliceOfRefOfVariable(a, b []*Variable) bool { 6583 if len(a) != len(b) { 6584 return false 6585 } 6586 for i := 0; i < len(a); i++ { 6587 if !cmp.RefOfVariable(a[i], b[i]) { 6588 return false 6589 } 6590 } 6591 return true 6592 } 6593 6594 // RefOfIdentifierCI does deep equals between the two objects. 6595 func (cmp *Comparator) RefOfIdentifierCI(a, b *IdentifierCI) bool { 6596 if a == b { 6597 return true 6598 } 6599 if a == nil || b == nil { 6600 return false 6601 } 6602 return a.val == b.val && 6603 a.lowered == b.lowered 6604 } 6605 6606 // RefOfIdentifierCS does deep equals between the two objects. 6607 func (cmp *Comparator) RefOfIdentifierCS(a, b *IdentifierCS) bool { 6608 if a == b { 6609 return true 6610 } 6611 if a == nil || b == nil { 6612 return false 6613 } 6614 return a.v == b.v 6615 } 6616 6617 // SliceOfRefOfIndexColumn does deep equals between the two objects. 6618 func (cmp *Comparator) SliceOfRefOfIndexColumn(a, b []*IndexColumn) bool { 6619 if len(a) != len(b) { 6620 return false 6621 } 6622 for i := 0; i < len(a); i++ { 6623 if !cmp.RefOfIndexColumn(a[i], b[i]) { 6624 return false 6625 } 6626 } 6627 return true 6628 } 6629 6630 // SliceOfRefOfIndexOption does deep equals between the two objects. 6631 func (cmp *Comparator) SliceOfRefOfIndexOption(a, b []*IndexOption) bool { 6632 if len(a) != len(b) { 6633 return false 6634 } 6635 for i := 0; i < len(a); i++ { 6636 if !cmp.RefOfIndexOption(a[i], b[i]) { 6637 return false 6638 } 6639 } 6640 return true 6641 } 6642 6643 // SliceOfExpr does deep equals between the two objects. 6644 func (cmp *Comparator) SliceOfExpr(a, b []Expr) bool { 6645 if len(a) != len(b) { 6646 return false 6647 } 6648 for i := 0; i < len(a); i++ { 6649 if !cmp.Expr(a[i], b[i]) { 6650 return false 6651 } 6652 } 6653 return true 6654 } 6655 6656 // SliceOfRefOfJSONObjectParam does deep equals between the two objects. 6657 func (cmp *Comparator) SliceOfRefOfJSONObjectParam(a, b []*JSONObjectParam) bool { 6658 if len(a) != len(b) { 6659 return false 6660 } 6661 for i := 0; i < len(a); i++ { 6662 if !cmp.RefOfJSONObjectParam(a[i], b[i]) { 6663 return false 6664 } 6665 } 6666 return true 6667 } 6668 6669 // SliceOfRefOfJtColumnDefinition does deep equals between the two objects. 6670 func (cmp *Comparator) SliceOfRefOfJtColumnDefinition(a, b []*JtColumnDefinition) bool { 6671 if len(a) != len(b) { 6672 return false 6673 } 6674 for i := 0; i < len(a); i++ { 6675 if !cmp.RefOfJtColumnDefinition(a[i], b[i]) { 6676 return false 6677 } 6678 } 6679 return true 6680 } 6681 6682 // RefOfJtOrdinalColDef does deep equals between the two objects. 6683 func (cmp *Comparator) RefOfJtOrdinalColDef(a, b *JtOrdinalColDef) bool { 6684 if a == b { 6685 return true 6686 } 6687 if a == nil || b == nil { 6688 return false 6689 } 6690 return cmp.IdentifierCI(a.Name, b.Name) 6691 } 6692 6693 // RefOfJtPathColDef does deep equals between the two objects. 6694 func (cmp *Comparator) RefOfJtPathColDef(a, b *JtPathColDef) bool { 6695 if a == b { 6696 return true 6697 } 6698 if a == nil || b == nil { 6699 return false 6700 } 6701 return a.JtColExists == b.JtColExists && 6702 cmp.IdentifierCI(a.Name, b.Name) && 6703 cmp.RefOfColumnType(a.Type, b.Type) && 6704 cmp.Expr(a.Path, b.Path) && 6705 cmp.RefOfJtOnResponse(a.EmptyOnResponse, b.EmptyOnResponse) && 6706 cmp.RefOfJtOnResponse(a.ErrorOnResponse, b.ErrorOnResponse) 6707 } 6708 6709 // RefOfJtNestedPathColDef does deep equals between the two objects. 6710 func (cmp *Comparator) RefOfJtNestedPathColDef(a, b *JtNestedPathColDef) bool { 6711 if a == b { 6712 return true 6713 } 6714 if a == nil || b == nil { 6715 return false 6716 } 6717 return cmp.Expr(a.Path, b.Path) && 6718 cmp.SliceOfRefOfJtColumnDefinition(a.Columns, b.Columns) 6719 } 6720 6721 // TableAndLockTypes does deep equals between the two objects. 6722 func (cmp *Comparator) TableAndLockTypes(a, b TableAndLockTypes) bool { 6723 if len(a) != len(b) { 6724 return false 6725 } 6726 for i := 0; i < len(a); i++ { 6727 if !cmp.RefOfTableAndLockType(a[i], b[i]) { 6728 return false 6729 } 6730 } 6731 return true 6732 } 6733 6734 // SliceOfRefOfColName does deep equals between the two objects. 6735 func (cmp *Comparator) SliceOfRefOfColName(a, b []*ColName) bool { 6736 if len(a) != len(b) { 6737 return false 6738 } 6739 for i := 0; i < len(a); i++ { 6740 if !cmp.RefOfColName(a[i], b[i]) { 6741 return false 6742 } 6743 } 6744 return true 6745 } 6746 6747 // Comments does deep equals between the two objects. 6748 func (cmp *Comparator) Comments(a, b Comments) bool { 6749 if len(a) != len(b) { 6750 return false 6751 } 6752 for i := 0; i < len(a); i++ { 6753 if a[i] != b[i] { 6754 return false 6755 } 6756 } 6757 return true 6758 } 6759 6760 // RefOfInt does deep equals between the two objects. 6761 func (cmp *Comparator) RefOfInt(a, b *int) bool { 6762 if a == b { 6763 return true 6764 } 6765 if a == nil || b == nil { 6766 return false 6767 } 6768 return *a == *b 6769 } 6770 6771 // SliceOfRefOfPartitionDefinition does deep equals between the two objects. 6772 func (cmp *Comparator) SliceOfRefOfPartitionDefinition(a, b []*PartitionDefinition) bool { 6773 if len(a) != len(b) { 6774 return false 6775 } 6776 for i := 0; i < len(a); i++ { 6777 if !cmp.RefOfPartitionDefinition(a[i], b[i]) { 6778 return false 6779 } 6780 } 6781 return true 6782 } 6783 6784 // SliceOfRefOfRenameTablePair does deep equals between the two objects. 6785 func (cmp *Comparator) SliceOfRefOfRenameTablePair(a, b []*RenameTablePair) bool { 6786 if len(a) != len(b) { 6787 return false 6788 } 6789 for i := 0; i < len(a); i++ { 6790 if !cmp.RefOfRenameTablePair(a[i], b[i]) { 6791 return false 6792 } 6793 } 6794 return true 6795 } 6796 6797 // RefOfRootNode does deep equals between the two objects. 6798 func (cmp *Comparator) RefOfRootNode(a, b *RootNode) bool { 6799 if a == b { 6800 return true 6801 } 6802 if a == nil || b == nil { 6803 return false 6804 } 6805 return cmp.SQLNode(a.SQLNode, b.SQLNode) 6806 } 6807 6808 // SliceOfTableExpr does deep equals between the two objects. 6809 func (cmp *Comparator) SliceOfTableExpr(a, b []TableExpr) bool { 6810 if len(a) != len(b) { 6811 return false 6812 } 6813 for i := 0; i < len(a); i++ { 6814 if !cmp.TableExpr(a[i], b[i]) { 6815 return false 6816 } 6817 } 6818 return true 6819 } 6820 6821 // RefOfTableName does deep equals between the two objects. 6822 func (cmp *Comparator) RefOfTableName(a, b *TableName) bool { 6823 if a == b { 6824 return true 6825 } 6826 if a == nil || b == nil { 6827 return false 6828 } 6829 return cmp.IdentifierCS(a.Name, b.Name) && 6830 cmp.IdentifierCS(a.Qualifier, b.Qualifier) 6831 } 6832 6833 // RefOfTableOption does deep equals between the two objects. 6834 func (cmp *Comparator) RefOfTableOption(a, b *TableOption) bool { 6835 if a == b { 6836 return true 6837 } 6838 if a == nil || b == nil { 6839 return false 6840 } 6841 return a.Name == b.Name && 6842 a.String == b.String && 6843 a.CaseSensitive == b.CaseSensitive && 6844 cmp.RefOfLiteral(a.Value, b.Value) && 6845 cmp.TableNames(a.Tables, b.Tables) 6846 } 6847 6848 // SliceOfRefOfIndexDefinition does deep equals between the two objects. 6849 func (cmp *Comparator) SliceOfRefOfIndexDefinition(a, b []*IndexDefinition) bool { 6850 if len(a) != len(b) { 6851 return false 6852 } 6853 for i := 0; i < len(a); i++ { 6854 if !cmp.RefOfIndexDefinition(a[i], b[i]) { 6855 return false 6856 } 6857 } 6858 return true 6859 } 6860 6861 // SliceOfRefOfConstraintDefinition does deep equals between the two objects. 6862 func (cmp *Comparator) SliceOfRefOfConstraintDefinition(a, b []*ConstraintDefinition) bool { 6863 if len(a) != len(b) { 6864 return false 6865 } 6866 for i := 0; i < len(a); i++ { 6867 if !cmp.RefOfConstraintDefinition(a[i], b[i]) { 6868 return false 6869 } 6870 } 6871 return true 6872 } 6873 6874 // RefOfVindexParam does deep equals between the two objects. 6875 func (cmp *Comparator) RefOfVindexParam(a, b *VindexParam) bool { 6876 if a == b { 6877 return true 6878 } 6879 if a == nil || b == nil { 6880 return false 6881 } 6882 return a.Val == b.Val && 6883 cmp.IdentifierCI(a.Key, b.Key) 6884 } 6885 6886 // SliceOfVindexParam does deep equals between the two objects. 6887 func (cmp *Comparator) SliceOfVindexParam(a, b []VindexParam) bool { 6888 if len(a) != len(b) { 6889 return false 6890 } 6891 for i := 0; i < len(a); i++ { 6892 if !cmp.VindexParam(a[i], b[i]) { 6893 return false 6894 } 6895 } 6896 return true 6897 } 6898 6899 // SliceOfRefOfCommonTableExpr does deep equals between the two objects. 6900 func (cmp *Comparator) SliceOfRefOfCommonTableExpr(a, b []*CommonTableExpr) bool { 6901 if len(a) != len(b) { 6902 return false 6903 } 6904 for i := 0; i < len(a); i++ { 6905 if !cmp.RefOfCommonTableExpr(a[i], b[i]) { 6906 return false 6907 } 6908 } 6909 return true 6910 } 6911 6912 // DatabaseOption does deep equals between the two objects. 6913 func (cmp *Comparator) DatabaseOption(a, b DatabaseOption) bool { 6914 return a.IsDefault == b.IsDefault && 6915 a.Value == b.Value && 6916 a.Type == b.Type 6917 } 6918 6919 // RefOfColumnCharset does deep equals between the two objects. 6920 func (cmp *Comparator) RefOfColumnCharset(a, b *ColumnCharset) bool { 6921 if a == b { 6922 return true 6923 } 6924 if a == nil || b == nil { 6925 return false 6926 } 6927 return a.Name == b.Name && 6928 a.Binary == b.Binary 6929 } 6930 6931 // RefOfIndexColumn does deep equals between the two objects. 6932 func (cmp *Comparator) RefOfIndexColumn(a, b *IndexColumn) bool { 6933 if a == b { 6934 return true 6935 } 6936 if a == nil || b == nil { 6937 return false 6938 } 6939 return cmp.IdentifierCI(a.Column, b.Column) && 6940 cmp.RefOfLiteral(a.Length, b.Length) && 6941 cmp.Expr(a.Expression, b.Expression) && 6942 a.Direction == b.Direction 6943 } 6944 6945 // RefOfIndexOption does deep equals between the two objects. 6946 func (cmp *Comparator) RefOfIndexOption(a, b *IndexOption) bool { 6947 if a == b { 6948 return true 6949 } 6950 if a == nil || b == nil { 6951 return false 6952 } 6953 return a.Name == b.Name && 6954 a.String == b.String && 6955 cmp.RefOfLiteral(a.Value, b.Value) 6956 } 6957 6958 // RefOfTableAndLockType does deep equals between the two objects. 6959 func (cmp *Comparator) RefOfTableAndLockType(a, b *TableAndLockType) bool { 6960 if a == b { 6961 return true 6962 } 6963 if a == nil || b == nil { 6964 return false 6965 } 6966 return cmp.TableExpr(a.Table, b.Table) && 6967 a.Lock == b.Lock 6968 } 6969 6970 // RefOfRenameTablePair does deep equals between the two objects. 6971 func (cmp *Comparator) RefOfRenameTablePair(a, b *RenameTablePair) bool { 6972 if a == b { 6973 return true 6974 } 6975 if a == nil || b == nil { 6976 return false 6977 } 6978 return cmp.TableName(a.FromTable, b.FromTable) && 6979 cmp.TableName(a.ToTable, b.ToTable) 6980 } 6981 6982 // RefOfDatabaseOption does deep equals between the two objects. 6983 func (cmp *Comparator) RefOfDatabaseOption(a, b *DatabaseOption) bool { 6984 if a == b { 6985 return true 6986 } 6987 if a == nil || b == nil { 6988 return false 6989 } 6990 return a.IsDefault == b.IsDefault && 6991 a.Value == b.Value && 6992 a.Type == b.Type 6993 } 6994 6995 type Comparator struct { 6996 RefOfColName_ func(a, b *ColName) bool 6997 }