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