github.com/team-ide/go-dialect@v1.9.20/vitess/sqlparser/ast_equals.go (about) 1 /* 2 Copyright 2021 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 // EqualsSQLNode does deep equals between the two objects. 21 func EqualsSQLNode(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 AccessMode: 30 b, ok := inB.(AccessMode) 31 if !ok { 32 return false 33 } 34 return a == b 35 case *AddColumns: 36 b, ok := inB.(*AddColumns) 37 if !ok { 38 return false 39 } 40 return EqualsRefOfAddColumns(a, b) 41 case *AddConstraintDefinition: 42 b, ok := inB.(*AddConstraintDefinition) 43 if !ok { 44 return false 45 } 46 return EqualsRefOfAddConstraintDefinition(a, b) 47 case *AddIndexDefinition: 48 b, ok := inB.(*AddIndexDefinition) 49 if !ok { 50 return false 51 } 52 return EqualsRefOfAddIndexDefinition(a, b) 53 case AlgorithmValue: 54 b, ok := inB.(AlgorithmValue) 55 if !ok { 56 return false 57 } 58 return a == b 59 case *AliasedExpr: 60 b, ok := inB.(*AliasedExpr) 61 if !ok { 62 return false 63 } 64 return EqualsRefOfAliasedExpr(a, b) 65 case *AliasedTableExpr: 66 b, ok := inB.(*AliasedTableExpr) 67 if !ok { 68 return false 69 } 70 return EqualsRefOfAliasedTableExpr(a, b) 71 case *AlterCharset: 72 b, ok := inB.(*AlterCharset) 73 if !ok { 74 return false 75 } 76 return EqualsRefOfAlterCharset(a, b) 77 case *AlterColumn: 78 b, ok := inB.(*AlterColumn) 79 if !ok { 80 return false 81 } 82 return EqualsRefOfAlterColumn(a, b) 83 case *AlterDatabase: 84 b, ok := inB.(*AlterDatabase) 85 if !ok { 86 return false 87 } 88 return EqualsRefOfAlterDatabase(a, b) 89 case *AlterMigration: 90 b, ok := inB.(*AlterMigration) 91 if !ok { 92 return false 93 } 94 return EqualsRefOfAlterMigration(a, b) 95 case *AlterTable: 96 b, ok := inB.(*AlterTable) 97 if !ok { 98 return false 99 } 100 return EqualsRefOfAlterTable(a, b) 101 case *AlterView: 102 b, ok := inB.(*AlterView) 103 if !ok { 104 return false 105 } 106 return EqualsRefOfAlterView(a, b) 107 case *AlterVschema: 108 b, ok := inB.(*AlterVschema) 109 if !ok { 110 return false 111 } 112 return EqualsRefOfAlterVschema(a, b) 113 case *AndExpr: 114 b, ok := inB.(*AndExpr) 115 if !ok { 116 return false 117 } 118 return EqualsRefOfAndExpr(a, b) 119 case Argument: 120 b, ok := inB.(Argument) 121 if !ok { 122 return false 123 } 124 return a == b 125 case *AutoIncSpec: 126 b, ok := inB.(*AutoIncSpec) 127 if !ok { 128 return false 129 } 130 return EqualsRefOfAutoIncSpec(a, b) 131 case *Begin: 132 b, ok := inB.(*Begin) 133 if !ok { 134 return false 135 } 136 return EqualsRefOfBegin(a, b) 137 case *BetweenExpr: 138 b, ok := inB.(*BetweenExpr) 139 if !ok { 140 return false 141 } 142 return EqualsRefOfBetweenExpr(a, b) 143 case *BinaryExpr: 144 b, ok := inB.(*BinaryExpr) 145 if !ok { 146 return false 147 } 148 return EqualsRefOfBinaryExpr(a, b) 149 case BoolVal: 150 b, ok := inB.(BoolVal) 151 if !ok { 152 return false 153 } 154 return a == b 155 case *CallProc: 156 b, ok := inB.(*CallProc) 157 if !ok { 158 return false 159 } 160 return EqualsRefOfCallProc(a, b) 161 case *CaseExpr: 162 b, ok := inB.(*CaseExpr) 163 if !ok { 164 return false 165 } 166 return EqualsRefOfCaseExpr(a, b) 167 case *ChangeColumn: 168 b, ok := inB.(*ChangeColumn) 169 if !ok { 170 return false 171 } 172 return EqualsRefOfChangeColumn(a, b) 173 case *CheckConstraintDefinition: 174 b, ok := inB.(*CheckConstraintDefinition) 175 if !ok { 176 return false 177 } 178 return EqualsRefOfCheckConstraintDefinition(a, b) 179 case ColIdent: 180 b, ok := inB.(ColIdent) 181 if !ok { 182 return false 183 } 184 return EqualsColIdent(a, b) 185 case *ColName: 186 b, ok := inB.(*ColName) 187 if !ok { 188 return false 189 } 190 return EqualsRefOfColName(a, b) 191 case *CollateExpr: 192 b, ok := inB.(*CollateExpr) 193 if !ok { 194 return false 195 } 196 return EqualsRefOfCollateExpr(a, b) 197 case *ColumnDefinition: 198 b, ok := inB.(*ColumnDefinition) 199 if !ok { 200 return false 201 } 202 return EqualsRefOfColumnDefinition(a, b) 203 case *ColumnType: 204 b, ok := inB.(*ColumnType) 205 if !ok { 206 return false 207 } 208 return EqualsRefOfColumnType(a, b) 209 case Columns: 210 b, ok := inB.(Columns) 211 if !ok { 212 return false 213 } 214 return EqualsColumns(a, b) 215 case Comments: 216 b, ok := inB.(Comments) 217 if !ok { 218 return false 219 } 220 return EqualsComments(a, b) 221 case *Commit: 222 b, ok := inB.(*Commit) 223 if !ok { 224 return false 225 } 226 return EqualsRefOfCommit(a, b) 227 case *CommonTableExpr: 228 b, ok := inB.(*CommonTableExpr) 229 if !ok { 230 return false 231 } 232 return EqualsRefOfCommonTableExpr(a, b) 233 case *ComparisonExpr: 234 b, ok := inB.(*ComparisonExpr) 235 if !ok { 236 return false 237 } 238 return EqualsRefOfComparisonExpr(a, b) 239 case *ConstraintDefinition: 240 b, ok := inB.(*ConstraintDefinition) 241 if !ok { 242 return false 243 } 244 return EqualsRefOfConstraintDefinition(a, b) 245 case *ConvertExpr: 246 b, ok := inB.(*ConvertExpr) 247 if !ok { 248 return false 249 } 250 return EqualsRefOfConvertExpr(a, b) 251 case *ConvertType: 252 b, ok := inB.(*ConvertType) 253 if !ok { 254 return false 255 } 256 return EqualsRefOfConvertType(a, b) 257 case *ConvertUsingExpr: 258 b, ok := inB.(*ConvertUsingExpr) 259 if !ok { 260 return false 261 } 262 return EqualsRefOfConvertUsingExpr(a, b) 263 case *CreateDatabase: 264 b, ok := inB.(*CreateDatabase) 265 if !ok { 266 return false 267 } 268 return EqualsRefOfCreateDatabase(a, b) 269 case *CreateTable: 270 b, ok := inB.(*CreateTable) 271 if !ok { 272 return false 273 } 274 return EqualsRefOfCreateTable(a, b) 275 case *CreateView: 276 b, ok := inB.(*CreateView) 277 if !ok { 278 return false 279 } 280 return EqualsRefOfCreateView(a, b) 281 case *CurTimeFuncExpr: 282 b, ok := inB.(*CurTimeFuncExpr) 283 if !ok { 284 return false 285 } 286 return EqualsRefOfCurTimeFuncExpr(a, b) 287 case *Default: 288 b, ok := inB.(*Default) 289 if !ok { 290 return false 291 } 292 return EqualsRefOfDefault(a, b) 293 case *Delete: 294 b, ok := inB.(*Delete) 295 if !ok { 296 return false 297 } 298 return EqualsRefOfDelete(a, b) 299 case *DerivedTable: 300 b, ok := inB.(*DerivedTable) 301 if !ok { 302 return false 303 } 304 return EqualsRefOfDerivedTable(a, b) 305 case *DropColumn: 306 b, ok := inB.(*DropColumn) 307 if !ok { 308 return false 309 } 310 return EqualsRefOfDropColumn(a, b) 311 case *DropDatabase: 312 b, ok := inB.(*DropDatabase) 313 if !ok { 314 return false 315 } 316 return EqualsRefOfDropDatabase(a, b) 317 case *DropKey: 318 b, ok := inB.(*DropKey) 319 if !ok { 320 return false 321 } 322 return EqualsRefOfDropKey(a, b) 323 case *DropTable: 324 b, ok := inB.(*DropTable) 325 if !ok { 326 return false 327 } 328 return EqualsRefOfDropTable(a, b) 329 case *DropView: 330 b, ok := inB.(*DropView) 331 if !ok { 332 return false 333 } 334 return EqualsRefOfDropView(a, b) 335 case *ExistsExpr: 336 b, ok := inB.(*ExistsExpr) 337 if !ok { 338 return false 339 } 340 return EqualsRefOfExistsExpr(a, b) 341 case *ExplainStmt: 342 b, ok := inB.(*ExplainStmt) 343 if !ok { 344 return false 345 } 346 return EqualsRefOfExplainStmt(a, b) 347 case *ExplainTab: 348 b, ok := inB.(*ExplainTab) 349 if !ok { 350 return false 351 } 352 return EqualsRefOfExplainTab(a, b) 353 case *ExprOrColumns: 354 b, ok := inB.(*ExprOrColumns) 355 if !ok { 356 return false 357 } 358 return EqualsRefOfExprOrColumns(a, b) 359 case Exprs: 360 b, ok := inB.(Exprs) 361 if !ok { 362 return false 363 } 364 return EqualsExprs(a, b) 365 case *ExtractFuncExpr: 366 b, ok := inB.(*ExtractFuncExpr) 367 if !ok { 368 return false 369 } 370 return EqualsRefOfExtractFuncExpr(a, b) 371 case *ExtractedSubquery: 372 b, ok := inB.(*ExtractedSubquery) 373 if !ok { 374 return false 375 } 376 return EqualsRefOfExtractedSubquery(a, b) 377 case *Flush: 378 b, ok := inB.(*Flush) 379 if !ok { 380 return false 381 } 382 return EqualsRefOfFlush(a, b) 383 case *Force: 384 b, ok := inB.(*Force) 385 if !ok { 386 return false 387 } 388 return EqualsRefOfForce(a, b) 389 case *ForeignKeyDefinition: 390 b, ok := inB.(*ForeignKeyDefinition) 391 if !ok { 392 return false 393 } 394 return EqualsRefOfForeignKeyDefinition(a, b) 395 case *FuncExpr: 396 b, ok := inB.(*FuncExpr) 397 if !ok { 398 return false 399 } 400 return EqualsRefOfFuncExpr(a, b) 401 case GroupBy: 402 b, ok := inB.(GroupBy) 403 if !ok { 404 return false 405 } 406 return EqualsGroupBy(a, b) 407 case *GroupConcatExpr: 408 b, ok := inB.(*GroupConcatExpr) 409 if !ok { 410 return false 411 } 412 return EqualsRefOfGroupConcatExpr(a, b) 413 case *IndexDefinition: 414 b, ok := inB.(*IndexDefinition) 415 if !ok { 416 return false 417 } 418 return EqualsRefOfIndexDefinition(a, b) 419 case *IndexHints: 420 b, ok := inB.(*IndexHints) 421 if !ok { 422 return false 423 } 424 return EqualsRefOfIndexHints(a, b) 425 case *IndexInfo: 426 b, ok := inB.(*IndexInfo) 427 if !ok { 428 return false 429 } 430 return EqualsRefOfIndexInfo(a, b) 431 case *Insert: 432 b, ok := inB.(*Insert) 433 if !ok { 434 return false 435 } 436 return EqualsRefOfInsert(a, b) 437 case *IntervalExpr: 438 b, ok := inB.(*IntervalExpr) 439 if !ok { 440 return false 441 } 442 return EqualsRefOfIntervalExpr(a, b) 443 case *IntroducerExpr: 444 b, ok := inB.(*IntroducerExpr) 445 if !ok { 446 return false 447 } 448 return EqualsRefOfIntroducerExpr(a, b) 449 case *IsExpr: 450 b, ok := inB.(*IsExpr) 451 if !ok { 452 return false 453 } 454 return EqualsRefOfIsExpr(a, b) 455 case IsolationLevel: 456 b, ok := inB.(IsolationLevel) 457 if !ok { 458 return false 459 } 460 return a == b 461 case *JoinCondition: 462 b, ok := inB.(*JoinCondition) 463 if !ok { 464 return false 465 } 466 return EqualsRefOfJoinCondition(a, b) 467 case *JoinTableExpr: 468 b, ok := inB.(*JoinTableExpr) 469 if !ok { 470 return false 471 } 472 return EqualsRefOfJoinTableExpr(a, b) 473 case *KeyState: 474 b, ok := inB.(*KeyState) 475 if !ok { 476 return false 477 } 478 return EqualsRefOfKeyState(a, b) 479 case *Limit: 480 b, ok := inB.(*Limit) 481 if !ok { 482 return false 483 } 484 return EqualsRefOfLimit(a, b) 485 case ListArg: 486 b, ok := inB.(ListArg) 487 if !ok { 488 return false 489 } 490 return a == b 491 case *Literal: 492 b, ok := inB.(*Literal) 493 if !ok { 494 return false 495 } 496 return EqualsRefOfLiteral(a, b) 497 case *Load: 498 b, ok := inB.(*Load) 499 if !ok { 500 return false 501 } 502 return EqualsRefOfLoad(a, b) 503 case *LockOption: 504 b, ok := inB.(*LockOption) 505 if !ok { 506 return false 507 } 508 return EqualsRefOfLockOption(a, b) 509 case *LockTables: 510 b, ok := inB.(*LockTables) 511 if !ok { 512 return false 513 } 514 return EqualsRefOfLockTables(a, b) 515 case *MatchExpr: 516 b, ok := inB.(*MatchExpr) 517 if !ok { 518 return false 519 } 520 return EqualsRefOfMatchExpr(a, b) 521 case *ModifyColumn: 522 b, ok := inB.(*ModifyColumn) 523 if !ok { 524 return false 525 } 526 return EqualsRefOfModifyColumn(a, b) 527 case *Nextval: 528 b, ok := inB.(*Nextval) 529 if !ok { 530 return false 531 } 532 return EqualsRefOfNextval(a, b) 533 case *NotExpr: 534 b, ok := inB.(*NotExpr) 535 if !ok { 536 return false 537 } 538 return EqualsRefOfNotExpr(a, b) 539 case *NullVal: 540 b, ok := inB.(*NullVal) 541 if !ok { 542 return false 543 } 544 return EqualsRefOfNullVal(a, b) 545 case OnDup: 546 b, ok := inB.(OnDup) 547 if !ok { 548 return false 549 } 550 return EqualsOnDup(a, b) 551 case *OptLike: 552 b, ok := inB.(*OptLike) 553 if !ok { 554 return false 555 } 556 return EqualsRefOfOptLike(a, b) 557 case *OrExpr: 558 b, ok := inB.(*OrExpr) 559 if !ok { 560 return false 561 } 562 return EqualsRefOfOrExpr(a, b) 563 case *Order: 564 b, ok := inB.(*Order) 565 if !ok { 566 return false 567 } 568 return EqualsRefOfOrder(a, b) 569 case OrderBy: 570 b, ok := inB.(OrderBy) 571 if !ok { 572 return false 573 } 574 return EqualsOrderBy(a, b) 575 case *OrderByOption: 576 b, ok := inB.(*OrderByOption) 577 if !ok { 578 return false 579 } 580 return EqualsRefOfOrderByOption(a, b) 581 case *OtherAdmin: 582 b, ok := inB.(*OtherAdmin) 583 if !ok { 584 return false 585 } 586 return EqualsRefOfOtherAdmin(a, b) 587 case *OtherRead: 588 b, ok := inB.(*OtherRead) 589 if !ok { 590 return false 591 } 592 return EqualsRefOfOtherRead(a, b) 593 case *ParenTableExpr: 594 b, ok := inB.(*ParenTableExpr) 595 if !ok { 596 return false 597 } 598 return EqualsRefOfParenTableExpr(a, b) 599 case *PartitionDefinition: 600 b, ok := inB.(*PartitionDefinition) 601 if !ok { 602 return false 603 } 604 return EqualsRefOfPartitionDefinition(a, b) 605 case *PartitionOption: 606 b, ok := inB.(*PartitionOption) 607 if !ok { 608 return false 609 } 610 return EqualsRefOfPartitionOption(a, b) 611 case *PartitionSpec: 612 b, ok := inB.(*PartitionSpec) 613 if !ok { 614 return false 615 } 616 return EqualsRefOfPartitionSpec(a, b) 617 case Partitions: 618 b, ok := inB.(Partitions) 619 if !ok { 620 return false 621 } 622 return EqualsPartitions(a, b) 623 case ReferenceAction: 624 b, ok := inB.(ReferenceAction) 625 if !ok { 626 return false 627 } 628 return a == b 629 case *ReferenceDefinition: 630 b, ok := inB.(*ReferenceDefinition) 631 if !ok { 632 return false 633 } 634 return EqualsRefOfReferenceDefinition(a, b) 635 case *Release: 636 b, ok := inB.(*Release) 637 if !ok { 638 return false 639 } 640 return EqualsRefOfRelease(a, b) 641 case *RenameIndex: 642 b, ok := inB.(*RenameIndex) 643 if !ok { 644 return false 645 } 646 return EqualsRefOfRenameIndex(a, b) 647 case *RenameTable: 648 b, ok := inB.(*RenameTable) 649 if !ok { 650 return false 651 } 652 return EqualsRefOfRenameTable(a, b) 653 case *RenameTableName: 654 b, ok := inB.(*RenameTableName) 655 if !ok { 656 return false 657 } 658 return EqualsRefOfRenameTableName(a, b) 659 case *RevertMigration: 660 b, ok := inB.(*RevertMigration) 661 if !ok { 662 return false 663 } 664 return EqualsRefOfRevertMigration(a, b) 665 case *Rollback: 666 b, ok := inB.(*Rollback) 667 if !ok { 668 return false 669 } 670 return EqualsRefOfRollback(a, b) 671 case RootNode: 672 b, ok := inB.(RootNode) 673 if !ok { 674 return false 675 } 676 return EqualsRootNode(a, b) 677 case *SRollback: 678 b, ok := inB.(*SRollback) 679 if !ok { 680 return false 681 } 682 return EqualsRefOfSRollback(a, b) 683 case *Savepoint: 684 b, ok := inB.(*Savepoint) 685 if !ok { 686 return false 687 } 688 return EqualsRefOfSavepoint(a, b) 689 case *Select: 690 b, ok := inB.(*Select) 691 if !ok { 692 return false 693 } 694 return EqualsRefOfSelect(a, b) 695 case SelectExprs: 696 b, ok := inB.(SelectExprs) 697 if !ok { 698 return false 699 } 700 return EqualsSelectExprs(a, b) 701 case *SelectInto: 702 b, ok := inB.(*SelectInto) 703 if !ok { 704 return false 705 } 706 return EqualsRefOfSelectInto(a, b) 707 case *Set: 708 b, ok := inB.(*Set) 709 if !ok { 710 return false 711 } 712 return EqualsRefOfSet(a, b) 713 case *SetExpr: 714 b, ok := inB.(*SetExpr) 715 if !ok { 716 return false 717 } 718 return EqualsRefOfSetExpr(a, b) 719 case SetExprs: 720 b, ok := inB.(SetExprs) 721 if !ok { 722 return false 723 } 724 return EqualsSetExprs(a, b) 725 case *SetTransaction: 726 b, ok := inB.(*SetTransaction) 727 if !ok { 728 return false 729 } 730 return EqualsRefOfSetTransaction(a, b) 731 case *Show: 732 b, ok := inB.(*Show) 733 if !ok { 734 return false 735 } 736 return EqualsRefOfShow(a, b) 737 case *ShowBasic: 738 b, ok := inB.(*ShowBasic) 739 if !ok { 740 return false 741 } 742 return EqualsRefOfShowBasic(a, b) 743 case *ShowCreate: 744 b, ok := inB.(*ShowCreate) 745 if !ok { 746 return false 747 } 748 return EqualsRefOfShowCreate(a, b) 749 case *ShowFilter: 750 b, ok := inB.(*ShowFilter) 751 if !ok { 752 return false 753 } 754 return EqualsRefOfShowFilter(a, b) 755 case *ShowLegacy: 756 b, ok := inB.(*ShowLegacy) 757 if !ok { 758 return false 759 } 760 return EqualsRefOfShowLegacy(a, b) 761 case *ShowMigrationLogs: 762 b, ok := inB.(*ShowMigrationLogs) 763 if !ok { 764 return false 765 } 766 return EqualsRefOfShowMigrationLogs(a, b) 767 case *StarExpr: 768 b, ok := inB.(*StarExpr) 769 if !ok { 770 return false 771 } 772 return EqualsRefOfStarExpr(a, b) 773 case *Stream: 774 b, ok := inB.(*Stream) 775 if !ok { 776 return false 777 } 778 return EqualsRefOfStream(a, b) 779 case *SubPartition: 780 b, ok := inB.(*SubPartition) 781 if !ok { 782 return false 783 } 784 return EqualsRefOfSubPartition(a, b) 785 case *Subquery: 786 b, ok := inB.(*Subquery) 787 if !ok { 788 return false 789 } 790 return EqualsRefOfSubquery(a, b) 791 case *SubstrExpr: 792 b, ok := inB.(*SubstrExpr) 793 if !ok { 794 return false 795 } 796 return EqualsRefOfSubstrExpr(a, b) 797 case TableExprs: 798 b, ok := inB.(TableExprs) 799 if !ok { 800 return false 801 } 802 return EqualsTableExprs(a, b) 803 case TableIdent: 804 b, ok := inB.(TableIdent) 805 if !ok { 806 return false 807 } 808 return EqualsTableIdent(a, b) 809 case TableName: 810 b, ok := inB.(TableName) 811 if !ok { 812 return false 813 } 814 return EqualsTableName(a, b) 815 case TableNames: 816 b, ok := inB.(TableNames) 817 if !ok { 818 return false 819 } 820 return EqualsTableNames(a, b) 821 case TableOptions: 822 b, ok := inB.(TableOptions) 823 if !ok { 824 return false 825 } 826 return EqualsTableOptions(a, b) 827 case *TableSpec: 828 b, ok := inB.(*TableSpec) 829 if !ok { 830 return false 831 } 832 return EqualsRefOfTableSpec(a, b) 833 case *TablespaceOperation: 834 b, ok := inB.(*TablespaceOperation) 835 if !ok { 836 return false 837 } 838 return EqualsRefOfTablespaceOperation(a, b) 839 case *TimestampFuncExpr: 840 b, ok := inB.(*TimestampFuncExpr) 841 if !ok { 842 return false 843 } 844 return EqualsRefOfTimestampFuncExpr(a, b) 845 case *TruncateTable: 846 b, ok := inB.(*TruncateTable) 847 if !ok { 848 return false 849 } 850 return EqualsRefOfTruncateTable(a, b) 851 case *UnaryExpr: 852 b, ok := inB.(*UnaryExpr) 853 if !ok { 854 return false 855 } 856 return EqualsRefOfUnaryExpr(a, b) 857 case *Union: 858 b, ok := inB.(*Union) 859 if !ok { 860 return false 861 } 862 return EqualsRefOfUnion(a, b) 863 case *UnlockTables: 864 b, ok := inB.(*UnlockTables) 865 if !ok { 866 return false 867 } 868 return EqualsRefOfUnlockTables(a, b) 869 case *Update: 870 b, ok := inB.(*Update) 871 if !ok { 872 return false 873 } 874 return EqualsRefOfUpdate(a, b) 875 case *UpdateExpr: 876 b, ok := inB.(*UpdateExpr) 877 if !ok { 878 return false 879 } 880 return EqualsRefOfUpdateExpr(a, b) 881 case UpdateExprs: 882 b, ok := inB.(UpdateExprs) 883 if !ok { 884 return false 885 } 886 return EqualsUpdateExprs(a, b) 887 case *Use: 888 b, ok := inB.(*Use) 889 if !ok { 890 return false 891 } 892 return EqualsRefOfUse(a, b) 893 case *VStream: 894 b, ok := inB.(*VStream) 895 if !ok { 896 return false 897 } 898 return EqualsRefOfVStream(a, b) 899 case ValTuple: 900 b, ok := inB.(ValTuple) 901 if !ok { 902 return false 903 } 904 return EqualsValTuple(a, b) 905 case *Validation: 906 b, ok := inB.(*Validation) 907 if !ok { 908 return false 909 } 910 return EqualsRefOfValidation(a, b) 911 case Values: 912 b, ok := inB.(Values) 913 if !ok { 914 return false 915 } 916 return EqualsValues(a, b) 917 case *ValuesFuncExpr: 918 b, ok := inB.(*ValuesFuncExpr) 919 if !ok { 920 return false 921 } 922 return EqualsRefOfValuesFuncExpr(a, b) 923 case VindexParam: 924 b, ok := inB.(VindexParam) 925 if !ok { 926 return false 927 } 928 return EqualsVindexParam(a, b) 929 case *VindexSpec: 930 b, ok := inB.(*VindexSpec) 931 if !ok { 932 return false 933 } 934 return EqualsRefOfVindexSpec(a, b) 935 case *When: 936 b, ok := inB.(*When) 937 if !ok { 938 return false 939 } 940 return EqualsRefOfWhen(a, b) 941 case *Where: 942 b, ok := inB.(*Where) 943 if !ok { 944 return false 945 } 946 return EqualsRefOfWhere(a, b) 947 case *With: 948 b, ok := inB.(*With) 949 if !ok { 950 return false 951 } 952 return EqualsRefOfWith(a, b) 953 case *XorExpr: 954 b, ok := inB.(*XorExpr) 955 if !ok { 956 return false 957 } 958 return EqualsRefOfXorExpr(a, b) 959 default: 960 // this should never happen 961 return false 962 } 963 } 964 965 // EqualsRefOfAddColumns does deep equals between the two objects. 966 func EqualsRefOfAddColumns(a, b *AddColumns) bool { 967 if a == b { 968 return true 969 } 970 if a == nil || b == nil { 971 return false 972 } 973 return a.First == b.First && 974 EqualsSliceOfRefOfColumnDefinition(a.Columns, b.Columns) && 975 EqualsRefOfColName(a.After, b.After) 976 } 977 978 // EqualsRefOfAddConstraintDefinition does deep equals between the two objects. 979 func EqualsRefOfAddConstraintDefinition(a, b *AddConstraintDefinition) bool { 980 if a == b { 981 return true 982 } 983 if a == nil || b == nil { 984 return false 985 } 986 return EqualsRefOfConstraintDefinition(a.ConstraintDefinition, b.ConstraintDefinition) 987 } 988 989 // EqualsRefOfAddIndexDefinition does deep equals between the two objects. 990 func EqualsRefOfAddIndexDefinition(a, b *AddIndexDefinition) bool { 991 if a == b { 992 return true 993 } 994 if a == nil || b == nil { 995 return false 996 } 997 return EqualsRefOfIndexDefinition(a.IndexDefinition, b.IndexDefinition) 998 } 999 1000 // EqualsRefOfAliasedExpr does deep equals between the two objects. 1001 func EqualsRefOfAliasedExpr(a, b *AliasedExpr) bool { 1002 if a == b { 1003 return true 1004 } 1005 if a == nil || b == nil { 1006 return false 1007 } 1008 return EqualsExpr(a.Expr, b.Expr) && 1009 EqualsColIdent(a.As, b.As) 1010 } 1011 1012 // EqualsRefOfAliasedTableExpr does deep equals between the two objects. 1013 func EqualsRefOfAliasedTableExpr(a, b *AliasedTableExpr) bool { 1014 if a == b { 1015 return true 1016 } 1017 if a == nil || b == nil { 1018 return false 1019 } 1020 return EqualsSimpleTableExpr(a.Expr, b.Expr) && 1021 EqualsPartitions(a.Partitions, b.Partitions) && 1022 EqualsTableIdent(a.As, b.As) && 1023 EqualsRefOfIndexHints(a.Hints, b.Hints) && 1024 EqualsColumns(a.Columns, b.Columns) 1025 } 1026 1027 // EqualsRefOfAlterCharset does deep equals between the two objects. 1028 func EqualsRefOfAlterCharset(a, b *AlterCharset) bool { 1029 if a == b { 1030 return true 1031 } 1032 if a == nil || b == nil { 1033 return false 1034 } 1035 return a.CharacterSet == b.CharacterSet && 1036 a.Collate == b.Collate 1037 } 1038 1039 // EqualsRefOfAlterColumn does deep equals between the two objects. 1040 func EqualsRefOfAlterColumn(a, b *AlterColumn) bool { 1041 if a == b { 1042 return true 1043 } 1044 if a == nil || b == nil { 1045 return false 1046 } 1047 return a.DropDefault == b.DropDefault && 1048 EqualsRefOfColName(a.Column, b.Column) && 1049 EqualsExpr(a.DefaultVal, b.DefaultVal) 1050 } 1051 1052 // EqualsRefOfAlterDatabase does deep equals between the two objects. 1053 func EqualsRefOfAlterDatabase(a, b *AlterDatabase) bool { 1054 if a == b { 1055 return true 1056 } 1057 if a == nil || b == nil { 1058 return false 1059 } 1060 return a.UpdateDataDirectory == b.UpdateDataDirectory && 1061 a.FullyParsed == b.FullyParsed && 1062 EqualsTableIdent(a.DBName, b.DBName) && 1063 EqualsSliceOfCollateAndCharset(a.AlterOptions, b.AlterOptions) 1064 } 1065 1066 // EqualsRefOfAlterMigration does deep equals between the two objects. 1067 func EqualsRefOfAlterMigration(a, b *AlterMigration) bool { 1068 if a == b { 1069 return true 1070 } 1071 if a == nil || b == nil { 1072 return false 1073 } 1074 return a.UUID == b.UUID && 1075 a.Type == b.Type 1076 } 1077 1078 // EqualsRefOfAlterTable does deep equals between the two objects. 1079 func EqualsRefOfAlterTable(a, b *AlterTable) bool { 1080 if a == b { 1081 return true 1082 } 1083 if a == nil || b == nil { 1084 return false 1085 } 1086 return a.FullyParsed == b.FullyParsed && 1087 EqualsTableName(a.Table, b.Table) && 1088 EqualsSliceOfAlterOption(a.AlterOptions, b.AlterOptions) && 1089 EqualsRefOfPartitionSpec(a.PartitionSpec, b.PartitionSpec) && 1090 EqualsComments(a.Comments, b.Comments) 1091 } 1092 1093 // EqualsRefOfAlterView does deep equals between the two objects. 1094 func EqualsRefOfAlterView(a, b *AlterView) bool { 1095 if a == b { 1096 return true 1097 } 1098 if a == nil || b == nil { 1099 return false 1100 } 1101 return a.Algorithm == b.Algorithm && 1102 a.Definer == b.Definer && 1103 a.Security == b.Security && 1104 a.CheckOption == b.CheckOption && 1105 EqualsTableName(a.ViewName, b.ViewName) && 1106 EqualsColumns(a.Columns, b.Columns) && 1107 EqualsSelectStatement(a.Select, b.Select) 1108 } 1109 1110 // EqualsRefOfAlterVschema does deep equals between the two objects. 1111 func EqualsRefOfAlterVschema(a, b *AlterVschema) bool { 1112 if a == b { 1113 return true 1114 } 1115 if a == nil || b == nil { 1116 return false 1117 } 1118 return a.Action == b.Action && 1119 EqualsTableName(a.Table, b.Table) && 1120 EqualsRefOfVindexSpec(a.VindexSpec, b.VindexSpec) && 1121 EqualsSliceOfColIdent(a.VindexCols, b.VindexCols) && 1122 EqualsRefOfAutoIncSpec(a.AutoIncSpec, b.AutoIncSpec) 1123 } 1124 1125 // EqualsRefOfAndExpr does deep equals between the two objects. 1126 func EqualsRefOfAndExpr(a, b *AndExpr) bool { 1127 if a == b { 1128 return true 1129 } 1130 if a == nil || b == nil { 1131 return false 1132 } 1133 return EqualsExpr(a.Left, b.Left) && 1134 EqualsExpr(a.Right, b.Right) 1135 } 1136 1137 // EqualsRefOfAutoIncSpec does deep equals between the two objects. 1138 func EqualsRefOfAutoIncSpec(a, b *AutoIncSpec) bool { 1139 if a == b { 1140 return true 1141 } 1142 if a == nil || b == nil { 1143 return false 1144 } 1145 return EqualsColIdent(a.Column, b.Column) && 1146 EqualsTableName(a.Sequence, b.Sequence) 1147 } 1148 1149 // EqualsRefOfBegin does deep equals between the two objects. 1150 func EqualsRefOfBegin(a, b *Begin) bool { 1151 if a == b { 1152 return true 1153 } 1154 if a == nil || b == nil { 1155 return false 1156 } 1157 return true 1158 } 1159 1160 // EqualsRefOfBetweenExpr does deep equals between the two objects. 1161 func EqualsRefOfBetweenExpr(a, b *BetweenExpr) bool { 1162 if a == b { 1163 return true 1164 } 1165 if a == nil || b == nil { 1166 return false 1167 } 1168 return a.IsBetween == b.IsBetween && 1169 EqualsExpr(a.Left, b.Left) && 1170 EqualsExpr(a.From, b.From) && 1171 EqualsExpr(a.To, b.To) 1172 } 1173 1174 // EqualsRefOfBinaryExpr does deep equals between the two objects. 1175 func EqualsRefOfBinaryExpr(a, b *BinaryExpr) bool { 1176 if a == b { 1177 return true 1178 } 1179 if a == nil || b == nil { 1180 return false 1181 } 1182 return a.Operator == b.Operator && 1183 EqualsExpr(a.Left, b.Left) && 1184 EqualsExpr(a.Right, b.Right) 1185 } 1186 1187 // EqualsRefOfCallProc does deep equals between the two objects. 1188 func EqualsRefOfCallProc(a, b *CallProc) bool { 1189 if a == b { 1190 return true 1191 } 1192 if a == nil || b == nil { 1193 return false 1194 } 1195 return EqualsTableName(a.Name, b.Name) && 1196 EqualsExprs(a.Params, b.Params) 1197 } 1198 1199 // EqualsRefOfCaseExpr does deep equals between the two objects. 1200 func EqualsRefOfCaseExpr(a, b *CaseExpr) bool { 1201 if a == b { 1202 return true 1203 } 1204 if a == nil || b == nil { 1205 return false 1206 } 1207 return EqualsExpr(a.Expr, b.Expr) && 1208 EqualsSliceOfRefOfWhen(a.Whens, b.Whens) && 1209 EqualsExpr(a.Else, b.Else) 1210 } 1211 1212 // EqualsRefOfChangeColumn does deep equals between the two objects. 1213 func EqualsRefOfChangeColumn(a, b *ChangeColumn) bool { 1214 if a == b { 1215 return true 1216 } 1217 if a == nil || b == nil { 1218 return false 1219 } 1220 return a.First == b.First && 1221 EqualsRefOfColName(a.OldColumn, b.OldColumn) && 1222 EqualsRefOfColumnDefinition(a.NewColDefinition, b.NewColDefinition) && 1223 EqualsRefOfColName(a.After, b.After) 1224 } 1225 1226 // EqualsRefOfCheckConstraintDefinition does deep equals between the two objects. 1227 func EqualsRefOfCheckConstraintDefinition(a, b *CheckConstraintDefinition) bool { 1228 if a == b { 1229 return true 1230 } 1231 if a == nil || b == nil { 1232 return false 1233 } 1234 return a.Enforced == b.Enforced && 1235 EqualsExpr(a.Expr, b.Expr) 1236 } 1237 1238 // EqualsColIdent does deep equals between the two objects. 1239 func EqualsColIdent(a, b ColIdent) bool { 1240 return a.val == b.val && 1241 a.lowered == b.lowered && 1242 a.at == b.at 1243 } 1244 1245 // EqualsRefOfColName does deep equals between the two objects. 1246 func EqualsRefOfColName(a, b *ColName) bool { 1247 if a == b { 1248 return true 1249 } 1250 if a == nil || b == nil { 1251 return false 1252 } 1253 return EqualsColIdent(a.Name, b.Name) && 1254 EqualsTableName(a.Qualifier, b.Qualifier) 1255 } 1256 1257 // EqualsRefOfCollateExpr does deep equals between the two objects. 1258 func EqualsRefOfCollateExpr(a, b *CollateExpr) bool { 1259 if a == b { 1260 return true 1261 } 1262 if a == nil || b == nil { 1263 return false 1264 } 1265 return a.Collation == b.Collation && 1266 EqualsExpr(a.Expr, b.Expr) 1267 } 1268 1269 // EqualsRefOfColumnDefinition does deep equals between the two objects. 1270 func EqualsRefOfColumnDefinition(a, b *ColumnDefinition) bool { 1271 if a == b { 1272 return true 1273 } 1274 if a == nil || b == nil { 1275 return false 1276 } 1277 return EqualsColIdent(a.Name, b.Name) && 1278 EqualsColumnType(a.Type, b.Type) 1279 } 1280 1281 // EqualsRefOfColumnType does deep equals between the two objects. 1282 func EqualsRefOfColumnType(a, b *ColumnType) bool { 1283 if a == b { 1284 return true 1285 } 1286 if a == nil || b == nil { 1287 return false 1288 } 1289 return a.Type == b.Type && 1290 a.Unsigned == b.Unsigned && 1291 a.Zerofill == b.Zerofill && 1292 a.Charset == b.Charset && 1293 EqualsRefOfColumnTypeOptions(a.Options, b.Options) && 1294 EqualsRefOfLiteral(a.Length, b.Length) && 1295 EqualsRefOfLiteral(a.Scale, b.Scale) && 1296 EqualsSliceOfString(a.EnumValues, b.EnumValues) 1297 } 1298 1299 // EqualsColumns does deep equals between the two objects. 1300 func EqualsColumns(a, b Columns) bool { 1301 if len(a) != len(b) { 1302 return false 1303 } 1304 for i := 0; i < len(a); i++ { 1305 if !EqualsColIdent(a[i], b[i]) { 1306 return false 1307 } 1308 } 1309 return true 1310 } 1311 1312 // EqualsComments does deep equals between the two objects. 1313 func EqualsComments(a, b Comments) bool { 1314 if len(a) != len(b) { 1315 return false 1316 } 1317 for i := 0; i < len(a); i++ { 1318 if a[i] != b[i] { 1319 return false 1320 } 1321 } 1322 return true 1323 } 1324 1325 // EqualsRefOfCommit does deep equals between the two objects. 1326 func EqualsRefOfCommit(a, b *Commit) bool { 1327 if a == b { 1328 return true 1329 } 1330 if a == nil || b == nil { 1331 return false 1332 } 1333 return true 1334 } 1335 1336 // EqualsRefOfCommonTableExpr does deep equals between the two objects. 1337 func EqualsRefOfCommonTableExpr(a, b *CommonTableExpr) bool { 1338 if a == b { 1339 return true 1340 } 1341 if a == nil || b == nil { 1342 return false 1343 } 1344 return EqualsTableIdent(a.TableID, b.TableID) && 1345 EqualsColumns(a.Columns, b.Columns) && 1346 EqualsRefOfSubquery(a.Subquery, b.Subquery) 1347 } 1348 1349 // EqualsRefOfComparisonExpr does deep equals between the two objects. 1350 func EqualsRefOfComparisonExpr(a, b *ComparisonExpr) bool { 1351 if a == b { 1352 return true 1353 } 1354 if a == nil || b == nil { 1355 return false 1356 } 1357 return a.Operator == b.Operator && 1358 EqualsExpr(a.Left, b.Left) && 1359 EqualsExpr(a.Right, b.Right) && 1360 EqualsExpr(a.Escape, b.Escape) 1361 } 1362 1363 // EqualsRefOfConstraintDefinition does deep equals between the two objects. 1364 func EqualsRefOfConstraintDefinition(a, b *ConstraintDefinition) bool { 1365 if a == b { 1366 return true 1367 } 1368 if a == nil || b == nil { 1369 return false 1370 } 1371 return EqualsColIdent(a.Name, b.Name) && 1372 EqualsConstraintInfo(a.Details, b.Details) 1373 } 1374 1375 // EqualsRefOfConvertExpr does deep equals between the two objects. 1376 func EqualsRefOfConvertExpr(a, b *ConvertExpr) bool { 1377 if a == b { 1378 return true 1379 } 1380 if a == nil || b == nil { 1381 return false 1382 } 1383 return EqualsExpr(a.Expr, b.Expr) && 1384 EqualsRefOfConvertType(a.Type, b.Type) 1385 } 1386 1387 // EqualsRefOfConvertType does deep equals between the two objects. 1388 func EqualsRefOfConvertType(a, b *ConvertType) bool { 1389 if a == b { 1390 return true 1391 } 1392 if a == nil || b == nil { 1393 return false 1394 } 1395 return a.Type == b.Type && 1396 a.Charset == b.Charset && 1397 EqualsRefOfLiteral(a.Length, b.Length) && 1398 EqualsRefOfLiteral(a.Scale, b.Scale) && 1399 a.Operator == b.Operator 1400 } 1401 1402 // EqualsRefOfConvertUsingExpr does deep equals between the two objects. 1403 func EqualsRefOfConvertUsingExpr(a, b *ConvertUsingExpr) bool { 1404 if a == b { 1405 return true 1406 } 1407 if a == nil || b == nil { 1408 return false 1409 } 1410 return a.Type == b.Type && 1411 EqualsExpr(a.Expr, b.Expr) 1412 } 1413 1414 // EqualsRefOfCreateDatabase does deep equals between the two objects. 1415 func EqualsRefOfCreateDatabase(a, b *CreateDatabase) bool { 1416 if a == b { 1417 return true 1418 } 1419 if a == nil || b == nil { 1420 return false 1421 } 1422 return a.IfNotExists == b.IfNotExists && 1423 a.FullyParsed == b.FullyParsed && 1424 EqualsComments(a.Comments, b.Comments) && 1425 EqualsTableIdent(a.DBName, b.DBName) && 1426 EqualsSliceOfCollateAndCharset(a.CreateOptions, b.CreateOptions) 1427 } 1428 1429 // EqualsRefOfCreateTable does deep equals between the two objects. 1430 func EqualsRefOfCreateTable(a, b *CreateTable) bool { 1431 if a == b { 1432 return true 1433 } 1434 if a == nil || b == nil { 1435 return false 1436 } 1437 return a.Temp == b.Temp && 1438 a.IfNotExists == b.IfNotExists && 1439 a.FullyParsed == b.FullyParsed && 1440 EqualsTableName(a.Table, b.Table) && 1441 EqualsRefOfTableSpec(a.TableSpec, b.TableSpec) && 1442 EqualsRefOfOptLike(a.OptLike, b.OptLike) && 1443 EqualsComments(a.Comments, b.Comments) 1444 } 1445 1446 // EqualsRefOfCreateView does deep equals between the two objects. 1447 func EqualsRefOfCreateView(a, b *CreateView) bool { 1448 if a == b { 1449 return true 1450 } 1451 if a == nil || b == nil { 1452 return false 1453 } 1454 return a.Algorithm == b.Algorithm && 1455 a.Definer == b.Definer && 1456 a.Security == b.Security && 1457 a.CheckOption == b.CheckOption && 1458 a.IsReplace == b.IsReplace && 1459 EqualsTableName(a.ViewName, b.ViewName) && 1460 EqualsColumns(a.Columns, b.Columns) && 1461 EqualsSelectStatement(a.Select, b.Select) 1462 } 1463 1464 // EqualsRefOfCurTimeFuncExpr does deep equals between the two objects. 1465 func EqualsRefOfCurTimeFuncExpr(a, b *CurTimeFuncExpr) bool { 1466 if a == b { 1467 return true 1468 } 1469 if a == nil || b == nil { 1470 return false 1471 } 1472 return EqualsColIdent(a.Name, b.Name) && 1473 EqualsExpr(a.Fsp, b.Fsp) 1474 } 1475 1476 // EqualsRefOfDefault does deep equals between the two objects. 1477 func EqualsRefOfDefault(a, b *Default) bool { 1478 if a == b { 1479 return true 1480 } 1481 if a == nil || b == nil { 1482 return false 1483 } 1484 return a.ColName == b.ColName 1485 } 1486 1487 // EqualsRefOfDelete does deep equals between the two objects. 1488 func EqualsRefOfDelete(a, b *Delete) bool { 1489 if a == b { 1490 return true 1491 } 1492 if a == nil || b == nil { 1493 return false 1494 } 1495 return EqualsRefOfWith(a.With, b.With) && 1496 a.Ignore == b.Ignore && 1497 EqualsComments(a.Comments, b.Comments) && 1498 EqualsTableNames(a.Targets, b.Targets) && 1499 EqualsTableExprs(a.TableExprs, b.TableExprs) && 1500 EqualsPartitions(a.Partitions, b.Partitions) && 1501 EqualsRefOfWhere(a.Where, b.Where) && 1502 EqualsOrderBy(a.OrderBy, b.OrderBy) && 1503 EqualsRefOfLimit(a.Limit, b.Limit) 1504 } 1505 1506 // EqualsRefOfDerivedTable does deep equals between the two objects. 1507 func EqualsRefOfDerivedTable(a, b *DerivedTable) bool { 1508 if a == b { 1509 return true 1510 } 1511 if a == nil || b == nil { 1512 return false 1513 } 1514 return EqualsSelectStatement(a.Select, b.Select) 1515 } 1516 1517 // EqualsRefOfDropColumn does deep equals between the two objects. 1518 func EqualsRefOfDropColumn(a, b *DropColumn) bool { 1519 if a == b { 1520 return true 1521 } 1522 if a == nil || b == nil { 1523 return false 1524 } 1525 return EqualsRefOfColName(a.Name, b.Name) 1526 } 1527 1528 // EqualsRefOfDropDatabase does deep equals between the two objects. 1529 func EqualsRefOfDropDatabase(a, b *DropDatabase) bool { 1530 if a == b { 1531 return true 1532 } 1533 if a == nil || b == nil { 1534 return false 1535 } 1536 return a.IfExists == b.IfExists && 1537 EqualsComments(a.Comments, b.Comments) && 1538 EqualsTableIdent(a.DBName, b.DBName) 1539 } 1540 1541 // EqualsRefOfDropKey does deep equals between the two objects. 1542 func EqualsRefOfDropKey(a, b *DropKey) bool { 1543 if a == b { 1544 return true 1545 } 1546 if a == nil || b == nil { 1547 return false 1548 } 1549 return a.Type == b.Type && 1550 EqualsColIdent(a.Name, b.Name) 1551 } 1552 1553 // EqualsRefOfDropTable does deep equals between the two objects. 1554 func EqualsRefOfDropTable(a, b *DropTable) bool { 1555 if a == b { 1556 return true 1557 } 1558 if a == nil || b == nil { 1559 return false 1560 } 1561 return a.Temp == b.Temp && 1562 a.IfExists == b.IfExists && 1563 EqualsTableNames(a.FromTables, b.FromTables) && 1564 EqualsComments(a.Comments, b.Comments) 1565 } 1566 1567 // EqualsRefOfDropView does deep equals between the two objects. 1568 func EqualsRefOfDropView(a, b *DropView) bool { 1569 if a == b { 1570 return true 1571 } 1572 if a == nil || b == nil { 1573 return false 1574 } 1575 return a.IfExists == b.IfExists && 1576 EqualsTableNames(a.FromTables, b.FromTables) 1577 } 1578 1579 // EqualsRefOfExistsExpr does deep equals between the two objects. 1580 func EqualsRefOfExistsExpr(a, b *ExistsExpr) bool { 1581 if a == b { 1582 return true 1583 } 1584 if a == nil || b == nil { 1585 return false 1586 } 1587 return EqualsRefOfSubquery(a.Subquery, b.Subquery) 1588 } 1589 1590 // EqualsRefOfExplainStmt does deep equals between the two objects. 1591 func EqualsRefOfExplainStmt(a, b *ExplainStmt) bool { 1592 if a == b { 1593 return true 1594 } 1595 if a == nil || b == nil { 1596 return false 1597 } 1598 return a.Type == b.Type && 1599 EqualsStatement(a.Statement, b.Statement) 1600 } 1601 1602 // EqualsRefOfExplainTab does deep equals between the two objects. 1603 func EqualsRefOfExplainTab(a, b *ExplainTab) bool { 1604 if a == b { 1605 return true 1606 } 1607 if a == nil || b == nil { 1608 return false 1609 } 1610 return a.Wild == b.Wild && 1611 EqualsTableName(a.Table, b.Table) 1612 } 1613 1614 // EqualsRefOfExprOrColumns does deep equals between the two objects. 1615 func EqualsRefOfExprOrColumns(a, b *ExprOrColumns) bool { 1616 if a == b { 1617 return true 1618 } 1619 if a == nil || b == nil { 1620 return false 1621 } 1622 return EqualsExpr(a.Expr, b.Expr) && 1623 EqualsColumns(a.ColumnList, b.ColumnList) 1624 } 1625 1626 // EqualsExprs does deep equals between the two objects. 1627 func EqualsExprs(a, b Exprs) bool { 1628 if len(a) != len(b) { 1629 return false 1630 } 1631 for i := 0; i < len(a); i++ { 1632 if !EqualsExpr(a[i], b[i]) { 1633 return false 1634 } 1635 } 1636 return true 1637 } 1638 1639 // EqualsRefOfExtractFuncExpr does deep equals between the two objects. 1640 func EqualsRefOfExtractFuncExpr(a, b *ExtractFuncExpr) bool { 1641 if a == b { 1642 return true 1643 } 1644 if a == nil || b == nil { 1645 return false 1646 } 1647 return a.IntervalTypes == b.IntervalTypes && 1648 EqualsExpr(a.Expr, b.Expr) 1649 } 1650 1651 // EqualsRefOfExtractedSubquery does deep equals between the two objects. 1652 func EqualsRefOfExtractedSubquery(a, b *ExtractedSubquery) bool { 1653 if a == b { 1654 return true 1655 } 1656 if a == nil || b == nil { 1657 return false 1658 } 1659 return a.OpCode == b.OpCode && 1660 a.NeedsRewrite == b.NeedsRewrite && 1661 a.hasValuesArg == b.hasValuesArg && 1662 a.argName == b.argName && 1663 EqualsExpr(a.Original, b.Original) && 1664 EqualsRefOfSubquery(a.Subquery, b.Subquery) && 1665 EqualsExpr(a.OtherSide, b.OtherSide) && 1666 EqualsExpr(a.alternative, b.alternative) 1667 } 1668 1669 // EqualsRefOfFlush does deep equals between the two objects. 1670 func EqualsRefOfFlush(a, b *Flush) bool { 1671 if a == b { 1672 return true 1673 } 1674 if a == nil || b == nil { 1675 return false 1676 } 1677 return a.IsLocal == b.IsLocal && 1678 a.WithLock == b.WithLock && 1679 a.ForExport == b.ForExport && 1680 EqualsSliceOfString(a.FlushOptions, b.FlushOptions) && 1681 EqualsTableNames(a.TableNames, b.TableNames) 1682 } 1683 1684 // EqualsRefOfForce does deep equals between the two objects. 1685 func EqualsRefOfForce(a, b *Force) bool { 1686 if a == b { 1687 return true 1688 } 1689 if a == nil || b == nil { 1690 return false 1691 } 1692 return true 1693 } 1694 1695 // EqualsRefOfForeignKeyDefinition does deep equals between the two objects. 1696 func EqualsRefOfForeignKeyDefinition(a, b *ForeignKeyDefinition) bool { 1697 if a == b { 1698 return true 1699 } 1700 if a == nil || b == nil { 1701 return false 1702 } 1703 return EqualsColumns(a.Source, b.Source) && 1704 EqualsColIdent(a.IndexName, b.IndexName) && 1705 EqualsRefOfReferenceDefinition(a.ReferenceDefinition, b.ReferenceDefinition) 1706 } 1707 1708 // EqualsRefOfFuncExpr does deep equals between the two objects. 1709 func EqualsRefOfFuncExpr(a, b *FuncExpr) bool { 1710 if a == b { 1711 return true 1712 } 1713 if a == nil || b == nil { 1714 return false 1715 } 1716 return a.Distinct == b.Distinct && 1717 EqualsTableIdent(a.Qualifier, b.Qualifier) && 1718 EqualsColIdent(a.Name, b.Name) && 1719 EqualsSelectExprs(a.Exprs, b.Exprs) 1720 } 1721 1722 // EqualsGroupBy does deep equals between the two objects. 1723 func EqualsGroupBy(a, b GroupBy) bool { 1724 if len(a) != len(b) { 1725 return false 1726 } 1727 for i := 0; i < len(a); i++ { 1728 if !EqualsExpr(a[i], b[i]) { 1729 return false 1730 } 1731 } 1732 return true 1733 } 1734 1735 // EqualsRefOfGroupConcatExpr does deep equals between the two objects. 1736 func EqualsRefOfGroupConcatExpr(a, b *GroupConcatExpr) bool { 1737 if a == b { 1738 return true 1739 } 1740 if a == nil || b == nil { 1741 return false 1742 } 1743 return a.Distinct == b.Distinct && 1744 a.Separator == b.Separator && 1745 EqualsSelectExprs(a.Exprs, b.Exprs) && 1746 EqualsOrderBy(a.OrderBy, b.OrderBy) && 1747 EqualsRefOfLimit(a.Limit, b.Limit) 1748 } 1749 1750 // EqualsRefOfIndexDefinition does deep equals between the two objects. 1751 func EqualsRefOfIndexDefinition(a, b *IndexDefinition) bool { 1752 if a == b { 1753 return true 1754 } 1755 if a == nil || b == nil { 1756 return false 1757 } 1758 return EqualsRefOfIndexInfo(a.Info, b.Info) && 1759 EqualsSliceOfRefOfIndexColumn(a.Columns, b.Columns) && 1760 EqualsSliceOfRefOfIndexOption(a.Options, b.Options) 1761 } 1762 1763 // EqualsRefOfIndexHints does deep equals between the two objects. 1764 func EqualsRefOfIndexHints(a, b *IndexHints) bool { 1765 if a == b { 1766 return true 1767 } 1768 if a == nil || b == nil { 1769 return false 1770 } 1771 return a.Type == b.Type && 1772 EqualsSliceOfColIdent(a.Indexes, b.Indexes) 1773 } 1774 1775 // EqualsRefOfIndexInfo does deep equals between the two objects. 1776 func EqualsRefOfIndexInfo(a, b *IndexInfo) bool { 1777 if a == b { 1778 return true 1779 } 1780 if a == nil || b == nil { 1781 return false 1782 } 1783 return a.Type == b.Type && 1784 a.Primary == b.Primary && 1785 a.Spatial == b.Spatial && 1786 a.Fulltext == b.Fulltext && 1787 a.Unique == b.Unique && 1788 EqualsColIdent(a.Name, b.Name) && 1789 EqualsColIdent(a.ConstraintName, b.ConstraintName) 1790 } 1791 1792 // EqualsRefOfInsert does deep equals between the two objects. 1793 func EqualsRefOfInsert(a, b *Insert) bool { 1794 if a == b { 1795 return true 1796 } 1797 if a == nil || b == nil { 1798 return false 1799 } 1800 return a.Action == b.Action && 1801 EqualsComments(a.Comments, b.Comments) && 1802 a.Ignore == b.Ignore && 1803 EqualsTableName(a.Table, b.Table) && 1804 EqualsPartitions(a.Partitions, b.Partitions) && 1805 EqualsColumns(a.Columns, b.Columns) && 1806 EqualsInsertRows(a.Rows, b.Rows) && 1807 EqualsOnDup(a.OnDup, b.OnDup) 1808 } 1809 1810 // EqualsRefOfIntervalExpr does deep equals between the two objects. 1811 func EqualsRefOfIntervalExpr(a, b *IntervalExpr) bool { 1812 if a == b { 1813 return true 1814 } 1815 if a == nil || b == nil { 1816 return false 1817 } 1818 return a.Unit == b.Unit && 1819 EqualsExpr(a.Expr, b.Expr) 1820 } 1821 1822 // EqualsRefOfIntroducerExpr does deep equals between the two objects. 1823 func EqualsRefOfIntroducerExpr(a, b *IntroducerExpr) bool { 1824 if a == b { 1825 return true 1826 } 1827 if a == nil || b == nil { 1828 return false 1829 } 1830 return a.CharacterSet == b.CharacterSet && 1831 EqualsExpr(a.Expr, b.Expr) 1832 } 1833 1834 // EqualsRefOfIsExpr does deep equals between the two objects. 1835 func EqualsRefOfIsExpr(a, b *IsExpr) bool { 1836 if a == b { 1837 return true 1838 } 1839 if a == nil || b == nil { 1840 return false 1841 } 1842 return EqualsExpr(a.Left, b.Left) && 1843 a.Right == b.Right 1844 } 1845 1846 // EqualsRefOfJoinCondition does deep equals between the two objects. 1847 func EqualsRefOfJoinCondition(a, b *JoinCondition) bool { 1848 if a == b { 1849 return true 1850 } 1851 if a == nil || b == nil { 1852 return false 1853 } 1854 return EqualsExpr(a.On, b.On) && 1855 EqualsColumns(a.Using, b.Using) 1856 } 1857 1858 // EqualsRefOfJoinTableExpr does deep equals between the two objects. 1859 func EqualsRefOfJoinTableExpr(a, b *JoinTableExpr) bool { 1860 if a == b { 1861 return true 1862 } 1863 if a == nil || b == nil { 1864 return false 1865 } 1866 return EqualsTableExpr(a.LeftExpr, b.LeftExpr) && 1867 a.Join == b.Join && 1868 EqualsTableExpr(a.RightExpr, b.RightExpr) && 1869 EqualsRefOfJoinCondition(a.Condition, b.Condition) 1870 } 1871 1872 // EqualsRefOfKeyState does deep equals between the two objects. 1873 func EqualsRefOfKeyState(a, b *KeyState) bool { 1874 if a == b { 1875 return true 1876 } 1877 if a == nil || b == nil { 1878 return false 1879 } 1880 return a.Enable == b.Enable 1881 } 1882 1883 // EqualsRefOfLimit does deep equals between the two objects. 1884 func EqualsRefOfLimit(a, b *Limit) bool { 1885 if a == b { 1886 return true 1887 } 1888 if a == nil || b == nil { 1889 return false 1890 } 1891 return EqualsExpr(a.Offset, b.Offset) && 1892 EqualsExpr(a.Rowcount, b.Rowcount) 1893 } 1894 1895 // EqualsRefOfLiteral does deep equals between the two objects. 1896 func EqualsRefOfLiteral(a, b *Literal) bool { 1897 if a == b { 1898 return true 1899 } 1900 if a == nil || b == nil { 1901 return false 1902 } 1903 return a.Val == b.Val && 1904 a.Type == b.Type 1905 } 1906 1907 // EqualsRefOfLoad does deep equals between the two objects. 1908 func EqualsRefOfLoad(a, b *Load) bool { 1909 if a == b { 1910 return true 1911 } 1912 if a == nil || b == nil { 1913 return false 1914 } 1915 return true 1916 } 1917 1918 // EqualsRefOfLockOption does deep equals between the two objects. 1919 func EqualsRefOfLockOption(a, b *LockOption) bool { 1920 if a == b { 1921 return true 1922 } 1923 if a == nil || b == nil { 1924 return false 1925 } 1926 return a.Type == b.Type 1927 } 1928 1929 // EqualsRefOfLockTables does deep equals between the two objects. 1930 func EqualsRefOfLockTables(a, b *LockTables) bool { 1931 if a == b { 1932 return true 1933 } 1934 if a == nil || b == nil { 1935 return false 1936 } 1937 return EqualsTableAndLockTypes(a.Tables, b.Tables) 1938 } 1939 1940 // EqualsRefOfMatchExpr does deep equals between the two objects. 1941 func EqualsRefOfMatchExpr(a, b *MatchExpr) bool { 1942 if a == b { 1943 return true 1944 } 1945 if a == nil || b == nil { 1946 return false 1947 } 1948 return EqualsSelectExprs(a.Columns, b.Columns) && 1949 EqualsExpr(a.Expr, b.Expr) && 1950 a.Option == b.Option 1951 } 1952 1953 // EqualsRefOfModifyColumn does deep equals between the two objects. 1954 func EqualsRefOfModifyColumn(a, b *ModifyColumn) bool { 1955 if a == b { 1956 return true 1957 } 1958 if a == nil || b == nil { 1959 return false 1960 } 1961 return a.First == b.First && 1962 EqualsRefOfColumnDefinition(a.NewColDefinition, b.NewColDefinition) && 1963 EqualsRefOfColName(a.After, b.After) 1964 } 1965 1966 // EqualsRefOfNextval does deep equals between the two objects. 1967 func EqualsRefOfNextval(a, b *Nextval) bool { 1968 if a == b { 1969 return true 1970 } 1971 if a == nil || b == nil { 1972 return false 1973 } 1974 return EqualsExpr(a.Expr, b.Expr) 1975 } 1976 1977 // EqualsRefOfNotExpr does deep equals between the two objects. 1978 func EqualsRefOfNotExpr(a, b *NotExpr) bool { 1979 if a == b { 1980 return true 1981 } 1982 if a == nil || b == nil { 1983 return false 1984 } 1985 return EqualsExpr(a.Expr, b.Expr) 1986 } 1987 1988 // EqualsRefOfNullVal does deep equals between the two objects. 1989 func EqualsRefOfNullVal(a, b *NullVal) bool { 1990 if a == b { 1991 return true 1992 } 1993 if a == nil || b == nil { 1994 return false 1995 } 1996 return true 1997 } 1998 1999 // EqualsOnDup does deep equals between the two objects. 2000 func EqualsOnDup(a, b OnDup) bool { 2001 if len(a) != len(b) { 2002 return false 2003 } 2004 for i := 0; i < len(a); i++ { 2005 if !EqualsRefOfUpdateExpr(a[i], b[i]) { 2006 return false 2007 } 2008 } 2009 return true 2010 } 2011 2012 // EqualsRefOfOptLike does deep equals between the two objects. 2013 func EqualsRefOfOptLike(a, b *OptLike) bool { 2014 if a == b { 2015 return true 2016 } 2017 if a == nil || b == nil { 2018 return false 2019 } 2020 return EqualsTableName(a.LikeTable, b.LikeTable) 2021 } 2022 2023 // EqualsRefOfOrExpr does deep equals between the two objects. 2024 func EqualsRefOfOrExpr(a, b *OrExpr) bool { 2025 if a == b { 2026 return true 2027 } 2028 if a == nil || b == nil { 2029 return false 2030 } 2031 return EqualsExpr(a.Left, b.Left) && 2032 EqualsExpr(a.Right, b.Right) 2033 } 2034 2035 // EqualsRefOfOrder does deep equals between the two objects. 2036 func EqualsRefOfOrder(a, b *Order) bool { 2037 if a == b { 2038 return true 2039 } 2040 if a == nil || b == nil { 2041 return false 2042 } 2043 return EqualsExpr(a.Expr, b.Expr) && 2044 a.Direction == b.Direction 2045 } 2046 2047 // EqualsOrderBy does deep equals between the two objects. 2048 func EqualsOrderBy(a, b OrderBy) bool { 2049 if len(a) != len(b) { 2050 return false 2051 } 2052 for i := 0; i < len(a); i++ { 2053 if !EqualsRefOfOrder(a[i], b[i]) { 2054 return false 2055 } 2056 } 2057 return true 2058 } 2059 2060 // EqualsRefOfOrderByOption does deep equals between the two objects. 2061 func EqualsRefOfOrderByOption(a, b *OrderByOption) bool { 2062 if a == b { 2063 return true 2064 } 2065 if a == nil || b == nil { 2066 return false 2067 } 2068 return EqualsColumns(a.Cols, b.Cols) 2069 } 2070 2071 // EqualsRefOfOtherAdmin does deep equals between the two objects. 2072 func EqualsRefOfOtherAdmin(a, b *OtherAdmin) bool { 2073 if a == b { 2074 return true 2075 } 2076 if a == nil || b == nil { 2077 return false 2078 } 2079 return true 2080 } 2081 2082 // EqualsRefOfOtherRead does deep equals between the two objects. 2083 func EqualsRefOfOtherRead(a, b *OtherRead) bool { 2084 if a == b { 2085 return true 2086 } 2087 if a == nil || b == nil { 2088 return false 2089 } 2090 return true 2091 } 2092 2093 // EqualsRefOfParenTableExpr does deep equals between the two objects. 2094 func EqualsRefOfParenTableExpr(a, b *ParenTableExpr) bool { 2095 if a == b { 2096 return true 2097 } 2098 if a == nil || b == nil { 2099 return false 2100 } 2101 return EqualsTableExprs(a.Exprs, b.Exprs) 2102 } 2103 2104 // EqualsRefOfPartitionDefinition does deep equals between the two objects. 2105 func EqualsRefOfPartitionDefinition(a, b *PartitionDefinition) bool { 2106 if a == b { 2107 return true 2108 } 2109 if a == nil || b == nil { 2110 return false 2111 } 2112 return a.Maxvalue == b.Maxvalue && 2113 EqualsColIdent(a.Name, b.Name) && 2114 EqualsExpr(a.Limit, b.Limit) 2115 } 2116 2117 // EqualsRefOfPartitionOption does deep equals between the two objects. 2118 func EqualsRefOfPartitionOption(a, b *PartitionOption) bool { 2119 if a == b { 2120 return true 2121 } 2122 if a == nil || b == nil { 2123 return false 2124 } 2125 return a.Linear == b.Linear && 2126 a.isHASH == b.isHASH && 2127 a.isKEY == b.isKEY && 2128 a.KeyAlgorithm == b.KeyAlgorithm && 2129 a.RangeOrList == b.RangeOrList && 2130 a.Partitions == b.Partitions && 2131 EqualsColumns(a.KeyColList, b.KeyColList) && 2132 EqualsRefOfExprOrColumns(a.ExprOrCol, b.ExprOrCol) && 2133 EqualsExpr(a.Expr, b.Expr) && 2134 EqualsRefOfSubPartition(a.SubPartition, b.SubPartition) && 2135 EqualsSliceOfRefOfPartitionDefinition(a.Definitions, b.Definitions) 2136 } 2137 2138 // EqualsRefOfPartitionSpec does deep equals between the two objects. 2139 func EqualsRefOfPartitionSpec(a, b *PartitionSpec) bool { 2140 if a == b { 2141 return true 2142 } 2143 if a == nil || b == nil { 2144 return false 2145 } 2146 return a.IsAll == b.IsAll && 2147 a.WithoutValidation == b.WithoutValidation && 2148 a.Action == b.Action && 2149 EqualsPartitions(a.Names, b.Names) && 2150 EqualsRefOfLiteral(a.Number, b.Number) && 2151 EqualsTableName(a.TableName, b.TableName) && 2152 EqualsSliceOfRefOfPartitionDefinition(a.Definitions, b.Definitions) 2153 } 2154 2155 // EqualsPartitions does deep equals between the two objects. 2156 func EqualsPartitions(a, b Partitions) bool { 2157 if len(a) != len(b) { 2158 return false 2159 } 2160 for i := 0; i < len(a); i++ { 2161 if !EqualsColIdent(a[i], b[i]) { 2162 return false 2163 } 2164 } 2165 return true 2166 } 2167 2168 // EqualsRefOfReferenceDefinition does deep equals between the two objects. 2169 func EqualsRefOfReferenceDefinition(a, b *ReferenceDefinition) bool { 2170 if a == b { 2171 return true 2172 } 2173 if a == nil || b == nil { 2174 return false 2175 } 2176 return EqualsTableName(a.ReferencedTable, b.ReferencedTable) && 2177 EqualsColumns(a.ReferencedColumns, b.ReferencedColumns) && 2178 a.OnDelete == b.OnDelete && 2179 a.OnUpdate == b.OnUpdate 2180 } 2181 2182 // EqualsRefOfRelease does deep equals between the two objects. 2183 func EqualsRefOfRelease(a, b *Release) bool { 2184 if a == b { 2185 return true 2186 } 2187 if a == nil || b == nil { 2188 return false 2189 } 2190 return EqualsColIdent(a.Name, b.Name) 2191 } 2192 2193 // EqualsRefOfRenameIndex does deep equals between the two objects. 2194 func EqualsRefOfRenameIndex(a, b *RenameIndex) bool { 2195 if a == b { 2196 return true 2197 } 2198 if a == nil || b == nil { 2199 return false 2200 } 2201 return EqualsColIdent(a.OldName, b.OldName) && 2202 EqualsColIdent(a.NewName, b.NewName) 2203 } 2204 2205 // EqualsRefOfRenameTable does deep equals between the two objects. 2206 func EqualsRefOfRenameTable(a, b *RenameTable) bool { 2207 if a == b { 2208 return true 2209 } 2210 if a == nil || b == nil { 2211 return false 2212 } 2213 return EqualsSliceOfRefOfRenameTablePair(a.TablePairs, b.TablePairs) 2214 } 2215 2216 // EqualsRefOfRenameTableName does deep equals between the two objects. 2217 func EqualsRefOfRenameTableName(a, b *RenameTableName) bool { 2218 if a == b { 2219 return true 2220 } 2221 if a == nil || b == nil { 2222 return false 2223 } 2224 return EqualsTableName(a.Table, b.Table) 2225 } 2226 2227 // EqualsRefOfRevertMigration does deep equals between the two objects. 2228 func EqualsRefOfRevertMigration(a, b *RevertMigration) bool { 2229 if a == b { 2230 return true 2231 } 2232 if a == nil || b == nil { 2233 return false 2234 } 2235 return a.UUID == b.UUID && 2236 EqualsComments(a.Comments, b.Comments) 2237 } 2238 2239 // EqualsRefOfRollback does deep equals between the two objects. 2240 func EqualsRefOfRollback(a, b *Rollback) bool { 2241 if a == b { 2242 return true 2243 } 2244 if a == nil || b == nil { 2245 return false 2246 } 2247 return true 2248 } 2249 2250 // EqualsRootNode does deep equals between the two objects. 2251 func EqualsRootNode(a, b RootNode) bool { 2252 return EqualsSQLNode(a.SQLNode, b.SQLNode) 2253 } 2254 2255 // EqualsRefOfSRollback does deep equals between the two objects. 2256 func EqualsRefOfSRollback(a, b *SRollback) bool { 2257 if a == b { 2258 return true 2259 } 2260 if a == nil || b == nil { 2261 return false 2262 } 2263 return EqualsColIdent(a.Name, b.Name) 2264 } 2265 2266 // EqualsRefOfSavepoint does deep equals between the two objects. 2267 func EqualsRefOfSavepoint(a, b *Savepoint) bool { 2268 if a == b { 2269 return true 2270 } 2271 if a == nil || b == nil { 2272 return false 2273 } 2274 return EqualsColIdent(a.Name, b.Name) 2275 } 2276 2277 // EqualsRefOfSelect does deep equals between the two objects. 2278 func EqualsRefOfSelect(a, b *Select) bool { 2279 if a == b { 2280 return true 2281 } 2282 if a == nil || b == nil { 2283 return false 2284 } 2285 return a.Distinct == b.Distinct && 2286 a.StraightJoinHint == b.StraightJoinHint && 2287 a.SQLCalcFoundRows == b.SQLCalcFoundRows && 2288 EqualsRefOfBool(a.Cache, b.Cache) && 2289 EqualsSliceOfTableExpr(a.From, b.From) && 2290 EqualsComments(a.Comments, b.Comments) && 2291 EqualsSelectExprs(a.SelectExprs, b.SelectExprs) && 2292 EqualsRefOfWhere(a.Where, b.Where) && 2293 EqualsRefOfWith(a.With, b.With) && 2294 EqualsGroupBy(a.GroupBy, b.GroupBy) && 2295 EqualsRefOfWhere(a.Having, b.Having) && 2296 EqualsOrderBy(a.OrderBy, b.OrderBy) && 2297 EqualsRefOfLimit(a.Limit, b.Limit) && 2298 a.Lock == b.Lock && 2299 EqualsRefOfSelectInto(a.Into, b.Into) 2300 } 2301 2302 // EqualsSelectExprs does deep equals between the two objects. 2303 func EqualsSelectExprs(a, b SelectExprs) bool { 2304 if len(a) != len(b) { 2305 return false 2306 } 2307 for i := 0; i < len(a); i++ { 2308 if !EqualsSelectExpr(a[i], b[i]) { 2309 return false 2310 } 2311 } 2312 return true 2313 } 2314 2315 // EqualsRefOfSelectInto does deep equals between the two objects. 2316 func EqualsRefOfSelectInto(a, b *SelectInto) bool { 2317 if a == b { 2318 return true 2319 } 2320 if a == nil || b == nil { 2321 return false 2322 } 2323 return a.FileName == b.FileName && 2324 a.Charset == b.Charset && 2325 a.FormatOption == b.FormatOption && 2326 a.ExportOption == b.ExportOption && 2327 a.Manifest == b.Manifest && 2328 a.Overwrite == b.Overwrite && 2329 a.Type == b.Type 2330 } 2331 2332 // EqualsRefOfSet does deep equals between the two objects. 2333 func EqualsRefOfSet(a, b *Set) bool { 2334 if a == b { 2335 return true 2336 } 2337 if a == nil || b == nil { 2338 return false 2339 } 2340 return EqualsComments(a.Comments, b.Comments) && 2341 EqualsSetExprs(a.Exprs, b.Exprs) 2342 } 2343 2344 // EqualsRefOfSetExpr does deep equals between the two objects. 2345 func EqualsRefOfSetExpr(a, b *SetExpr) bool { 2346 if a == b { 2347 return true 2348 } 2349 if a == nil || b == nil { 2350 return false 2351 } 2352 return a.Scope == b.Scope && 2353 EqualsColIdent(a.Name, b.Name) && 2354 EqualsExpr(a.Expr, b.Expr) 2355 } 2356 2357 // EqualsSetExprs does deep equals between the two objects. 2358 func EqualsSetExprs(a, b SetExprs) bool { 2359 if len(a) != len(b) { 2360 return false 2361 } 2362 for i := 0; i < len(a); i++ { 2363 if !EqualsRefOfSetExpr(a[i], b[i]) { 2364 return false 2365 } 2366 } 2367 return true 2368 } 2369 2370 // EqualsRefOfSetTransaction does deep equals between the two objects. 2371 func EqualsRefOfSetTransaction(a, b *SetTransaction) bool { 2372 if a == b { 2373 return true 2374 } 2375 if a == nil || b == nil { 2376 return false 2377 } 2378 return EqualsSQLNode(a.SQLNode, b.SQLNode) && 2379 EqualsComments(a.Comments, b.Comments) && 2380 a.Scope == b.Scope && 2381 EqualsSliceOfCharacteristic(a.Characteristics, b.Characteristics) 2382 } 2383 2384 // EqualsRefOfShow does deep equals between the two objects. 2385 func EqualsRefOfShow(a, b *Show) bool { 2386 if a == b { 2387 return true 2388 } 2389 if a == nil || b == nil { 2390 return false 2391 } 2392 return EqualsShowInternal(a.Internal, b.Internal) 2393 } 2394 2395 // EqualsRefOfShowBasic does deep equals between the two objects. 2396 func EqualsRefOfShowBasic(a, b *ShowBasic) bool { 2397 if a == b { 2398 return true 2399 } 2400 if a == nil || b == nil { 2401 return false 2402 } 2403 return a.Full == b.Full && 2404 a.Command == b.Command && 2405 EqualsTableName(a.Tbl, b.Tbl) && 2406 EqualsTableIdent(a.DbName, b.DbName) && 2407 EqualsRefOfShowFilter(a.Filter, b.Filter) 2408 } 2409 2410 // EqualsRefOfShowCreate does deep equals between the two objects. 2411 func EqualsRefOfShowCreate(a, b *ShowCreate) bool { 2412 if a == b { 2413 return true 2414 } 2415 if a == nil || b == nil { 2416 return false 2417 } 2418 return a.Command == b.Command && 2419 EqualsTableName(a.Op, b.Op) 2420 } 2421 2422 // EqualsRefOfShowFilter does deep equals between the two objects. 2423 func EqualsRefOfShowFilter(a, b *ShowFilter) bool { 2424 if a == b { 2425 return true 2426 } 2427 if a == nil || b == nil { 2428 return false 2429 } 2430 return a.Like == b.Like && 2431 EqualsExpr(a.Filter, b.Filter) 2432 } 2433 2434 // EqualsRefOfShowLegacy does deep equals between the two objects. 2435 func EqualsRefOfShowLegacy(a, b *ShowLegacy) bool { 2436 if a == b { 2437 return true 2438 } 2439 if a == nil || b == nil { 2440 return false 2441 } 2442 return a.Extended == b.Extended && 2443 a.Type == b.Type && 2444 EqualsTableName(a.OnTable, b.OnTable) && 2445 EqualsTableName(a.Table, b.Table) && 2446 EqualsRefOfShowTablesOpt(a.ShowTablesOpt, b.ShowTablesOpt) && 2447 a.Scope == b.Scope && 2448 EqualsExpr(a.ShowCollationFilterOpt, b.ShowCollationFilterOpt) 2449 } 2450 2451 // EqualsRefOfShowMigrationLogs does deep equals between the two objects. 2452 func EqualsRefOfShowMigrationLogs(a, b *ShowMigrationLogs) bool { 2453 if a == b { 2454 return true 2455 } 2456 if a == nil || b == nil { 2457 return false 2458 } 2459 return a.UUID == b.UUID && 2460 EqualsComments(a.Comments, b.Comments) 2461 } 2462 2463 // EqualsRefOfStarExpr does deep equals between the two objects. 2464 func EqualsRefOfStarExpr(a, b *StarExpr) bool { 2465 if a == b { 2466 return true 2467 } 2468 if a == nil || b == nil { 2469 return false 2470 } 2471 return EqualsTableName(a.TableName, b.TableName) 2472 } 2473 2474 // EqualsRefOfStream does deep equals between the two objects. 2475 func EqualsRefOfStream(a, b *Stream) bool { 2476 if a == b { 2477 return true 2478 } 2479 if a == nil || b == nil { 2480 return false 2481 } 2482 return EqualsComments(a.Comments, b.Comments) && 2483 EqualsSelectExpr(a.SelectExpr, b.SelectExpr) && 2484 EqualsTableName(a.Table, b.Table) 2485 } 2486 2487 // EqualsRefOfSubPartition does deep equals between the two objects. 2488 func EqualsRefOfSubPartition(a, b *SubPartition) bool { 2489 if a == b { 2490 return true 2491 } 2492 if a == nil || b == nil { 2493 return false 2494 } 2495 return a.Linear == b.Linear && 2496 a.isHASH == b.isHASH && 2497 a.isKEY == b.isKEY && 2498 a.KeyAlgorithm == b.KeyAlgorithm && 2499 a.SubPartitions == b.SubPartitions && 2500 EqualsColumns(a.KeyColList, b.KeyColList) && 2501 EqualsExpr(a.Expr, b.Expr) 2502 } 2503 2504 // EqualsRefOfSubquery does deep equals between the two objects. 2505 func EqualsRefOfSubquery(a, b *Subquery) bool { 2506 if a == b { 2507 return true 2508 } 2509 if a == nil || b == nil { 2510 return false 2511 } 2512 return EqualsSelectStatement(a.Select, b.Select) 2513 } 2514 2515 // EqualsRefOfSubstrExpr does deep equals between the two objects. 2516 func EqualsRefOfSubstrExpr(a, b *SubstrExpr) bool { 2517 if a == b { 2518 return true 2519 } 2520 if a == nil || b == nil { 2521 return false 2522 } 2523 return EqualsExpr(a.Name, b.Name) && 2524 EqualsExpr(a.From, b.From) && 2525 EqualsExpr(a.To, b.To) 2526 } 2527 2528 // EqualsTableExprs does deep equals between the two objects. 2529 func EqualsTableExprs(a, b TableExprs) bool { 2530 if len(a) != len(b) { 2531 return false 2532 } 2533 for i := 0; i < len(a); i++ { 2534 if !EqualsTableExpr(a[i], b[i]) { 2535 return false 2536 } 2537 } 2538 return true 2539 } 2540 2541 // EqualsTableIdent does deep equals between the two objects. 2542 func EqualsTableIdent(a, b TableIdent) bool { 2543 return a.v == b.v 2544 } 2545 2546 // EqualsTableName does deep equals between the two objects. 2547 func EqualsTableName(a, b TableName) bool { 2548 return EqualsTableIdent(a.Name, b.Name) && 2549 EqualsTableIdent(a.Qualifier, b.Qualifier) 2550 } 2551 2552 // EqualsTableNames does deep equals between the two objects. 2553 func EqualsTableNames(a, b TableNames) bool { 2554 if len(a) != len(b) { 2555 return false 2556 } 2557 for i := 0; i < len(a); i++ { 2558 if !EqualsTableName(a[i], b[i]) { 2559 return false 2560 } 2561 } 2562 return true 2563 } 2564 2565 // EqualsTableOptions does deep equals between the two objects. 2566 func EqualsTableOptions(a, b TableOptions) bool { 2567 if len(a) != len(b) { 2568 return false 2569 } 2570 for i := 0; i < len(a); i++ { 2571 if !EqualsRefOfTableOption(a[i], b[i]) { 2572 return false 2573 } 2574 } 2575 return true 2576 } 2577 2578 // EqualsRefOfTableSpec does deep equals between the two objects. 2579 func EqualsRefOfTableSpec(a, b *TableSpec) bool { 2580 if a == b { 2581 return true 2582 } 2583 if a == nil || b == nil { 2584 return false 2585 } 2586 return EqualsSliceOfRefOfColumnDefinition(a.Columns, b.Columns) && 2587 EqualsSliceOfRefOfIndexDefinition(a.Indexes, b.Indexes) && 2588 EqualsSliceOfRefOfConstraintDefinition(a.Constraints, b.Constraints) && 2589 EqualsTableOptions(a.Options, b.Options) && 2590 EqualsRefOfPartitionOption(a.PartitionOption, b.PartitionOption) 2591 } 2592 2593 // EqualsRefOfTablespaceOperation does deep equals between the two objects. 2594 func EqualsRefOfTablespaceOperation(a, b *TablespaceOperation) bool { 2595 if a == b { 2596 return true 2597 } 2598 if a == nil || b == nil { 2599 return false 2600 } 2601 return a.Import == b.Import 2602 } 2603 2604 // EqualsRefOfTimestampFuncExpr does deep equals between the two objects. 2605 func EqualsRefOfTimestampFuncExpr(a, b *TimestampFuncExpr) bool { 2606 if a == b { 2607 return true 2608 } 2609 if a == nil || b == nil { 2610 return false 2611 } 2612 return a.Name == b.Name && 2613 a.Unit == b.Unit && 2614 EqualsExpr(a.Expr1, b.Expr1) && 2615 EqualsExpr(a.Expr2, b.Expr2) 2616 } 2617 2618 // EqualsRefOfTruncateTable does deep equals between the two objects. 2619 func EqualsRefOfTruncateTable(a, b *TruncateTable) bool { 2620 if a == b { 2621 return true 2622 } 2623 if a == nil || b == nil { 2624 return false 2625 } 2626 return EqualsTableName(a.Table, b.Table) 2627 } 2628 2629 // EqualsRefOfUnaryExpr does deep equals between the two objects. 2630 func EqualsRefOfUnaryExpr(a, b *UnaryExpr) bool { 2631 if a == b { 2632 return true 2633 } 2634 if a == nil || b == nil { 2635 return false 2636 } 2637 return a.Operator == b.Operator && 2638 EqualsExpr(a.Expr, b.Expr) 2639 } 2640 2641 // EqualsRefOfUnion does deep equals between the two objects. 2642 func EqualsRefOfUnion(a, b *Union) bool { 2643 if a == b { 2644 return true 2645 } 2646 if a == nil || b == nil { 2647 return false 2648 } 2649 return a.Distinct == b.Distinct && 2650 EqualsSelectStatement(a.Left, b.Left) && 2651 EqualsSelectStatement(a.Right, b.Right) && 2652 EqualsOrderBy(a.OrderBy, b.OrderBy) && 2653 EqualsRefOfWith(a.With, b.With) && 2654 EqualsRefOfLimit(a.Limit, b.Limit) && 2655 a.Lock == b.Lock && 2656 EqualsRefOfSelectInto(a.Into, b.Into) 2657 } 2658 2659 // EqualsRefOfUnlockTables does deep equals between the two objects. 2660 func EqualsRefOfUnlockTables(a, b *UnlockTables) bool { 2661 if a == b { 2662 return true 2663 } 2664 if a == nil || b == nil { 2665 return false 2666 } 2667 return true 2668 } 2669 2670 // EqualsRefOfUpdate does deep equals between the two objects. 2671 func EqualsRefOfUpdate(a, b *Update) bool { 2672 if a == b { 2673 return true 2674 } 2675 if a == nil || b == nil { 2676 return false 2677 } 2678 return EqualsRefOfWith(a.With, b.With) && 2679 EqualsComments(a.Comments, b.Comments) && 2680 a.Ignore == b.Ignore && 2681 EqualsTableExprs(a.TableExprs, b.TableExprs) && 2682 EqualsUpdateExprs(a.Exprs, b.Exprs) && 2683 EqualsRefOfWhere(a.Where, b.Where) && 2684 EqualsOrderBy(a.OrderBy, b.OrderBy) && 2685 EqualsRefOfLimit(a.Limit, b.Limit) 2686 } 2687 2688 // EqualsRefOfUpdateExpr does deep equals between the two objects. 2689 func EqualsRefOfUpdateExpr(a, b *UpdateExpr) bool { 2690 if a == b { 2691 return true 2692 } 2693 if a == nil || b == nil { 2694 return false 2695 } 2696 return EqualsRefOfColName(a.Name, b.Name) && 2697 EqualsExpr(a.Expr, b.Expr) 2698 } 2699 2700 // EqualsUpdateExprs does deep equals between the two objects. 2701 func EqualsUpdateExprs(a, b UpdateExprs) bool { 2702 if len(a) != len(b) { 2703 return false 2704 } 2705 for i := 0; i < len(a); i++ { 2706 if !EqualsRefOfUpdateExpr(a[i], b[i]) { 2707 return false 2708 } 2709 } 2710 return true 2711 } 2712 2713 // EqualsRefOfUse does deep equals between the two objects. 2714 func EqualsRefOfUse(a, b *Use) bool { 2715 if a == b { 2716 return true 2717 } 2718 if a == nil || b == nil { 2719 return false 2720 } 2721 return EqualsTableIdent(a.DBName, b.DBName) 2722 } 2723 2724 // EqualsRefOfVStream does deep equals between the two objects. 2725 func EqualsRefOfVStream(a, b *VStream) bool { 2726 if a == b { 2727 return true 2728 } 2729 if a == nil || b == nil { 2730 return false 2731 } 2732 return EqualsComments(a.Comments, b.Comments) && 2733 EqualsSelectExpr(a.SelectExpr, b.SelectExpr) && 2734 EqualsTableName(a.Table, b.Table) && 2735 EqualsRefOfWhere(a.Where, b.Where) && 2736 EqualsRefOfLimit(a.Limit, b.Limit) 2737 } 2738 2739 // EqualsValTuple does deep equals between the two objects. 2740 func EqualsValTuple(a, b ValTuple) bool { 2741 if len(a) != len(b) { 2742 return false 2743 } 2744 for i := 0; i < len(a); i++ { 2745 if !EqualsExpr(a[i], b[i]) { 2746 return false 2747 } 2748 } 2749 return true 2750 } 2751 2752 // EqualsRefOfValidation does deep equals between the two objects. 2753 func EqualsRefOfValidation(a, b *Validation) bool { 2754 if a == b { 2755 return true 2756 } 2757 if a == nil || b == nil { 2758 return false 2759 } 2760 return a.With == b.With 2761 } 2762 2763 // EqualsValues does deep equals between the two objects. 2764 func EqualsValues(a, b Values) bool { 2765 if len(a) != len(b) { 2766 return false 2767 } 2768 for i := 0; i < len(a); i++ { 2769 if !EqualsValTuple(a[i], b[i]) { 2770 return false 2771 } 2772 } 2773 return true 2774 } 2775 2776 // EqualsRefOfValuesFuncExpr does deep equals between the two objects. 2777 func EqualsRefOfValuesFuncExpr(a, b *ValuesFuncExpr) bool { 2778 if a == b { 2779 return true 2780 } 2781 if a == nil || b == nil { 2782 return false 2783 } 2784 return EqualsRefOfColName(a.Name, b.Name) 2785 } 2786 2787 // EqualsVindexParam does deep equals between the two objects. 2788 func EqualsVindexParam(a, b VindexParam) bool { 2789 return a.Val == b.Val && 2790 EqualsColIdent(a.Key, b.Key) 2791 } 2792 2793 // EqualsRefOfVindexSpec does deep equals between the two objects. 2794 func EqualsRefOfVindexSpec(a, b *VindexSpec) bool { 2795 if a == b { 2796 return true 2797 } 2798 if a == nil || b == nil { 2799 return false 2800 } 2801 return EqualsColIdent(a.Name, b.Name) && 2802 EqualsColIdent(a.Type, b.Type) && 2803 EqualsSliceOfVindexParam(a.Params, b.Params) 2804 } 2805 2806 // EqualsRefOfWhen does deep equals between the two objects. 2807 func EqualsRefOfWhen(a, b *When) bool { 2808 if a == b { 2809 return true 2810 } 2811 if a == nil || b == nil { 2812 return false 2813 } 2814 return EqualsExpr(a.Cond, b.Cond) && 2815 EqualsExpr(a.Val, b.Val) 2816 } 2817 2818 // EqualsRefOfWhere does deep equals between the two objects. 2819 func EqualsRefOfWhere(a, b *Where) bool { 2820 if a == b { 2821 return true 2822 } 2823 if a == nil || b == nil { 2824 return false 2825 } 2826 return a.Type == b.Type && 2827 EqualsExpr(a.Expr, b.Expr) 2828 } 2829 2830 // EqualsRefOfWith does deep equals between the two objects. 2831 func EqualsRefOfWith(a, b *With) bool { 2832 if a == b { 2833 return true 2834 } 2835 if a == nil || b == nil { 2836 return false 2837 } 2838 return a.Recursive == b.Recursive && 2839 EqualsSliceOfRefOfCommonTableExpr(a.ctes, b.ctes) 2840 } 2841 2842 // EqualsRefOfXorExpr does deep equals between the two objects. 2843 func EqualsRefOfXorExpr(a, b *XorExpr) bool { 2844 if a == b { 2845 return true 2846 } 2847 if a == nil || b == nil { 2848 return false 2849 } 2850 return EqualsExpr(a.Left, b.Left) && 2851 EqualsExpr(a.Right, b.Right) 2852 } 2853 2854 // EqualsAlterOption does deep equals between the two objects. 2855 func EqualsAlterOption(inA, inB AlterOption) bool { 2856 if inA == nil && inB == nil { 2857 return true 2858 } 2859 if inA == nil || inB == nil { 2860 return false 2861 } 2862 switch a := inA.(type) { 2863 case *AddColumns: 2864 b, ok := inB.(*AddColumns) 2865 if !ok { 2866 return false 2867 } 2868 return EqualsRefOfAddColumns(a, b) 2869 case *AddConstraintDefinition: 2870 b, ok := inB.(*AddConstraintDefinition) 2871 if !ok { 2872 return false 2873 } 2874 return EqualsRefOfAddConstraintDefinition(a, b) 2875 case *AddIndexDefinition: 2876 b, ok := inB.(*AddIndexDefinition) 2877 if !ok { 2878 return false 2879 } 2880 return EqualsRefOfAddIndexDefinition(a, b) 2881 case AlgorithmValue: 2882 b, ok := inB.(AlgorithmValue) 2883 if !ok { 2884 return false 2885 } 2886 return a == b 2887 case *AlterCharset: 2888 b, ok := inB.(*AlterCharset) 2889 if !ok { 2890 return false 2891 } 2892 return EqualsRefOfAlterCharset(a, b) 2893 case *AlterColumn: 2894 b, ok := inB.(*AlterColumn) 2895 if !ok { 2896 return false 2897 } 2898 return EqualsRefOfAlterColumn(a, b) 2899 case *ChangeColumn: 2900 b, ok := inB.(*ChangeColumn) 2901 if !ok { 2902 return false 2903 } 2904 return EqualsRefOfChangeColumn(a, b) 2905 case *DropColumn: 2906 b, ok := inB.(*DropColumn) 2907 if !ok { 2908 return false 2909 } 2910 return EqualsRefOfDropColumn(a, b) 2911 case *DropKey: 2912 b, ok := inB.(*DropKey) 2913 if !ok { 2914 return false 2915 } 2916 return EqualsRefOfDropKey(a, b) 2917 case *Force: 2918 b, ok := inB.(*Force) 2919 if !ok { 2920 return false 2921 } 2922 return EqualsRefOfForce(a, b) 2923 case *KeyState: 2924 b, ok := inB.(*KeyState) 2925 if !ok { 2926 return false 2927 } 2928 return EqualsRefOfKeyState(a, b) 2929 case *LockOption: 2930 b, ok := inB.(*LockOption) 2931 if !ok { 2932 return false 2933 } 2934 return EqualsRefOfLockOption(a, b) 2935 case *ModifyColumn: 2936 b, ok := inB.(*ModifyColumn) 2937 if !ok { 2938 return false 2939 } 2940 return EqualsRefOfModifyColumn(a, b) 2941 case *OrderByOption: 2942 b, ok := inB.(*OrderByOption) 2943 if !ok { 2944 return false 2945 } 2946 return EqualsRefOfOrderByOption(a, b) 2947 case *RenameIndex: 2948 b, ok := inB.(*RenameIndex) 2949 if !ok { 2950 return false 2951 } 2952 return EqualsRefOfRenameIndex(a, b) 2953 case *RenameTableName: 2954 b, ok := inB.(*RenameTableName) 2955 if !ok { 2956 return false 2957 } 2958 return EqualsRefOfRenameTableName(a, b) 2959 case TableOptions: 2960 b, ok := inB.(TableOptions) 2961 if !ok { 2962 return false 2963 } 2964 return EqualsTableOptions(a, b) 2965 case *TablespaceOperation: 2966 b, ok := inB.(*TablespaceOperation) 2967 if !ok { 2968 return false 2969 } 2970 return EqualsRefOfTablespaceOperation(a, b) 2971 case *Validation: 2972 b, ok := inB.(*Validation) 2973 if !ok { 2974 return false 2975 } 2976 return EqualsRefOfValidation(a, b) 2977 default: 2978 // this should never happen 2979 return false 2980 } 2981 } 2982 2983 // EqualsCharacteristic does deep equals between the two objects. 2984 func EqualsCharacteristic(inA, inB Characteristic) bool { 2985 if inA == nil && inB == nil { 2986 return true 2987 } 2988 if inA == nil || inB == nil { 2989 return false 2990 } 2991 switch a := inA.(type) { 2992 case AccessMode: 2993 b, ok := inB.(AccessMode) 2994 if !ok { 2995 return false 2996 } 2997 return a == b 2998 case IsolationLevel: 2999 b, ok := inB.(IsolationLevel) 3000 if !ok { 3001 return false 3002 } 3003 return a == b 3004 default: 3005 // this should never happen 3006 return false 3007 } 3008 } 3009 3010 // EqualsColTuple does deep equals between the two objects. 3011 func EqualsColTuple(inA, inB ColTuple) bool { 3012 if inA == nil && inB == nil { 3013 return true 3014 } 3015 if inA == nil || inB == nil { 3016 return false 3017 } 3018 switch a := inA.(type) { 3019 case ListArg: 3020 b, ok := inB.(ListArg) 3021 if !ok { 3022 return false 3023 } 3024 return a == b 3025 case *Subquery: 3026 b, ok := inB.(*Subquery) 3027 if !ok { 3028 return false 3029 } 3030 return EqualsRefOfSubquery(a, b) 3031 case ValTuple: 3032 b, ok := inB.(ValTuple) 3033 if !ok { 3034 return false 3035 } 3036 return EqualsValTuple(a, b) 3037 default: 3038 // this should never happen 3039 return false 3040 } 3041 } 3042 3043 // EqualsConstraintInfo does deep equals between the two objects. 3044 func EqualsConstraintInfo(inA, inB ConstraintInfo) bool { 3045 if inA == nil && inB == nil { 3046 return true 3047 } 3048 if inA == nil || inB == nil { 3049 return false 3050 } 3051 switch a := inA.(type) { 3052 case *CheckConstraintDefinition: 3053 b, ok := inB.(*CheckConstraintDefinition) 3054 if !ok { 3055 return false 3056 } 3057 return EqualsRefOfCheckConstraintDefinition(a, b) 3058 case *ForeignKeyDefinition: 3059 b, ok := inB.(*ForeignKeyDefinition) 3060 if !ok { 3061 return false 3062 } 3063 return EqualsRefOfForeignKeyDefinition(a, b) 3064 default: 3065 // this should never happen 3066 return false 3067 } 3068 } 3069 3070 // EqualsDBDDLStatement does deep equals between the two objects. 3071 func EqualsDBDDLStatement(inA, inB DBDDLStatement) bool { 3072 if inA == nil && inB == nil { 3073 return true 3074 } 3075 if inA == nil || inB == nil { 3076 return false 3077 } 3078 switch a := inA.(type) { 3079 case *AlterDatabase: 3080 b, ok := inB.(*AlterDatabase) 3081 if !ok { 3082 return false 3083 } 3084 return EqualsRefOfAlterDatabase(a, b) 3085 case *CreateDatabase: 3086 b, ok := inB.(*CreateDatabase) 3087 if !ok { 3088 return false 3089 } 3090 return EqualsRefOfCreateDatabase(a, b) 3091 case *DropDatabase: 3092 b, ok := inB.(*DropDatabase) 3093 if !ok { 3094 return false 3095 } 3096 return EqualsRefOfDropDatabase(a, b) 3097 default: 3098 // this should never happen 3099 return false 3100 } 3101 } 3102 3103 // EqualsDDLStatement does deep equals between the two objects. 3104 func EqualsDDLStatement(inA, inB DDLStatement) bool { 3105 if inA == nil && inB == nil { 3106 return true 3107 } 3108 if inA == nil || inB == nil { 3109 return false 3110 } 3111 switch a := inA.(type) { 3112 case *AlterTable: 3113 b, ok := inB.(*AlterTable) 3114 if !ok { 3115 return false 3116 } 3117 return EqualsRefOfAlterTable(a, b) 3118 case *AlterView: 3119 b, ok := inB.(*AlterView) 3120 if !ok { 3121 return false 3122 } 3123 return EqualsRefOfAlterView(a, b) 3124 case *CreateTable: 3125 b, ok := inB.(*CreateTable) 3126 if !ok { 3127 return false 3128 } 3129 return EqualsRefOfCreateTable(a, b) 3130 case *CreateView: 3131 b, ok := inB.(*CreateView) 3132 if !ok { 3133 return false 3134 } 3135 return EqualsRefOfCreateView(a, b) 3136 case *DropTable: 3137 b, ok := inB.(*DropTable) 3138 if !ok { 3139 return false 3140 } 3141 return EqualsRefOfDropTable(a, b) 3142 case *DropView: 3143 b, ok := inB.(*DropView) 3144 if !ok { 3145 return false 3146 } 3147 return EqualsRefOfDropView(a, b) 3148 case *RenameTable: 3149 b, ok := inB.(*RenameTable) 3150 if !ok { 3151 return false 3152 } 3153 return EqualsRefOfRenameTable(a, b) 3154 case *TruncateTable: 3155 b, ok := inB.(*TruncateTable) 3156 if !ok { 3157 return false 3158 } 3159 return EqualsRefOfTruncateTable(a, b) 3160 default: 3161 // this should never happen 3162 return false 3163 } 3164 } 3165 3166 // EqualsExplain does deep equals between the two objects. 3167 func EqualsExplain(inA, inB Explain) bool { 3168 if inA == nil && inB == nil { 3169 return true 3170 } 3171 if inA == nil || inB == nil { 3172 return false 3173 } 3174 switch a := inA.(type) { 3175 case *ExplainStmt: 3176 b, ok := inB.(*ExplainStmt) 3177 if !ok { 3178 return false 3179 } 3180 return EqualsRefOfExplainStmt(a, b) 3181 case *ExplainTab: 3182 b, ok := inB.(*ExplainTab) 3183 if !ok { 3184 return false 3185 } 3186 return EqualsRefOfExplainTab(a, b) 3187 default: 3188 // this should never happen 3189 return false 3190 } 3191 } 3192 3193 // EqualsExpr does deep equals between the two objects. 3194 func EqualsExpr(inA, inB Expr) bool { 3195 if inA == nil && inB == nil { 3196 return true 3197 } 3198 if inA == nil || inB == nil { 3199 return false 3200 } 3201 switch a := inA.(type) { 3202 case *AndExpr: 3203 b, ok := inB.(*AndExpr) 3204 if !ok { 3205 return false 3206 } 3207 return EqualsRefOfAndExpr(a, b) 3208 case Argument: 3209 b, ok := inB.(Argument) 3210 if !ok { 3211 return false 3212 } 3213 return a == b 3214 case *BetweenExpr: 3215 b, ok := inB.(*BetweenExpr) 3216 if !ok { 3217 return false 3218 } 3219 return EqualsRefOfBetweenExpr(a, b) 3220 case *BinaryExpr: 3221 b, ok := inB.(*BinaryExpr) 3222 if !ok { 3223 return false 3224 } 3225 return EqualsRefOfBinaryExpr(a, b) 3226 case BoolVal: 3227 b, ok := inB.(BoolVal) 3228 if !ok { 3229 return false 3230 } 3231 return a == b 3232 case *CaseExpr: 3233 b, ok := inB.(*CaseExpr) 3234 if !ok { 3235 return false 3236 } 3237 return EqualsRefOfCaseExpr(a, b) 3238 case *ColName: 3239 b, ok := inB.(*ColName) 3240 if !ok { 3241 return false 3242 } 3243 return EqualsRefOfColName(a, b) 3244 case *CollateExpr: 3245 b, ok := inB.(*CollateExpr) 3246 if !ok { 3247 return false 3248 } 3249 return EqualsRefOfCollateExpr(a, b) 3250 case *ComparisonExpr: 3251 b, ok := inB.(*ComparisonExpr) 3252 if !ok { 3253 return false 3254 } 3255 return EqualsRefOfComparisonExpr(a, b) 3256 case *ConvertExpr: 3257 b, ok := inB.(*ConvertExpr) 3258 if !ok { 3259 return false 3260 } 3261 return EqualsRefOfConvertExpr(a, b) 3262 case *ConvertUsingExpr: 3263 b, ok := inB.(*ConvertUsingExpr) 3264 if !ok { 3265 return false 3266 } 3267 return EqualsRefOfConvertUsingExpr(a, b) 3268 case *CurTimeFuncExpr: 3269 b, ok := inB.(*CurTimeFuncExpr) 3270 if !ok { 3271 return false 3272 } 3273 return EqualsRefOfCurTimeFuncExpr(a, b) 3274 case *Default: 3275 b, ok := inB.(*Default) 3276 if !ok { 3277 return false 3278 } 3279 return EqualsRefOfDefault(a, b) 3280 case *ExistsExpr: 3281 b, ok := inB.(*ExistsExpr) 3282 if !ok { 3283 return false 3284 } 3285 return EqualsRefOfExistsExpr(a, b) 3286 case *ExtractFuncExpr: 3287 b, ok := inB.(*ExtractFuncExpr) 3288 if !ok { 3289 return false 3290 } 3291 return EqualsRefOfExtractFuncExpr(a, b) 3292 case *ExtractedSubquery: 3293 b, ok := inB.(*ExtractedSubquery) 3294 if !ok { 3295 return false 3296 } 3297 return EqualsRefOfExtractedSubquery(a, b) 3298 case *FuncExpr: 3299 b, ok := inB.(*FuncExpr) 3300 if !ok { 3301 return false 3302 } 3303 return EqualsRefOfFuncExpr(a, b) 3304 case *GroupConcatExpr: 3305 b, ok := inB.(*GroupConcatExpr) 3306 if !ok { 3307 return false 3308 } 3309 return EqualsRefOfGroupConcatExpr(a, b) 3310 case *IntervalExpr: 3311 b, ok := inB.(*IntervalExpr) 3312 if !ok { 3313 return false 3314 } 3315 return EqualsRefOfIntervalExpr(a, b) 3316 case *IntroducerExpr: 3317 b, ok := inB.(*IntroducerExpr) 3318 if !ok { 3319 return false 3320 } 3321 return EqualsRefOfIntroducerExpr(a, b) 3322 case *IsExpr: 3323 b, ok := inB.(*IsExpr) 3324 if !ok { 3325 return false 3326 } 3327 return EqualsRefOfIsExpr(a, b) 3328 case ListArg: 3329 b, ok := inB.(ListArg) 3330 if !ok { 3331 return false 3332 } 3333 return a == b 3334 case *Literal: 3335 b, ok := inB.(*Literal) 3336 if !ok { 3337 return false 3338 } 3339 return EqualsRefOfLiteral(a, b) 3340 case *MatchExpr: 3341 b, ok := inB.(*MatchExpr) 3342 if !ok { 3343 return false 3344 } 3345 return EqualsRefOfMatchExpr(a, b) 3346 case *NotExpr: 3347 b, ok := inB.(*NotExpr) 3348 if !ok { 3349 return false 3350 } 3351 return EqualsRefOfNotExpr(a, b) 3352 case *NullVal: 3353 b, ok := inB.(*NullVal) 3354 if !ok { 3355 return false 3356 } 3357 return EqualsRefOfNullVal(a, b) 3358 case *OrExpr: 3359 b, ok := inB.(*OrExpr) 3360 if !ok { 3361 return false 3362 } 3363 return EqualsRefOfOrExpr(a, b) 3364 case *Subquery: 3365 b, ok := inB.(*Subquery) 3366 if !ok { 3367 return false 3368 } 3369 return EqualsRefOfSubquery(a, b) 3370 case *SubstrExpr: 3371 b, ok := inB.(*SubstrExpr) 3372 if !ok { 3373 return false 3374 } 3375 return EqualsRefOfSubstrExpr(a, b) 3376 case *TimestampFuncExpr: 3377 b, ok := inB.(*TimestampFuncExpr) 3378 if !ok { 3379 return false 3380 } 3381 return EqualsRefOfTimestampFuncExpr(a, b) 3382 case *UnaryExpr: 3383 b, ok := inB.(*UnaryExpr) 3384 if !ok { 3385 return false 3386 } 3387 return EqualsRefOfUnaryExpr(a, b) 3388 case ValTuple: 3389 b, ok := inB.(ValTuple) 3390 if !ok { 3391 return false 3392 } 3393 return EqualsValTuple(a, b) 3394 case *ValuesFuncExpr: 3395 b, ok := inB.(*ValuesFuncExpr) 3396 if !ok { 3397 return false 3398 } 3399 return EqualsRefOfValuesFuncExpr(a, b) 3400 case *XorExpr: 3401 b, ok := inB.(*XorExpr) 3402 if !ok { 3403 return false 3404 } 3405 return EqualsRefOfXorExpr(a, b) 3406 default: 3407 // this should never happen 3408 return false 3409 } 3410 } 3411 3412 // EqualsInsertRows does deep equals between the two objects. 3413 func EqualsInsertRows(inA, inB InsertRows) bool { 3414 if inA == nil && inB == nil { 3415 return true 3416 } 3417 if inA == nil || inB == nil { 3418 return false 3419 } 3420 switch a := inA.(type) { 3421 case *Select: 3422 b, ok := inB.(*Select) 3423 if !ok { 3424 return false 3425 } 3426 return EqualsRefOfSelect(a, b) 3427 case *Union: 3428 b, ok := inB.(*Union) 3429 if !ok { 3430 return false 3431 } 3432 return EqualsRefOfUnion(a, b) 3433 case Values: 3434 b, ok := inB.(Values) 3435 if !ok { 3436 return false 3437 } 3438 return EqualsValues(a, b) 3439 default: 3440 // this should never happen 3441 return false 3442 } 3443 } 3444 3445 // EqualsSelectExpr does deep equals between the two objects. 3446 func EqualsSelectExpr(inA, inB SelectExpr) bool { 3447 if inA == nil && inB == nil { 3448 return true 3449 } 3450 if inA == nil || inB == nil { 3451 return false 3452 } 3453 switch a := inA.(type) { 3454 case *AliasedExpr: 3455 b, ok := inB.(*AliasedExpr) 3456 if !ok { 3457 return false 3458 } 3459 return EqualsRefOfAliasedExpr(a, b) 3460 case *Nextval: 3461 b, ok := inB.(*Nextval) 3462 if !ok { 3463 return false 3464 } 3465 return EqualsRefOfNextval(a, b) 3466 case *StarExpr: 3467 b, ok := inB.(*StarExpr) 3468 if !ok { 3469 return false 3470 } 3471 return EqualsRefOfStarExpr(a, b) 3472 default: 3473 // this should never happen 3474 return false 3475 } 3476 } 3477 3478 // EqualsSelectStatement does deep equals between the two objects. 3479 func EqualsSelectStatement(inA, inB SelectStatement) bool { 3480 if inA == nil && inB == nil { 3481 return true 3482 } 3483 if inA == nil || inB == nil { 3484 return false 3485 } 3486 switch a := inA.(type) { 3487 case *Select: 3488 b, ok := inB.(*Select) 3489 if !ok { 3490 return false 3491 } 3492 return EqualsRefOfSelect(a, b) 3493 case *Union: 3494 b, ok := inB.(*Union) 3495 if !ok { 3496 return false 3497 } 3498 return EqualsRefOfUnion(a, b) 3499 default: 3500 // this should never happen 3501 return false 3502 } 3503 } 3504 3505 // EqualsShowInternal does deep equals between the two objects. 3506 func EqualsShowInternal(inA, inB ShowInternal) bool { 3507 if inA == nil && inB == nil { 3508 return true 3509 } 3510 if inA == nil || inB == nil { 3511 return false 3512 } 3513 switch a := inA.(type) { 3514 case *ShowBasic: 3515 b, ok := inB.(*ShowBasic) 3516 if !ok { 3517 return false 3518 } 3519 return EqualsRefOfShowBasic(a, b) 3520 case *ShowCreate: 3521 b, ok := inB.(*ShowCreate) 3522 if !ok { 3523 return false 3524 } 3525 return EqualsRefOfShowCreate(a, b) 3526 case *ShowLegacy: 3527 b, ok := inB.(*ShowLegacy) 3528 if !ok { 3529 return false 3530 } 3531 return EqualsRefOfShowLegacy(a, b) 3532 default: 3533 // this should never happen 3534 return false 3535 } 3536 } 3537 3538 // EqualsSimpleTableExpr does deep equals between the two objects. 3539 func EqualsSimpleTableExpr(inA, inB SimpleTableExpr) bool { 3540 if inA == nil && inB == nil { 3541 return true 3542 } 3543 if inA == nil || inB == nil { 3544 return false 3545 } 3546 switch a := inA.(type) { 3547 case *DerivedTable: 3548 b, ok := inB.(*DerivedTable) 3549 if !ok { 3550 return false 3551 } 3552 return EqualsRefOfDerivedTable(a, b) 3553 case TableName: 3554 b, ok := inB.(TableName) 3555 if !ok { 3556 return false 3557 } 3558 return EqualsTableName(a, b) 3559 default: 3560 // this should never happen 3561 return false 3562 } 3563 } 3564 3565 // EqualsStatement does deep equals between the two objects. 3566 func EqualsStatement(inA, inB Statement) bool { 3567 if inA == nil && inB == nil { 3568 return true 3569 } 3570 if inA == nil || inB == nil { 3571 return false 3572 } 3573 switch a := inA.(type) { 3574 case *AlterDatabase: 3575 b, ok := inB.(*AlterDatabase) 3576 if !ok { 3577 return false 3578 } 3579 return EqualsRefOfAlterDatabase(a, b) 3580 case *AlterMigration: 3581 b, ok := inB.(*AlterMigration) 3582 if !ok { 3583 return false 3584 } 3585 return EqualsRefOfAlterMigration(a, b) 3586 case *AlterTable: 3587 b, ok := inB.(*AlterTable) 3588 if !ok { 3589 return false 3590 } 3591 return EqualsRefOfAlterTable(a, b) 3592 case *AlterView: 3593 b, ok := inB.(*AlterView) 3594 if !ok { 3595 return false 3596 } 3597 return EqualsRefOfAlterView(a, b) 3598 case *AlterVschema: 3599 b, ok := inB.(*AlterVschema) 3600 if !ok { 3601 return false 3602 } 3603 return EqualsRefOfAlterVschema(a, b) 3604 case *Begin: 3605 b, ok := inB.(*Begin) 3606 if !ok { 3607 return false 3608 } 3609 return EqualsRefOfBegin(a, b) 3610 case *CallProc: 3611 b, ok := inB.(*CallProc) 3612 if !ok { 3613 return false 3614 } 3615 return EqualsRefOfCallProc(a, b) 3616 case *Commit: 3617 b, ok := inB.(*Commit) 3618 if !ok { 3619 return false 3620 } 3621 return EqualsRefOfCommit(a, b) 3622 case *CreateDatabase: 3623 b, ok := inB.(*CreateDatabase) 3624 if !ok { 3625 return false 3626 } 3627 return EqualsRefOfCreateDatabase(a, b) 3628 case *CreateTable: 3629 b, ok := inB.(*CreateTable) 3630 if !ok { 3631 return false 3632 } 3633 return EqualsRefOfCreateTable(a, b) 3634 case *CreateView: 3635 b, ok := inB.(*CreateView) 3636 if !ok { 3637 return false 3638 } 3639 return EqualsRefOfCreateView(a, b) 3640 case *Delete: 3641 b, ok := inB.(*Delete) 3642 if !ok { 3643 return false 3644 } 3645 return EqualsRefOfDelete(a, b) 3646 case *DropDatabase: 3647 b, ok := inB.(*DropDatabase) 3648 if !ok { 3649 return false 3650 } 3651 return EqualsRefOfDropDatabase(a, b) 3652 case *DropTable: 3653 b, ok := inB.(*DropTable) 3654 if !ok { 3655 return false 3656 } 3657 return EqualsRefOfDropTable(a, b) 3658 case *DropView: 3659 b, ok := inB.(*DropView) 3660 if !ok { 3661 return false 3662 } 3663 return EqualsRefOfDropView(a, b) 3664 case *ExplainStmt: 3665 b, ok := inB.(*ExplainStmt) 3666 if !ok { 3667 return false 3668 } 3669 return EqualsRefOfExplainStmt(a, b) 3670 case *ExplainTab: 3671 b, ok := inB.(*ExplainTab) 3672 if !ok { 3673 return false 3674 } 3675 return EqualsRefOfExplainTab(a, b) 3676 case *Flush: 3677 b, ok := inB.(*Flush) 3678 if !ok { 3679 return false 3680 } 3681 return EqualsRefOfFlush(a, b) 3682 case *Insert: 3683 b, ok := inB.(*Insert) 3684 if !ok { 3685 return false 3686 } 3687 return EqualsRefOfInsert(a, b) 3688 case *Load: 3689 b, ok := inB.(*Load) 3690 if !ok { 3691 return false 3692 } 3693 return EqualsRefOfLoad(a, b) 3694 case *LockTables: 3695 b, ok := inB.(*LockTables) 3696 if !ok { 3697 return false 3698 } 3699 return EqualsRefOfLockTables(a, b) 3700 case *OtherAdmin: 3701 b, ok := inB.(*OtherAdmin) 3702 if !ok { 3703 return false 3704 } 3705 return EqualsRefOfOtherAdmin(a, b) 3706 case *OtherRead: 3707 b, ok := inB.(*OtherRead) 3708 if !ok { 3709 return false 3710 } 3711 return EqualsRefOfOtherRead(a, b) 3712 case *Release: 3713 b, ok := inB.(*Release) 3714 if !ok { 3715 return false 3716 } 3717 return EqualsRefOfRelease(a, b) 3718 case *RenameTable: 3719 b, ok := inB.(*RenameTable) 3720 if !ok { 3721 return false 3722 } 3723 return EqualsRefOfRenameTable(a, b) 3724 case *RevertMigration: 3725 b, ok := inB.(*RevertMigration) 3726 if !ok { 3727 return false 3728 } 3729 return EqualsRefOfRevertMigration(a, b) 3730 case *Rollback: 3731 b, ok := inB.(*Rollback) 3732 if !ok { 3733 return false 3734 } 3735 return EqualsRefOfRollback(a, b) 3736 case *SRollback: 3737 b, ok := inB.(*SRollback) 3738 if !ok { 3739 return false 3740 } 3741 return EqualsRefOfSRollback(a, b) 3742 case *Savepoint: 3743 b, ok := inB.(*Savepoint) 3744 if !ok { 3745 return false 3746 } 3747 return EqualsRefOfSavepoint(a, b) 3748 case *Select: 3749 b, ok := inB.(*Select) 3750 if !ok { 3751 return false 3752 } 3753 return EqualsRefOfSelect(a, b) 3754 case *Set: 3755 b, ok := inB.(*Set) 3756 if !ok { 3757 return false 3758 } 3759 return EqualsRefOfSet(a, b) 3760 case *SetTransaction: 3761 b, ok := inB.(*SetTransaction) 3762 if !ok { 3763 return false 3764 } 3765 return EqualsRefOfSetTransaction(a, b) 3766 case *Show: 3767 b, ok := inB.(*Show) 3768 if !ok { 3769 return false 3770 } 3771 return EqualsRefOfShow(a, b) 3772 case *ShowMigrationLogs: 3773 b, ok := inB.(*ShowMigrationLogs) 3774 if !ok { 3775 return false 3776 } 3777 return EqualsRefOfShowMigrationLogs(a, b) 3778 case *Stream: 3779 b, ok := inB.(*Stream) 3780 if !ok { 3781 return false 3782 } 3783 return EqualsRefOfStream(a, b) 3784 case *TruncateTable: 3785 b, ok := inB.(*TruncateTable) 3786 if !ok { 3787 return false 3788 } 3789 return EqualsRefOfTruncateTable(a, b) 3790 case *Union: 3791 b, ok := inB.(*Union) 3792 if !ok { 3793 return false 3794 } 3795 return EqualsRefOfUnion(a, b) 3796 case *UnlockTables: 3797 b, ok := inB.(*UnlockTables) 3798 if !ok { 3799 return false 3800 } 3801 return EqualsRefOfUnlockTables(a, b) 3802 case *Update: 3803 b, ok := inB.(*Update) 3804 if !ok { 3805 return false 3806 } 3807 return EqualsRefOfUpdate(a, b) 3808 case *Use: 3809 b, ok := inB.(*Use) 3810 if !ok { 3811 return false 3812 } 3813 return EqualsRefOfUse(a, b) 3814 case *VStream: 3815 b, ok := inB.(*VStream) 3816 if !ok { 3817 return false 3818 } 3819 return EqualsRefOfVStream(a, b) 3820 default: 3821 // this should never happen 3822 return false 3823 } 3824 } 3825 3826 // EqualsTableExpr does deep equals between the two objects. 3827 func EqualsTableExpr(inA, inB TableExpr) bool { 3828 if inA == nil && inB == nil { 3829 return true 3830 } 3831 if inA == nil || inB == nil { 3832 return false 3833 } 3834 switch a := inA.(type) { 3835 case *AliasedTableExpr: 3836 b, ok := inB.(*AliasedTableExpr) 3837 if !ok { 3838 return false 3839 } 3840 return EqualsRefOfAliasedTableExpr(a, b) 3841 case *JoinTableExpr: 3842 b, ok := inB.(*JoinTableExpr) 3843 if !ok { 3844 return false 3845 } 3846 return EqualsRefOfJoinTableExpr(a, b) 3847 case *ParenTableExpr: 3848 b, ok := inB.(*ParenTableExpr) 3849 if !ok { 3850 return false 3851 } 3852 return EqualsRefOfParenTableExpr(a, b) 3853 default: 3854 // this should never happen 3855 return false 3856 } 3857 } 3858 3859 // EqualsSliceOfRefOfColumnDefinition does deep equals between the two objects. 3860 func EqualsSliceOfRefOfColumnDefinition(a, b []*ColumnDefinition) bool { 3861 if len(a) != len(b) { 3862 return false 3863 } 3864 for i := 0; i < len(a); i++ { 3865 if !EqualsRefOfColumnDefinition(a[i], b[i]) { 3866 return false 3867 } 3868 } 3869 return true 3870 } 3871 3872 // EqualsSliceOfCollateAndCharset does deep equals between the two objects. 3873 func EqualsSliceOfCollateAndCharset(a, b []CollateAndCharset) bool { 3874 if len(a) != len(b) { 3875 return false 3876 } 3877 for i := 0; i < len(a); i++ { 3878 if !EqualsCollateAndCharset(a[i], b[i]) { 3879 return false 3880 } 3881 } 3882 return true 3883 } 3884 3885 // EqualsSliceOfAlterOption does deep equals between the two objects. 3886 func EqualsSliceOfAlterOption(a, b []AlterOption) bool { 3887 if len(a) != len(b) { 3888 return false 3889 } 3890 for i := 0; i < len(a); i++ { 3891 if !EqualsAlterOption(a[i], b[i]) { 3892 return false 3893 } 3894 } 3895 return true 3896 } 3897 3898 // EqualsSliceOfColIdent does deep equals between the two objects. 3899 func EqualsSliceOfColIdent(a, b []ColIdent) bool { 3900 if len(a) != len(b) { 3901 return false 3902 } 3903 for i := 0; i < len(a); i++ { 3904 if !EqualsColIdent(a[i], b[i]) { 3905 return false 3906 } 3907 } 3908 return true 3909 } 3910 3911 // EqualsSliceOfRefOfWhen does deep equals between the two objects. 3912 func EqualsSliceOfRefOfWhen(a, b []*When) bool { 3913 if len(a) != len(b) { 3914 return false 3915 } 3916 for i := 0; i < len(a); i++ { 3917 if !EqualsRefOfWhen(a[i], b[i]) { 3918 return false 3919 } 3920 } 3921 return true 3922 } 3923 3924 // EqualsRefOfColIdent does deep equals between the two objects. 3925 func EqualsRefOfColIdent(a, b *ColIdent) bool { 3926 if a == b { 3927 return true 3928 } 3929 if a == nil || b == nil { 3930 return false 3931 } 3932 return a.val == b.val && 3933 a.lowered == b.lowered && 3934 a.at == b.at 3935 } 3936 3937 // EqualsColumnType does deep equals between the two objects. 3938 func EqualsColumnType(a, b ColumnType) bool { 3939 return a.Type == b.Type && 3940 a.Unsigned == b.Unsigned && 3941 a.Zerofill == b.Zerofill && 3942 a.Charset == b.Charset && 3943 EqualsRefOfColumnTypeOptions(a.Options, b.Options) && 3944 EqualsRefOfLiteral(a.Length, b.Length) && 3945 EqualsRefOfLiteral(a.Scale, b.Scale) && 3946 EqualsSliceOfString(a.EnumValues, b.EnumValues) 3947 } 3948 3949 // EqualsRefOfColumnTypeOptions does deep equals between the two objects. 3950 func EqualsRefOfColumnTypeOptions(a, b *ColumnTypeOptions) bool { 3951 if a == b { 3952 return true 3953 } 3954 if a == nil || b == nil { 3955 return false 3956 } 3957 return a.Autoincrement == b.Autoincrement && 3958 a.Collate == b.Collate && 3959 EqualsRefOfBool(a.Null, b.Null) && 3960 EqualsExpr(a.Default, b.Default) && 3961 EqualsExpr(a.OnUpdate, b.OnUpdate) && 3962 EqualsExpr(a.As, b.As) && 3963 EqualsRefOfLiteral(a.Comment, b.Comment) && 3964 a.Storage == b.Storage && 3965 EqualsRefOfReferenceDefinition(a.Reference, b.Reference) && 3966 a.KeyOpt == b.KeyOpt 3967 } 3968 3969 // EqualsSliceOfString does deep equals between the two objects. 3970 func EqualsSliceOfString(a, b []string) bool { 3971 if len(a) != len(b) { 3972 return false 3973 } 3974 for i := 0; i < len(a); i++ { 3975 if a[i] != b[i] { 3976 return false 3977 } 3978 } 3979 return true 3980 } 3981 3982 // EqualsSliceOfRefOfIndexColumn does deep equals between the two objects. 3983 func EqualsSliceOfRefOfIndexColumn(a, b []*IndexColumn) bool { 3984 if len(a) != len(b) { 3985 return false 3986 } 3987 for i := 0; i < len(a); i++ { 3988 if !EqualsRefOfIndexColumn(a[i], b[i]) { 3989 return false 3990 } 3991 } 3992 return true 3993 } 3994 3995 // EqualsSliceOfRefOfIndexOption does deep equals between the two objects. 3996 func EqualsSliceOfRefOfIndexOption(a, b []*IndexOption) bool { 3997 if len(a) != len(b) { 3998 return false 3999 } 4000 for i := 0; i < len(a); i++ { 4001 if !EqualsRefOfIndexOption(a[i], b[i]) { 4002 return false 4003 } 4004 } 4005 return true 4006 } 4007 4008 // EqualsTableAndLockTypes does deep equals between the two objects. 4009 func EqualsTableAndLockTypes(a, b TableAndLockTypes) bool { 4010 if len(a) != len(b) { 4011 return false 4012 } 4013 for i := 0; i < len(a); i++ { 4014 if !EqualsRefOfTableAndLockType(a[i], b[i]) { 4015 return false 4016 } 4017 } 4018 return true 4019 } 4020 4021 // EqualsSliceOfRefOfPartitionDefinition does deep equals between the two objects. 4022 func EqualsSliceOfRefOfPartitionDefinition(a, b []*PartitionDefinition) bool { 4023 if len(a) != len(b) { 4024 return false 4025 } 4026 for i := 0; i < len(a); i++ { 4027 if !EqualsRefOfPartitionDefinition(a[i], b[i]) { 4028 return false 4029 } 4030 } 4031 return true 4032 } 4033 4034 // EqualsSliceOfRefOfRenameTablePair does deep equals between the two objects. 4035 func EqualsSliceOfRefOfRenameTablePair(a, b []*RenameTablePair) bool { 4036 if len(a) != len(b) { 4037 return false 4038 } 4039 for i := 0; i < len(a); i++ { 4040 if !EqualsRefOfRenameTablePair(a[i], b[i]) { 4041 return false 4042 } 4043 } 4044 return true 4045 } 4046 4047 // EqualsRefOfRootNode does deep equals between the two objects. 4048 func EqualsRefOfRootNode(a, b *RootNode) bool { 4049 if a == b { 4050 return true 4051 } 4052 if a == nil || b == nil { 4053 return false 4054 } 4055 return EqualsSQLNode(a.SQLNode, b.SQLNode) 4056 } 4057 4058 // EqualsRefOfBool does deep equals between the two objects. 4059 func EqualsRefOfBool(a, b *bool) bool { 4060 if a == b { 4061 return true 4062 } 4063 if a == nil || b == nil { 4064 return false 4065 } 4066 return *a == *b 4067 } 4068 4069 // EqualsSliceOfTableExpr does deep equals between the two objects. 4070 func EqualsSliceOfTableExpr(a, b []TableExpr) bool { 4071 if len(a) != len(b) { 4072 return false 4073 } 4074 for i := 0; i < len(a); i++ { 4075 if !EqualsTableExpr(a[i], b[i]) { 4076 return false 4077 } 4078 } 4079 return true 4080 } 4081 4082 // EqualsSliceOfCharacteristic does deep equals between the two objects. 4083 func EqualsSliceOfCharacteristic(a, b []Characteristic) bool { 4084 if len(a) != len(b) { 4085 return false 4086 } 4087 for i := 0; i < len(a); i++ { 4088 if !EqualsCharacteristic(a[i], b[i]) { 4089 return false 4090 } 4091 } 4092 return true 4093 } 4094 4095 // EqualsRefOfShowTablesOpt does deep equals between the two objects. 4096 func EqualsRefOfShowTablesOpt(a, b *ShowTablesOpt) bool { 4097 if a == b { 4098 return true 4099 } 4100 if a == nil || b == nil { 4101 return false 4102 } 4103 return a.Full == b.Full && 4104 a.DbName == b.DbName && 4105 EqualsRefOfShowFilter(a.Filter, b.Filter) 4106 } 4107 4108 // EqualsRefOfTableIdent does deep equals between the two objects. 4109 func EqualsRefOfTableIdent(a, b *TableIdent) bool { 4110 if a == b { 4111 return true 4112 } 4113 if a == nil || b == nil { 4114 return false 4115 } 4116 return a.v == b.v 4117 } 4118 4119 // EqualsRefOfTableName does deep equals between the two objects. 4120 func EqualsRefOfTableName(a, b *TableName) bool { 4121 if a == b { 4122 return true 4123 } 4124 if a == nil || b == nil { 4125 return false 4126 } 4127 return EqualsTableIdent(a.Name, b.Name) && 4128 EqualsTableIdent(a.Qualifier, b.Qualifier) 4129 } 4130 4131 // EqualsRefOfTableOption does deep equals between the two objects. 4132 func EqualsRefOfTableOption(a, b *TableOption) bool { 4133 if a == b { 4134 return true 4135 } 4136 if a == nil || b == nil { 4137 return false 4138 } 4139 return a.Name == b.Name && 4140 a.String == b.String && 4141 EqualsRefOfLiteral(a.Value, b.Value) && 4142 EqualsTableNames(a.Tables, b.Tables) 4143 } 4144 4145 // EqualsSliceOfRefOfIndexDefinition does deep equals between the two objects. 4146 func EqualsSliceOfRefOfIndexDefinition(a, b []*IndexDefinition) bool { 4147 if len(a) != len(b) { 4148 return false 4149 } 4150 for i := 0; i < len(a); i++ { 4151 if !EqualsRefOfIndexDefinition(a[i], b[i]) { 4152 return false 4153 } 4154 } 4155 return true 4156 } 4157 4158 // EqualsSliceOfRefOfConstraintDefinition does deep equals between the two objects. 4159 func EqualsSliceOfRefOfConstraintDefinition(a, b []*ConstraintDefinition) bool { 4160 if len(a) != len(b) { 4161 return false 4162 } 4163 for i := 0; i < len(a); i++ { 4164 if !EqualsRefOfConstraintDefinition(a[i], b[i]) { 4165 return false 4166 } 4167 } 4168 return true 4169 } 4170 4171 // EqualsRefOfVindexParam does deep equals between the two objects. 4172 func EqualsRefOfVindexParam(a, b *VindexParam) bool { 4173 if a == b { 4174 return true 4175 } 4176 if a == nil || b == nil { 4177 return false 4178 } 4179 return a.Val == b.Val && 4180 EqualsColIdent(a.Key, b.Key) 4181 } 4182 4183 // EqualsSliceOfVindexParam does deep equals between the two objects. 4184 func EqualsSliceOfVindexParam(a, b []VindexParam) bool { 4185 if len(a) != len(b) { 4186 return false 4187 } 4188 for i := 0; i < len(a); i++ { 4189 if !EqualsVindexParam(a[i], b[i]) { 4190 return false 4191 } 4192 } 4193 return true 4194 } 4195 4196 // EqualsSliceOfRefOfCommonTableExpr does deep equals between the two objects. 4197 func EqualsSliceOfRefOfCommonTableExpr(a, b []*CommonTableExpr) bool { 4198 if len(a) != len(b) { 4199 return false 4200 } 4201 for i := 0; i < len(a); i++ { 4202 if !EqualsRefOfCommonTableExpr(a[i], b[i]) { 4203 return false 4204 } 4205 } 4206 return true 4207 } 4208 4209 // EqualsCollateAndCharset does deep equals between the two objects. 4210 func EqualsCollateAndCharset(a, b CollateAndCharset) bool { 4211 return a.IsDefault == b.IsDefault && 4212 a.Value == b.Value && 4213 a.Type == b.Type 4214 } 4215 4216 // EqualsRefOfIndexColumn does deep equals between the two objects. 4217 func EqualsRefOfIndexColumn(a, b *IndexColumn) bool { 4218 if a == b { 4219 return true 4220 } 4221 if a == nil || b == nil { 4222 return false 4223 } 4224 return EqualsColIdent(a.Column, b.Column) && 4225 EqualsRefOfLiteral(a.Length, b.Length) && 4226 a.Direction == b.Direction 4227 } 4228 4229 // EqualsRefOfIndexOption does deep equals between the two objects. 4230 func EqualsRefOfIndexOption(a, b *IndexOption) bool { 4231 if a == b { 4232 return true 4233 } 4234 if a == nil || b == nil { 4235 return false 4236 } 4237 return a.Name == b.Name && 4238 a.String == b.String && 4239 EqualsRefOfLiteral(a.Value, b.Value) 4240 } 4241 4242 // EqualsRefOfTableAndLockType does deep equals between the two objects. 4243 func EqualsRefOfTableAndLockType(a, b *TableAndLockType) bool { 4244 if a == b { 4245 return true 4246 } 4247 if a == nil || b == nil { 4248 return false 4249 } 4250 return EqualsTableExpr(a.Table, b.Table) && 4251 a.Lock == b.Lock 4252 } 4253 4254 // EqualsRefOfRenameTablePair does deep equals between the two objects. 4255 func EqualsRefOfRenameTablePair(a, b *RenameTablePair) bool { 4256 if a == b { 4257 return true 4258 } 4259 if a == nil || b == nil { 4260 return false 4261 } 4262 return EqualsTableName(a.FromTable, b.FromTable) && 4263 EqualsTableName(a.ToTable, b.ToTable) 4264 } 4265 4266 // EqualsRefOfCollateAndCharset does deep equals between the two objects. 4267 func EqualsRefOfCollateAndCharset(a, b *CollateAndCharset) bool { 4268 if a == b { 4269 return true 4270 } 4271 if a == nil || b == nil { 4272 return false 4273 } 4274 return a.IsDefault == b.IsDefault && 4275 a.Value == b.Value && 4276 a.Type == b.Type 4277 }