github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/trace/sql_gtrace.go (about) 1 // Code generated by gtrace. DO NOT EDIT. 2 3 package trace 4 5 import ( 6 "context" 7 "time" 8 ) 9 10 // databaseSQLComposeOptions is a holder of options 11 type databaseSQLComposeOptions struct { 12 panicCallback func(e interface{}) 13 } 14 15 // DatabaseSQLOption specified DatabaseSQL compose option 16 type DatabaseSQLComposeOption func(o *databaseSQLComposeOptions) 17 18 // WithDatabaseSQLPanicCallback specified behavior on panic 19 func WithDatabaseSQLPanicCallback(cb func(e interface{})) DatabaseSQLComposeOption { 20 return func(o *databaseSQLComposeOptions) { 21 o.panicCallback = cb 22 } 23 } 24 25 // Compose returns a new DatabaseSQL which has functional fields composed both from t and x. 26 func (t *DatabaseSQL) Compose(x *DatabaseSQL, opts ...DatabaseSQLComposeOption) *DatabaseSQL { 27 var ret DatabaseSQL 28 options := databaseSQLComposeOptions{} 29 for _, opt := range opts { 30 if opt != nil { 31 opt(&options) 32 } 33 } 34 { 35 h1 := t.OnConnectorConnect 36 h2 := x.OnConnectorConnect 37 ret.OnConnectorConnect = func(d DatabaseSQLConnectorConnectStartInfo) func(DatabaseSQLConnectorConnectDoneInfo) { 38 if options.panicCallback != nil { 39 defer func() { 40 if e := recover(); e != nil { 41 options.panicCallback(e) 42 } 43 }() 44 } 45 var r, r1 func(DatabaseSQLConnectorConnectDoneInfo) 46 if h1 != nil { 47 r = h1(d) 48 } 49 if h2 != nil { 50 r1 = h2(d) 51 } 52 return func(d DatabaseSQLConnectorConnectDoneInfo) { 53 if options.panicCallback != nil { 54 defer func() { 55 if e := recover(); e != nil { 56 options.panicCallback(e) 57 } 58 }() 59 } 60 if r != nil { 61 r(d) 62 } 63 if r1 != nil { 64 r1(d) 65 } 66 } 67 } 68 } 69 { 70 h1 := t.OnConnPing 71 h2 := x.OnConnPing 72 ret.OnConnPing = func(d DatabaseSQLConnPingStartInfo) func(DatabaseSQLConnPingDoneInfo) { 73 if options.panicCallback != nil { 74 defer func() { 75 if e := recover(); e != nil { 76 options.panicCallback(e) 77 } 78 }() 79 } 80 var r, r1 func(DatabaseSQLConnPingDoneInfo) 81 if h1 != nil { 82 r = h1(d) 83 } 84 if h2 != nil { 85 r1 = h2(d) 86 } 87 return func(d DatabaseSQLConnPingDoneInfo) { 88 if options.panicCallback != nil { 89 defer func() { 90 if e := recover(); e != nil { 91 options.panicCallback(e) 92 } 93 }() 94 } 95 if r != nil { 96 r(d) 97 } 98 if r1 != nil { 99 r1(d) 100 } 101 } 102 } 103 } 104 { 105 h1 := t.OnConnPrepare 106 h2 := x.OnConnPrepare 107 ret.OnConnPrepare = func(d DatabaseSQLConnPrepareStartInfo) func(DatabaseSQLConnPrepareDoneInfo) { 108 if options.panicCallback != nil { 109 defer func() { 110 if e := recover(); e != nil { 111 options.panicCallback(e) 112 } 113 }() 114 } 115 var r, r1 func(DatabaseSQLConnPrepareDoneInfo) 116 if h1 != nil { 117 r = h1(d) 118 } 119 if h2 != nil { 120 r1 = h2(d) 121 } 122 return func(d DatabaseSQLConnPrepareDoneInfo) { 123 if options.panicCallback != nil { 124 defer func() { 125 if e := recover(); e != nil { 126 options.panicCallback(e) 127 } 128 }() 129 } 130 if r != nil { 131 r(d) 132 } 133 if r1 != nil { 134 r1(d) 135 } 136 } 137 } 138 } 139 { 140 h1 := t.OnConnClose 141 h2 := x.OnConnClose 142 ret.OnConnClose = func(d DatabaseSQLConnCloseStartInfo) func(DatabaseSQLConnCloseDoneInfo) { 143 if options.panicCallback != nil { 144 defer func() { 145 if e := recover(); e != nil { 146 options.panicCallback(e) 147 } 148 }() 149 } 150 var r, r1 func(DatabaseSQLConnCloseDoneInfo) 151 if h1 != nil { 152 r = h1(d) 153 } 154 if h2 != nil { 155 r1 = h2(d) 156 } 157 return func(d DatabaseSQLConnCloseDoneInfo) { 158 if options.panicCallback != nil { 159 defer func() { 160 if e := recover(); e != nil { 161 options.panicCallback(e) 162 } 163 }() 164 } 165 if r != nil { 166 r(d) 167 } 168 if r1 != nil { 169 r1(d) 170 } 171 } 172 } 173 } 174 { 175 h1 := t.OnConnBegin 176 h2 := x.OnConnBegin 177 ret.OnConnBegin = func(d DatabaseSQLConnBeginStartInfo) func(DatabaseSQLConnBeginDoneInfo) { 178 if options.panicCallback != nil { 179 defer func() { 180 if e := recover(); e != nil { 181 options.panicCallback(e) 182 } 183 }() 184 } 185 var r, r1 func(DatabaseSQLConnBeginDoneInfo) 186 if h1 != nil { 187 r = h1(d) 188 } 189 if h2 != nil { 190 r1 = h2(d) 191 } 192 return func(d DatabaseSQLConnBeginDoneInfo) { 193 if options.panicCallback != nil { 194 defer func() { 195 if e := recover(); e != nil { 196 options.panicCallback(e) 197 } 198 }() 199 } 200 if r != nil { 201 r(d) 202 } 203 if r1 != nil { 204 r1(d) 205 } 206 } 207 } 208 } 209 { 210 h1 := t.OnConnQuery 211 h2 := x.OnConnQuery 212 ret.OnConnQuery = func(d DatabaseSQLConnQueryStartInfo) func(DatabaseSQLConnQueryDoneInfo) { 213 if options.panicCallback != nil { 214 defer func() { 215 if e := recover(); e != nil { 216 options.panicCallback(e) 217 } 218 }() 219 } 220 var r, r1 func(DatabaseSQLConnQueryDoneInfo) 221 if h1 != nil { 222 r = h1(d) 223 } 224 if h2 != nil { 225 r1 = h2(d) 226 } 227 return func(d DatabaseSQLConnQueryDoneInfo) { 228 if options.panicCallback != nil { 229 defer func() { 230 if e := recover(); e != nil { 231 options.panicCallback(e) 232 } 233 }() 234 } 235 if r != nil { 236 r(d) 237 } 238 if r1 != nil { 239 r1(d) 240 } 241 } 242 } 243 } 244 { 245 h1 := t.OnConnExec 246 h2 := x.OnConnExec 247 ret.OnConnExec = func(d DatabaseSQLConnExecStartInfo) func(DatabaseSQLConnExecDoneInfo) { 248 if options.panicCallback != nil { 249 defer func() { 250 if e := recover(); e != nil { 251 options.panicCallback(e) 252 } 253 }() 254 } 255 var r, r1 func(DatabaseSQLConnExecDoneInfo) 256 if h1 != nil { 257 r = h1(d) 258 } 259 if h2 != nil { 260 r1 = h2(d) 261 } 262 return func(d DatabaseSQLConnExecDoneInfo) { 263 if options.panicCallback != nil { 264 defer func() { 265 if e := recover(); e != nil { 266 options.panicCallback(e) 267 } 268 }() 269 } 270 if r != nil { 271 r(d) 272 } 273 if r1 != nil { 274 r1(d) 275 } 276 } 277 } 278 } 279 { 280 h1 := t.OnConnIsTableExists 281 h2 := x.OnConnIsTableExists 282 ret.OnConnIsTableExists = func(d DatabaseSQLConnIsTableExistsStartInfo) func(DatabaseSQLConnIsTableExistsDoneInfo) { 283 if options.panicCallback != nil { 284 defer func() { 285 if e := recover(); e != nil { 286 options.panicCallback(e) 287 } 288 }() 289 } 290 var r, r1 func(DatabaseSQLConnIsTableExistsDoneInfo) 291 if h1 != nil { 292 r = h1(d) 293 } 294 if h2 != nil { 295 r1 = h2(d) 296 } 297 return func(d DatabaseSQLConnIsTableExistsDoneInfo) { 298 if options.panicCallback != nil { 299 defer func() { 300 if e := recover(); e != nil { 301 options.panicCallback(e) 302 } 303 }() 304 } 305 if r != nil { 306 r(d) 307 } 308 if r1 != nil { 309 r1(d) 310 } 311 } 312 } 313 } 314 { 315 h1 := t.OnTxQuery 316 h2 := x.OnTxQuery 317 ret.OnTxQuery = func(d DatabaseSQLTxQueryStartInfo) func(DatabaseSQLTxQueryDoneInfo) { 318 if options.panicCallback != nil { 319 defer func() { 320 if e := recover(); e != nil { 321 options.panicCallback(e) 322 } 323 }() 324 } 325 var r, r1 func(DatabaseSQLTxQueryDoneInfo) 326 if h1 != nil { 327 r = h1(d) 328 } 329 if h2 != nil { 330 r1 = h2(d) 331 } 332 return func(d DatabaseSQLTxQueryDoneInfo) { 333 if options.panicCallback != nil { 334 defer func() { 335 if e := recover(); e != nil { 336 options.panicCallback(e) 337 } 338 }() 339 } 340 if r != nil { 341 r(d) 342 } 343 if r1 != nil { 344 r1(d) 345 } 346 } 347 } 348 } 349 { 350 h1 := t.OnTxExec 351 h2 := x.OnTxExec 352 ret.OnTxExec = func(d DatabaseSQLTxExecStartInfo) func(DatabaseSQLTxExecDoneInfo) { 353 if options.panicCallback != nil { 354 defer func() { 355 if e := recover(); e != nil { 356 options.panicCallback(e) 357 } 358 }() 359 } 360 var r, r1 func(DatabaseSQLTxExecDoneInfo) 361 if h1 != nil { 362 r = h1(d) 363 } 364 if h2 != nil { 365 r1 = h2(d) 366 } 367 return func(d DatabaseSQLTxExecDoneInfo) { 368 if options.panicCallback != nil { 369 defer func() { 370 if e := recover(); e != nil { 371 options.panicCallback(e) 372 } 373 }() 374 } 375 if r != nil { 376 r(d) 377 } 378 if r1 != nil { 379 r1(d) 380 } 381 } 382 } 383 } 384 { 385 h1 := t.OnTxPrepare 386 h2 := x.OnTxPrepare 387 ret.OnTxPrepare = func(d DatabaseSQLTxPrepareStartInfo) func(DatabaseSQLTxPrepareDoneInfo) { 388 if options.panicCallback != nil { 389 defer func() { 390 if e := recover(); e != nil { 391 options.panicCallback(e) 392 } 393 }() 394 } 395 var r, r1 func(DatabaseSQLTxPrepareDoneInfo) 396 if h1 != nil { 397 r = h1(d) 398 } 399 if h2 != nil { 400 r1 = h2(d) 401 } 402 return func(d DatabaseSQLTxPrepareDoneInfo) { 403 if options.panicCallback != nil { 404 defer func() { 405 if e := recover(); e != nil { 406 options.panicCallback(e) 407 } 408 }() 409 } 410 if r != nil { 411 r(d) 412 } 413 if r1 != nil { 414 r1(d) 415 } 416 } 417 } 418 } 419 { 420 h1 := t.OnTxCommit 421 h2 := x.OnTxCommit 422 ret.OnTxCommit = func(d DatabaseSQLTxCommitStartInfo) func(DatabaseSQLTxCommitDoneInfo) { 423 if options.panicCallback != nil { 424 defer func() { 425 if e := recover(); e != nil { 426 options.panicCallback(e) 427 } 428 }() 429 } 430 var r, r1 func(DatabaseSQLTxCommitDoneInfo) 431 if h1 != nil { 432 r = h1(d) 433 } 434 if h2 != nil { 435 r1 = h2(d) 436 } 437 return func(d DatabaseSQLTxCommitDoneInfo) { 438 if options.panicCallback != nil { 439 defer func() { 440 if e := recover(); e != nil { 441 options.panicCallback(e) 442 } 443 }() 444 } 445 if r != nil { 446 r(d) 447 } 448 if r1 != nil { 449 r1(d) 450 } 451 } 452 } 453 } 454 { 455 h1 := t.OnTxRollback 456 h2 := x.OnTxRollback 457 ret.OnTxRollback = func(d DatabaseSQLTxRollbackStartInfo) func(DatabaseSQLTxRollbackDoneInfo) { 458 if options.panicCallback != nil { 459 defer func() { 460 if e := recover(); e != nil { 461 options.panicCallback(e) 462 } 463 }() 464 } 465 var r, r1 func(DatabaseSQLTxRollbackDoneInfo) 466 if h1 != nil { 467 r = h1(d) 468 } 469 if h2 != nil { 470 r1 = h2(d) 471 } 472 return func(d DatabaseSQLTxRollbackDoneInfo) { 473 if options.panicCallback != nil { 474 defer func() { 475 if e := recover(); e != nil { 476 options.panicCallback(e) 477 } 478 }() 479 } 480 if r != nil { 481 r(d) 482 } 483 if r1 != nil { 484 r1(d) 485 } 486 } 487 } 488 } 489 { 490 h1 := t.OnStmtQuery 491 h2 := x.OnStmtQuery 492 ret.OnStmtQuery = func(d DatabaseSQLStmtQueryStartInfo) func(DatabaseSQLStmtQueryDoneInfo) { 493 if options.panicCallback != nil { 494 defer func() { 495 if e := recover(); e != nil { 496 options.panicCallback(e) 497 } 498 }() 499 } 500 var r, r1 func(DatabaseSQLStmtQueryDoneInfo) 501 if h1 != nil { 502 r = h1(d) 503 } 504 if h2 != nil { 505 r1 = h2(d) 506 } 507 return func(d DatabaseSQLStmtQueryDoneInfo) { 508 if options.panicCallback != nil { 509 defer func() { 510 if e := recover(); e != nil { 511 options.panicCallback(e) 512 } 513 }() 514 } 515 if r != nil { 516 r(d) 517 } 518 if r1 != nil { 519 r1(d) 520 } 521 } 522 } 523 } 524 { 525 h1 := t.OnStmtExec 526 h2 := x.OnStmtExec 527 ret.OnStmtExec = func(d DatabaseSQLStmtExecStartInfo) func(DatabaseSQLStmtExecDoneInfo) { 528 if options.panicCallback != nil { 529 defer func() { 530 if e := recover(); e != nil { 531 options.panicCallback(e) 532 } 533 }() 534 } 535 var r, r1 func(DatabaseSQLStmtExecDoneInfo) 536 if h1 != nil { 537 r = h1(d) 538 } 539 if h2 != nil { 540 r1 = h2(d) 541 } 542 return func(d DatabaseSQLStmtExecDoneInfo) { 543 if options.panicCallback != nil { 544 defer func() { 545 if e := recover(); e != nil { 546 options.panicCallback(e) 547 } 548 }() 549 } 550 if r != nil { 551 r(d) 552 } 553 if r1 != nil { 554 r1(d) 555 } 556 } 557 } 558 } 559 { 560 h1 := t.OnStmtClose 561 h2 := x.OnStmtClose 562 ret.OnStmtClose = func(d DatabaseSQLStmtCloseStartInfo) func(DatabaseSQLStmtCloseDoneInfo) { 563 if options.panicCallback != nil { 564 defer func() { 565 if e := recover(); e != nil { 566 options.panicCallback(e) 567 } 568 }() 569 } 570 var r, r1 func(DatabaseSQLStmtCloseDoneInfo) 571 if h1 != nil { 572 r = h1(d) 573 } 574 if h2 != nil { 575 r1 = h2(d) 576 } 577 return func(d DatabaseSQLStmtCloseDoneInfo) { 578 if options.panicCallback != nil { 579 defer func() { 580 if e := recover(); e != nil { 581 options.panicCallback(e) 582 } 583 }() 584 } 585 if r != nil { 586 r(d) 587 } 588 if r1 != nil { 589 r1(d) 590 } 591 } 592 } 593 } 594 { 595 h1 := t.OnDoTx 596 h2 := x.OnDoTx 597 ret.OnDoTx = func(d DatabaseSQLDoTxStartInfo) func(DatabaseSQLDoTxIntermediateInfo) func(DatabaseSQLDoTxDoneInfo) { 598 if options.panicCallback != nil { 599 defer func() { 600 if e := recover(); e != nil { 601 options.panicCallback(e) 602 } 603 }() 604 } 605 var r, r1 func(DatabaseSQLDoTxIntermediateInfo) func(DatabaseSQLDoTxDoneInfo) 606 if h1 != nil { 607 r = h1(d) 608 } 609 if h2 != nil { 610 r1 = h2(d) 611 } 612 return func(d DatabaseSQLDoTxIntermediateInfo) func(DatabaseSQLDoTxDoneInfo) { 613 if options.panicCallback != nil { 614 defer func() { 615 if e := recover(); e != nil { 616 options.panicCallback(e) 617 } 618 }() 619 } 620 var r2, r3 func(DatabaseSQLDoTxDoneInfo) 621 if r != nil { 622 r2 = r(d) 623 } 624 if r1 != nil { 625 r3 = r1(d) 626 } 627 return func(d DatabaseSQLDoTxDoneInfo) { 628 if options.panicCallback != nil { 629 defer func() { 630 if e := recover(); e != nil { 631 options.panicCallback(e) 632 } 633 }() 634 } 635 if r2 != nil { 636 r2(d) 637 } 638 if r3 != nil { 639 r3(d) 640 } 641 } 642 } 643 } 644 } 645 return &ret 646 } 647 func (t *DatabaseSQL) onConnectorConnect(d DatabaseSQLConnectorConnectStartInfo) func(DatabaseSQLConnectorConnectDoneInfo) { 648 fn := t.OnConnectorConnect 649 if fn == nil { 650 return func(DatabaseSQLConnectorConnectDoneInfo) { 651 return 652 } 653 } 654 res := fn(d) 655 if res == nil { 656 return func(DatabaseSQLConnectorConnectDoneInfo) { 657 return 658 } 659 } 660 return res 661 } 662 func (t *DatabaseSQL) onConnPing(d DatabaseSQLConnPingStartInfo) func(DatabaseSQLConnPingDoneInfo) { 663 fn := t.OnConnPing 664 if fn == nil { 665 return func(DatabaseSQLConnPingDoneInfo) { 666 return 667 } 668 } 669 res := fn(d) 670 if res == nil { 671 return func(DatabaseSQLConnPingDoneInfo) { 672 return 673 } 674 } 675 return res 676 } 677 func (t *DatabaseSQL) onConnPrepare(d DatabaseSQLConnPrepareStartInfo) func(DatabaseSQLConnPrepareDoneInfo) { 678 fn := t.OnConnPrepare 679 if fn == nil { 680 return func(DatabaseSQLConnPrepareDoneInfo) { 681 return 682 } 683 } 684 res := fn(d) 685 if res == nil { 686 return func(DatabaseSQLConnPrepareDoneInfo) { 687 return 688 } 689 } 690 return res 691 } 692 func (t *DatabaseSQL) onConnClose(d DatabaseSQLConnCloseStartInfo) func(DatabaseSQLConnCloseDoneInfo) { 693 fn := t.OnConnClose 694 if fn == nil { 695 return func(DatabaseSQLConnCloseDoneInfo) { 696 return 697 } 698 } 699 res := fn(d) 700 if res == nil { 701 return func(DatabaseSQLConnCloseDoneInfo) { 702 return 703 } 704 } 705 return res 706 } 707 func (t *DatabaseSQL) onConnBegin(d DatabaseSQLConnBeginStartInfo) func(DatabaseSQLConnBeginDoneInfo) { 708 fn := t.OnConnBegin 709 if fn == nil { 710 return func(DatabaseSQLConnBeginDoneInfo) { 711 return 712 } 713 } 714 res := fn(d) 715 if res == nil { 716 return func(DatabaseSQLConnBeginDoneInfo) { 717 return 718 } 719 } 720 return res 721 } 722 func (t *DatabaseSQL) onConnQuery(d DatabaseSQLConnQueryStartInfo) func(DatabaseSQLConnQueryDoneInfo) { 723 fn := t.OnConnQuery 724 if fn == nil { 725 return func(DatabaseSQLConnQueryDoneInfo) { 726 return 727 } 728 } 729 res := fn(d) 730 if res == nil { 731 return func(DatabaseSQLConnQueryDoneInfo) { 732 return 733 } 734 } 735 return res 736 } 737 func (t *DatabaseSQL) onConnExec(d DatabaseSQLConnExecStartInfo) func(DatabaseSQLConnExecDoneInfo) { 738 fn := t.OnConnExec 739 if fn == nil { 740 return func(DatabaseSQLConnExecDoneInfo) { 741 return 742 } 743 } 744 res := fn(d) 745 if res == nil { 746 return func(DatabaseSQLConnExecDoneInfo) { 747 return 748 } 749 } 750 return res 751 } 752 func (t *DatabaseSQL) onConnIsTableExists(d DatabaseSQLConnIsTableExistsStartInfo) func(DatabaseSQLConnIsTableExistsDoneInfo) { 753 fn := t.OnConnIsTableExists 754 if fn == nil { 755 return func(DatabaseSQLConnIsTableExistsDoneInfo) { 756 return 757 } 758 } 759 res := fn(d) 760 if res == nil { 761 return func(DatabaseSQLConnIsTableExistsDoneInfo) { 762 return 763 } 764 } 765 return res 766 } 767 func (t *DatabaseSQL) onTxQuery(d DatabaseSQLTxQueryStartInfo) func(DatabaseSQLTxQueryDoneInfo) { 768 fn := t.OnTxQuery 769 if fn == nil { 770 return func(DatabaseSQLTxQueryDoneInfo) { 771 return 772 } 773 } 774 res := fn(d) 775 if res == nil { 776 return func(DatabaseSQLTxQueryDoneInfo) { 777 return 778 } 779 } 780 return res 781 } 782 func (t *DatabaseSQL) onTxExec(d DatabaseSQLTxExecStartInfo) func(DatabaseSQLTxExecDoneInfo) { 783 fn := t.OnTxExec 784 if fn == nil { 785 return func(DatabaseSQLTxExecDoneInfo) { 786 return 787 } 788 } 789 res := fn(d) 790 if res == nil { 791 return func(DatabaseSQLTxExecDoneInfo) { 792 return 793 } 794 } 795 return res 796 } 797 func (t *DatabaseSQL) onTxPrepare(d DatabaseSQLTxPrepareStartInfo) func(DatabaseSQLTxPrepareDoneInfo) { 798 fn := t.OnTxPrepare 799 if fn == nil { 800 return func(DatabaseSQLTxPrepareDoneInfo) { 801 return 802 } 803 } 804 res := fn(d) 805 if res == nil { 806 return func(DatabaseSQLTxPrepareDoneInfo) { 807 return 808 } 809 } 810 return res 811 } 812 func (t *DatabaseSQL) onTxCommit(d DatabaseSQLTxCommitStartInfo) func(DatabaseSQLTxCommitDoneInfo) { 813 fn := t.OnTxCommit 814 if fn == nil { 815 return func(DatabaseSQLTxCommitDoneInfo) { 816 return 817 } 818 } 819 res := fn(d) 820 if res == nil { 821 return func(DatabaseSQLTxCommitDoneInfo) { 822 return 823 } 824 } 825 return res 826 } 827 func (t *DatabaseSQL) onTxRollback(d DatabaseSQLTxRollbackStartInfo) func(DatabaseSQLTxRollbackDoneInfo) { 828 fn := t.OnTxRollback 829 if fn == nil { 830 return func(DatabaseSQLTxRollbackDoneInfo) { 831 return 832 } 833 } 834 res := fn(d) 835 if res == nil { 836 return func(DatabaseSQLTxRollbackDoneInfo) { 837 return 838 } 839 } 840 return res 841 } 842 func (t *DatabaseSQL) onStmtQuery(d DatabaseSQLStmtQueryStartInfo) func(DatabaseSQLStmtQueryDoneInfo) { 843 fn := t.OnStmtQuery 844 if fn == nil { 845 return func(DatabaseSQLStmtQueryDoneInfo) { 846 return 847 } 848 } 849 res := fn(d) 850 if res == nil { 851 return func(DatabaseSQLStmtQueryDoneInfo) { 852 return 853 } 854 } 855 return res 856 } 857 func (t *DatabaseSQL) onStmtExec(d DatabaseSQLStmtExecStartInfo) func(DatabaseSQLStmtExecDoneInfo) { 858 fn := t.OnStmtExec 859 if fn == nil { 860 return func(DatabaseSQLStmtExecDoneInfo) { 861 return 862 } 863 } 864 res := fn(d) 865 if res == nil { 866 return func(DatabaseSQLStmtExecDoneInfo) { 867 return 868 } 869 } 870 return res 871 } 872 func (t *DatabaseSQL) onStmtClose(d DatabaseSQLStmtCloseStartInfo) func(DatabaseSQLStmtCloseDoneInfo) { 873 fn := t.OnStmtClose 874 if fn == nil { 875 return func(DatabaseSQLStmtCloseDoneInfo) { 876 return 877 } 878 } 879 res := fn(d) 880 if res == nil { 881 return func(DatabaseSQLStmtCloseDoneInfo) { 882 return 883 } 884 } 885 return res 886 } 887 func (t *DatabaseSQL) onDoTx(d DatabaseSQLDoTxStartInfo) func(DatabaseSQLDoTxIntermediateInfo) func(DatabaseSQLDoTxDoneInfo) { 888 fn := t.OnDoTx 889 if fn == nil { 890 return func(DatabaseSQLDoTxIntermediateInfo) func(DatabaseSQLDoTxDoneInfo) { 891 return func(DatabaseSQLDoTxDoneInfo) { 892 return 893 } 894 } 895 } 896 res := fn(d) 897 if res == nil { 898 return func(DatabaseSQLDoTxIntermediateInfo) func(DatabaseSQLDoTxDoneInfo) { 899 return func(DatabaseSQLDoTxDoneInfo) { 900 return 901 } 902 } 903 } 904 return func(d DatabaseSQLDoTxIntermediateInfo) func(DatabaseSQLDoTxDoneInfo) { 905 res := res(d) 906 if res == nil { 907 return func(DatabaseSQLDoTxDoneInfo) { 908 return 909 } 910 } 911 return res 912 } 913 } 914 func DatabaseSQLOnConnectorConnect(t *DatabaseSQL, c *context.Context, call call) func(_ error, session tableSessionInfo) { 915 var p DatabaseSQLConnectorConnectStartInfo 916 p.Context = c 917 p.Call = call 918 res := t.onConnectorConnect(p) 919 return func(e error, session tableSessionInfo) { 920 var p DatabaseSQLConnectorConnectDoneInfo 921 p.Error = e 922 p.Session = session 923 res(p) 924 } 925 } 926 func DatabaseSQLOnConnPing(t *DatabaseSQL, c *context.Context, call call) func(error) { 927 var p DatabaseSQLConnPingStartInfo 928 p.Context = c 929 p.Call = call 930 res := t.onConnPing(p) 931 return func(e error) { 932 var p DatabaseSQLConnPingDoneInfo 933 p.Error = e 934 res(p) 935 } 936 } 937 func DatabaseSQLOnConnPrepare(t *DatabaseSQL, c *context.Context, call call, query string) func(error) { 938 var p DatabaseSQLConnPrepareStartInfo 939 p.Context = c 940 p.Call = call 941 p.Query = query 942 res := t.onConnPrepare(p) 943 return func(e error) { 944 var p DatabaseSQLConnPrepareDoneInfo 945 p.Error = e 946 res(p) 947 } 948 } 949 func DatabaseSQLOnConnClose(t *DatabaseSQL, c *context.Context, call call) func(error) { 950 var p DatabaseSQLConnCloseStartInfo 951 p.Context = c 952 p.Call = call 953 res := t.onConnClose(p) 954 return func(e error) { 955 var p DatabaseSQLConnCloseDoneInfo 956 p.Error = e 957 res(p) 958 } 959 } 960 func DatabaseSQLOnConnBegin(t *DatabaseSQL, c *context.Context, call call) func(tx tableTransactionInfo, _ error) { 961 var p DatabaseSQLConnBeginStartInfo 962 p.Context = c 963 p.Call = call 964 res := t.onConnBegin(p) 965 return func(tx tableTransactionInfo, e error) { 966 var p DatabaseSQLConnBeginDoneInfo 967 p.Tx = tx 968 p.Error = e 969 res(p) 970 } 971 } 972 func DatabaseSQLOnConnQuery(t *DatabaseSQL, c *context.Context, call call, query string, mode string, idempotent bool, idleTime time.Duration) func(error) { 973 var p DatabaseSQLConnQueryStartInfo 974 p.Context = c 975 p.Call = call 976 p.Query = query 977 p.Mode = mode 978 p.Idempotent = idempotent 979 p.IdleTime = idleTime 980 res := t.onConnQuery(p) 981 return func(e error) { 982 var p DatabaseSQLConnQueryDoneInfo 983 p.Error = e 984 res(p) 985 } 986 } 987 func DatabaseSQLOnConnExec(t *DatabaseSQL, c *context.Context, call call, query string, mode string, idempotent bool, idleTime time.Duration) func(error) { 988 var p DatabaseSQLConnExecStartInfo 989 p.Context = c 990 p.Call = call 991 p.Query = query 992 p.Mode = mode 993 p.Idempotent = idempotent 994 p.IdleTime = idleTime 995 res := t.onConnExec(p) 996 return func(e error) { 997 var p DatabaseSQLConnExecDoneInfo 998 p.Error = e 999 res(p) 1000 } 1001 } 1002 func DatabaseSQLOnConnIsTableExists(t *DatabaseSQL, c *context.Context, call call, tableName string) func(exists bool, _ error) { 1003 var p DatabaseSQLConnIsTableExistsStartInfo 1004 p.Context = c 1005 p.Call = call 1006 p.TableName = tableName 1007 res := t.onConnIsTableExists(p) 1008 return func(exists bool, e error) { 1009 var p DatabaseSQLConnIsTableExistsDoneInfo 1010 p.Exists = exists 1011 p.Error = e 1012 res(p) 1013 } 1014 } 1015 func DatabaseSQLOnTxQuery(t *DatabaseSQL, c *context.Context, call call, txContext context.Context, tx tableTransactionInfo, query string, idempotent bool) func(error) { 1016 var p DatabaseSQLTxQueryStartInfo 1017 p.Context = c 1018 p.Call = call 1019 p.TxContext = txContext 1020 p.Tx = tx 1021 p.Query = query 1022 p.Idempotent = idempotent 1023 res := t.onTxQuery(p) 1024 return func(e error) { 1025 var p DatabaseSQLTxQueryDoneInfo 1026 p.Error = e 1027 res(p) 1028 } 1029 } 1030 func DatabaseSQLOnTxExec(t *DatabaseSQL, c *context.Context, call call, txContext context.Context, tx tableTransactionInfo, query string, idempotent bool) func(error) { 1031 var p DatabaseSQLTxExecStartInfo 1032 p.Context = c 1033 p.Call = call 1034 p.TxContext = txContext 1035 p.Tx = tx 1036 p.Query = query 1037 p.Idempotent = idempotent 1038 res := t.onTxExec(p) 1039 return func(e error) { 1040 var p DatabaseSQLTxExecDoneInfo 1041 p.Error = e 1042 res(p) 1043 } 1044 } 1045 func DatabaseSQLOnTxPrepare(t *DatabaseSQL, c *context.Context, call call, txContext *context.Context, tx tableTransactionInfo, query string) func(error) { 1046 var p DatabaseSQLTxPrepareStartInfo 1047 p.Context = c 1048 p.Call = call 1049 p.TxContext = txContext 1050 p.Tx = tx 1051 p.Query = query 1052 res := t.onTxPrepare(p) 1053 return func(e error) { 1054 var p DatabaseSQLTxPrepareDoneInfo 1055 p.Error = e 1056 res(p) 1057 } 1058 } 1059 func DatabaseSQLOnTxCommit(t *DatabaseSQL, c *context.Context, call call, tx tableTransactionInfo) func(error) { 1060 var p DatabaseSQLTxCommitStartInfo 1061 p.Context = c 1062 p.Call = call 1063 p.Tx = tx 1064 res := t.onTxCommit(p) 1065 return func(e error) { 1066 var p DatabaseSQLTxCommitDoneInfo 1067 p.Error = e 1068 res(p) 1069 } 1070 } 1071 func DatabaseSQLOnTxRollback(t *DatabaseSQL, c *context.Context, call call, tx tableTransactionInfo) func(error) { 1072 var p DatabaseSQLTxRollbackStartInfo 1073 p.Context = c 1074 p.Call = call 1075 p.Tx = tx 1076 res := t.onTxRollback(p) 1077 return func(e error) { 1078 var p DatabaseSQLTxRollbackDoneInfo 1079 p.Error = e 1080 res(p) 1081 } 1082 } 1083 func DatabaseSQLOnStmtQuery(t *DatabaseSQL, c *context.Context, call call, stmtContext context.Context, query string) func(error) { 1084 var p DatabaseSQLStmtQueryStartInfo 1085 p.Context = c 1086 p.Call = call 1087 p.StmtContext = stmtContext 1088 p.Query = query 1089 res := t.onStmtQuery(p) 1090 return func(e error) { 1091 var p DatabaseSQLStmtQueryDoneInfo 1092 p.Error = e 1093 res(p) 1094 } 1095 } 1096 func DatabaseSQLOnStmtExec(t *DatabaseSQL, c *context.Context, call call, stmtContext context.Context, query string) func(error) { 1097 var p DatabaseSQLStmtExecStartInfo 1098 p.Context = c 1099 p.Call = call 1100 p.StmtContext = stmtContext 1101 p.Query = query 1102 res := t.onStmtExec(p) 1103 return func(e error) { 1104 var p DatabaseSQLStmtExecDoneInfo 1105 p.Error = e 1106 res(p) 1107 } 1108 } 1109 func DatabaseSQLOnStmtClose(t *DatabaseSQL, stmtContext *context.Context, call call) func(error) { 1110 var p DatabaseSQLStmtCloseStartInfo 1111 p.StmtContext = stmtContext 1112 p.Call = call 1113 res := t.onStmtClose(p) 1114 return func(e error) { 1115 var p DatabaseSQLStmtCloseDoneInfo 1116 p.Error = e 1117 res(p) 1118 } 1119 } 1120 func DatabaseSQLOnDoTx(t *DatabaseSQL, c *context.Context, call call, iD string, idempotent bool) func(error) func(attempts int, _ error) { 1121 var p DatabaseSQLDoTxStartInfo 1122 p.Context = c 1123 p.Call = call 1124 p.ID = iD 1125 p.Idempotent = idempotent 1126 res := t.onDoTx(p) 1127 return func(e error) func(int, error) { 1128 var p DatabaseSQLDoTxIntermediateInfo 1129 p.Error = e 1130 res := res(p) 1131 return func(attempts int, e error) { 1132 var p DatabaseSQLDoTxDoneInfo 1133 p.Attempts = attempts 1134 p.Error = e 1135 res(p) 1136 } 1137 } 1138 }