github.com/go-kivik/kivik/v4@v4.3.2/mockdb/dbexpectations_gen.go (about) 1 /* This file is auto-generated. Do not edit it! */ 2 3 package mockdb 4 5 import ( 6 "context" 7 "fmt" 8 "reflect" 9 "time" 10 11 kivik "github.com/go-kivik/kivik/v4" 12 "github.com/go-kivik/kivik/v4/driver" 13 ) 14 15 var _ = &driver.Attachment{} 16 var _ = reflect.Int 17 18 // ExpectedCompact represents an expectation for a call to DB.Compact(). 19 type ExpectedCompact struct { 20 commonExpectation 21 callback func(ctx context.Context) error 22 } 23 24 // WillExecute sets a callback function to be called with any inputs to the 25 // original function. Any values returned by the callback will be returned as 26 // if generated by the driver. 27 func (e *ExpectedCompact) WillExecute(cb func(ctx context.Context) error) *ExpectedCompact { 28 e.callback = cb 29 return e 30 } 31 32 // WillReturnError sets the error value that will be returned by the call to DB.Compact(). 33 func (e *ExpectedCompact) WillReturnError(err error) *ExpectedCompact { 34 e.err = err 35 return e 36 } 37 38 // WillDelay causes the call to DB.Compact() to delay. 39 func (e *ExpectedCompact) WillDelay(delay time.Duration) *ExpectedCompact { 40 e.delay = delay 41 return e 42 } 43 44 func (e *ExpectedCompact) met(_ expectation) bool { 45 return true 46 } 47 48 func (e *ExpectedCompact) method(v bool) string { 49 if !v { 50 return "DB.Compact()" 51 } 52 return fmt.Sprintf("DB(%s).Compact(ctx)", e.dbo().name) 53 } 54 55 // ExpectedCompactView represents an expectation for a call to DB.CompactView(). 56 type ExpectedCompactView struct { 57 commonExpectation 58 callback func(ctx context.Context, arg0 string) error 59 arg0 string 60 } 61 62 // WillExecute sets a callback function to be called with any inputs to the 63 // original function. Any values returned by the callback will be returned as 64 // if generated by the driver. 65 func (e *ExpectedCompactView) WillExecute(cb func(ctx context.Context, arg0 string) error) *ExpectedCompactView { 66 e.callback = cb 67 return e 68 } 69 70 // WillReturnError sets the error value that will be returned by the call to DB.CompactView(). 71 func (e *ExpectedCompactView) WillReturnError(err error) *ExpectedCompactView { 72 e.err = err 73 return e 74 } 75 76 // WillDelay causes the call to DB.CompactView() to delay. 77 func (e *ExpectedCompactView) WillDelay(delay time.Duration) *ExpectedCompactView { 78 e.delay = delay 79 return e 80 } 81 82 func (e *ExpectedCompactView) met(ex expectation) bool { 83 exp := ex.(*ExpectedCompactView) 84 if exp.arg0 != "" && exp.arg0 != e.arg0 { 85 return false 86 } 87 return true 88 } 89 90 func (e *ExpectedCompactView) method(v bool) string { 91 if !v { 92 return "DB.CompactView()" 93 } 94 arg0 := "?" 95 if e.arg0 != "" { 96 arg0 = fmt.Sprintf("%q", e.arg0) 97 } 98 return fmt.Sprintf("DB(%s).CompactView(ctx, %s)", e.dbo().name, arg0) 99 } 100 101 // ExpectedCopy represents an expectation for a call to DB.Copy(). 102 type ExpectedCopy struct { 103 commonExpectation 104 callback func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (string, error) 105 arg0 string 106 arg1 string 107 ret0 string 108 } 109 110 // WithOptions sets the expected options for the call to DB.Copy(). 111 func (e *ExpectedCopy) WithOptions(options ...kivik.Option) *ExpectedCopy { 112 e.options = multiOptions{e.options, multiOptions(options)} 113 return e 114 } 115 116 // WillExecute sets a callback function to be called with any inputs to the 117 // original function. Any values returned by the callback will be returned as 118 // if generated by the driver. 119 func (e *ExpectedCopy) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (string, error)) *ExpectedCopy { 120 e.callback = cb 121 return e 122 } 123 124 // WillReturn sets the values that will be returned by the call to DB.Copy(). 125 func (e *ExpectedCopy) WillReturn(ret0 string) *ExpectedCopy { 126 e.ret0 = ret0 127 return e 128 } 129 130 // WillReturnError sets the error value that will be returned by the call to DB.Copy(). 131 func (e *ExpectedCopy) WillReturnError(err error) *ExpectedCopy { 132 e.err = err 133 return e 134 } 135 136 // WillDelay causes the call to DB.Copy() to delay. 137 func (e *ExpectedCopy) WillDelay(delay time.Duration) *ExpectedCopy { 138 e.delay = delay 139 return e 140 } 141 142 func (e *ExpectedCopy) met(ex expectation) bool { 143 exp := ex.(*ExpectedCopy) 144 if exp.arg0 != "" && exp.arg0 != e.arg0 { 145 return false 146 } 147 if exp.arg1 != "" && exp.arg1 != e.arg1 { 148 return false 149 } 150 return true 151 } 152 153 func (e *ExpectedCopy) method(v bool) string { 154 if !v { 155 return "DB.Copy()" 156 } 157 arg0, arg1, options := "?", "?", formatOptions(e.options) 158 if e.arg0 != "" { 159 arg0 = fmt.Sprintf("%q", e.arg0) 160 } 161 if e.arg1 != "" { 162 arg1 = fmt.Sprintf("%q", e.arg1) 163 } 164 return fmt.Sprintf("DB(%s).Copy(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options) 165 } 166 167 // ExpectedCreateDoc represents an expectation for a call to DB.CreateDoc(). 168 type ExpectedCreateDoc struct { 169 commonExpectation 170 callback func(ctx context.Context, arg0 interface{}, options driver.Options) (string, string, error) 171 arg0 interface{} 172 ret0 string 173 ret1 string 174 } 175 176 // WithOptions sets the expected options for the call to DB.CreateDoc(). 177 func (e *ExpectedCreateDoc) WithOptions(options ...kivik.Option) *ExpectedCreateDoc { 178 e.options = multiOptions{e.options, multiOptions(options)} 179 return e 180 } 181 182 // WillExecute sets a callback function to be called with any inputs to the 183 // original function. Any values returned by the callback will be returned as 184 // if generated by the driver. 185 func (e *ExpectedCreateDoc) WillExecute(cb func(ctx context.Context, arg0 interface{}, options driver.Options) (string, string, error)) *ExpectedCreateDoc { 186 e.callback = cb 187 return e 188 } 189 190 // WillReturn sets the values that will be returned by the call to DB.CreateDoc(). 191 func (e *ExpectedCreateDoc) WillReturn(ret0 string, ret1 string) *ExpectedCreateDoc { 192 e.ret0 = ret0 193 e.ret1 = ret1 194 return e 195 } 196 197 // WillReturnError sets the error value that will be returned by the call to DB.CreateDoc(). 198 func (e *ExpectedCreateDoc) WillReturnError(err error) *ExpectedCreateDoc { 199 e.err = err 200 return e 201 } 202 203 // WillDelay causes the call to DB.CreateDoc() to delay. 204 func (e *ExpectedCreateDoc) WillDelay(delay time.Duration) *ExpectedCreateDoc { 205 e.delay = delay 206 return e 207 } 208 209 func (e *ExpectedCreateDoc) met(ex expectation) bool { 210 exp := ex.(*ExpectedCreateDoc) 211 if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) { 212 return false 213 } 214 return true 215 } 216 217 func (e *ExpectedCreateDoc) method(v bool) string { 218 if !v { 219 return "DB.CreateDoc()" 220 } 221 arg0, options := "?", formatOptions(e.options) 222 if e.arg0 != nil { 223 arg0 = fmt.Sprintf("%v", e.arg0) 224 } 225 return fmt.Sprintf("DB(%s).CreateDoc(ctx, %s, %s)", e.dbo().name, arg0, options) 226 } 227 228 // ExpectedCreateIndex represents an expectation for a call to DB.CreateIndex(). 229 type ExpectedCreateIndex struct { 230 commonExpectation 231 callback func(ctx context.Context, arg0 string, arg1 string, arg2 interface{}, options driver.Options) error 232 arg0 string 233 arg1 string 234 arg2 interface{} 235 } 236 237 // WithOptions sets the expected options for the call to DB.CreateIndex(). 238 func (e *ExpectedCreateIndex) WithOptions(options ...kivik.Option) *ExpectedCreateIndex { 239 e.options = multiOptions{e.options, multiOptions(options)} 240 return e 241 } 242 243 // WillExecute sets a callback function to be called with any inputs to the 244 // original function. Any values returned by the callback will be returned as 245 // if generated by the driver. 246 func (e *ExpectedCreateIndex) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, arg2 interface{}, options driver.Options) error) *ExpectedCreateIndex { 247 e.callback = cb 248 return e 249 } 250 251 // WillReturnError sets the error value that will be returned by the call to DB.CreateIndex(). 252 func (e *ExpectedCreateIndex) WillReturnError(err error) *ExpectedCreateIndex { 253 e.err = err 254 return e 255 } 256 257 // WillDelay causes the call to DB.CreateIndex() to delay. 258 func (e *ExpectedCreateIndex) WillDelay(delay time.Duration) *ExpectedCreateIndex { 259 e.delay = delay 260 return e 261 } 262 263 func (e *ExpectedCreateIndex) met(ex expectation) bool { 264 exp := ex.(*ExpectedCreateIndex) 265 if exp.arg0 != "" && exp.arg0 != e.arg0 { 266 return false 267 } 268 if exp.arg1 != "" && exp.arg1 != e.arg1 { 269 return false 270 } 271 if exp.arg2 != nil && !jsonMeets(exp.arg2, e.arg2) { 272 return false 273 } 274 return true 275 } 276 277 func (e *ExpectedCreateIndex) method(v bool) string { 278 if !v { 279 return "DB.CreateIndex()" 280 } 281 arg0, arg1, arg2, options := "?", "?", "?", formatOptions(e.options) 282 if e.arg0 != "" { 283 arg0 = fmt.Sprintf("%q", e.arg0) 284 } 285 if e.arg1 != "" { 286 arg1 = fmt.Sprintf("%q", e.arg1) 287 } 288 if e.arg2 != nil { 289 arg2 = fmt.Sprintf("%v", e.arg2) 290 } 291 return fmt.Sprintf("DB(%s).CreateIndex(ctx, %s, %s, %s, %s)", e.dbo().name, arg0, arg1, arg2, options) 292 } 293 294 // ExpectedDeleteIndex represents an expectation for a call to DB.DeleteIndex(). 295 type ExpectedDeleteIndex struct { 296 commonExpectation 297 callback func(ctx context.Context, arg0 string, arg1 string, options driver.Options) error 298 arg0 string 299 arg1 string 300 } 301 302 // WithOptions sets the expected options for the call to DB.DeleteIndex(). 303 func (e *ExpectedDeleteIndex) WithOptions(options ...kivik.Option) *ExpectedDeleteIndex { 304 e.options = multiOptions{e.options, multiOptions(options)} 305 return e 306 } 307 308 // WillExecute sets a callback function to be called with any inputs to the 309 // original function. Any values returned by the callback will be returned as 310 // if generated by the driver. 311 func (e *ExpectedDeleteIndex) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options driver.Options) error) *ExpectedDeleteIndex { 312 e.callback = cb 313 return e 314 } 315 316 // WillReturnError sets the error value that will be returned by the call to DB.DeleteIndex(). 317 func (e *ExpectedDeleteIndex) WillReturnError(err error) *ExpectedDeleteIndex { 318 e.err = err 319 return e 320 } 321 322 // WillDelay causes the call to DB.DeleteIndex() to delay. 323 func (e *ExpectedDeleteIndex) WillDelay(delay time.Duration) *ExpectedDeleteIndex { 324 e.delay = delay 325 return e 326 } 327 328 func (e *ExpectedDeleteIndex) met(ex expectation) bool { 329 exp := ex.(*ExpectedDeleteIndex) 330 if exp.arg0 != "" && exp.arg0 != e.arg0 { 331 return false 332 } 333 if exp.arg1 != "" && exp.arg1 != e.arg1 { 334 return false 335 } 336 return true 337 } 338 339 func (e *ExpectedDeleteIndex) method(v bool) string { 340 if !v { 341 return "DB.DeleteIndex()" 342 } 343 arg0, arg1, options := "?", "?", formatOptions(e.options) 344 if e.arg0 != "" { 345 arg0 = fmt.Sprintf("%q", e.arg0) 346 } 347 if e.arg1 != "" { 348 arg1 = fmt.Sprintf("%q", e.arg1) 349 } 350 return fmt.Sprintf("DB(%s).DeleteIndex(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options) 351 } 352 353 // ExpectedFlush represents an expectation for a call to DB.Flush(). 354 type ExpectedFlush struct { 355 commonExpectation 356 callback func(ctx context.Context) error 357 } 358 359 // WillExecute sets a callback function to be called with any inputs to the 360 // original function. Any values returned by the callback will be returned as 361 // if generated by the driver. 362 func (e *ExpectedFlush) WillExecute(cb func(ctx context.Context) error) *ExpectedFlush { 363 e.callback = cb 364 return e 365 } 366 367 // WillReturnError sets the error value that will be returned by the call to DB.Flush(). 368 func (e *ExpectedFlush) WillReturnError(err error) *ExpectedFlush { 369 e.err = err 370 return e 371 } 372 373 // WillDelay causes the call to DB.Flush() to delay. 374 func (e *ExpectedFlush) WillDelay(delay time.Duration) *ExpectedFlush { 375 e.delay = delay 376 return e 377 } 378 379 func (e *ExpectedFlush) met(_ expectation) bool { 380 return true 381 } 382 383 func (e *ExpectedFlush) method(v bool) string { 384 if !v { 385 return "DB.Flush()" 386 } 387 return fmt.Sprintf("DB(%s).Flush(ctx)", e.dbo().name) 388 } 389 390 // ExpectedGetRev represents an expectation for a call to DB.GetRev(). 391 type ExpectedGetRev struct { 392 commonExpectation 393 callback func(ctx context.Context, arg0 string, options driver.Options) (string, error) 394 arg0 string 395 ret0 string 396 } 397 398 // WithOptions sets the expected options for the call to DB.GetRev(). 399 func (e *ExpectedGetRev) WithOptions(options ...kivik.Option) *ExpectedGetRev { 400 e.options = multiOptions{e.options, multiOptions(options)} 401 return e 402 } 403 404 // WillExecute sets a callback function to be called with any inputs to the 405 // original function. Any values returned by the callback will be returned as 406 // if generated by the driver. 407 func (e *ExpectedGetRev) WillExecute(cb func(ctx context.Context, arg0 string, options driver.Options) (string, error)) *ExpectedGetRev { 408 e.callback = cb 409 return e 410 } 411 412 // WillReturn sets the values that will be returned by the call to DB.GetRev(). 413 func (e *ExpectedGetRev) WillReturn(ret0 string) *ExpectedGetRev { 414 e.ret0 = ret0 415 return e 416 } 417 418 // WillReturnError sets the error value that will be returned by the call to DB.GetRev(). 419 func (e *ExpectedGetRev) WillReturnError(err error) *ExpectedGetRev { 420 e.err = err 421 return e 422 } 423 424 // WillDelay causes the call to DB.GetRev() to delay. 425 func (e *ExpectedGetRev) WillDelay(delay time.Duration) *ExpectedGetRev { 426 e.delay = delay 427 return e 428 } 429 430 func (e *ExpectedGetRev) met(ex expectation) bool { 431 exp := ex.(*ExpectedGetRev) 432 if exp.arg0 != "" && exp.arg0 != e.arg0 { 433 return false 434 } 435 return true 436 } 437 438 func (e *ExpectedGetRev) method(v bool) string { 439 if !v { 440 return "DB.GetRev()" 441 } 442 arg0, options := "?", formatOptions(e.options) 443 if e.arg0 != "" { 444 arg0 = fmt.Sprintf("%q", e.arg0) 445 } 446 return fmt.Sprintf("DB(%s).GetRev(ctx, %s, %s)", e.dbo().name, arg0, options) 447 } 448 449 // ExpectedPut represents an expectation for a call to DB.Put(). 450 type ExpectedPut struct { 451 commonExpectation 452 callback func(ctx context.Context, arg0 string, arg1 interface{}, options driver.Options) (string, error) 453 arg0 string 454 arg1 interface{} 455 ret0 string 456 } 457 458 // WithOptions sets the expected options for the call to DB.Put(). 459 func (e *ExpectedPut) WithOptions(options ...kivik.Option) *ExpectedPut { 460 e.options = multiOptions{e.options, multiOptions(options)} 461 return e 462 } 463 464 // WillExecute sets a callback function to be called with any inputs to the 465 // original function. Any values returned by the callback will be returned as 466 // if generated by the driver. 467 func (e *ExpectedPut) WillExecute(cb func(ctx context.Context, arg0 string, arg1 interface{}, options driver.Options) (string, error)) *ExpectedPut { 468 e.callback = cb 469 return e 470 } 471 472 // WillReturn sets the values that will be returned by the call to DB.Put(). 473 func (e *ExpectedPut) WillReturn(ret0 string) *ExpectedPut { 474 e.ret0 = ret0 475 return e 476 } 477 478 // WillReturnError sets the error value that will be returned by the call to DB.Put(). 479 func (e *ExpectedPut) WillReturnError(err error) *ExpectedPut { 480 e.err = err 481 return e 482 } 483 484 // WillDelay causes the call to DB.Put() to delay. 485 func (e *ExpectedPut) WillDelay(delay time.Duration) *ExpectedPut { 486 e.delay = delay 487 return e 488 } 489 490 func (e *ExpectedPut) met(ex expectation) bool { 491 exp := ex.(*ExpectedPut) 492 if exp.arg0 != "" && exp.arg0 != e.arg0 { 493 return false 494 } 495 if exp.arg1 != nil && !jsonMeets(exp.arg1, e.arg1) { 496 return false 497 } 498 return true 499 } 500 501 func (e *ExpectedPut) method(v bool) string { 502 if !v { 503 return "DB.Put()" 504 } 505 arg0, arg1, options := "?", "?", formatOptions(e.options) 506 if e.arg0 != "" { 507 arg0 = fmt.Sprintf("%q", e.arg0) 508 } 509 if e.arg1 != nil { 510 arg1 = fmt.Sprintf("%v", e.arg1) 511 } 512 return fmt.Sprintf("DB(%s).Put(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options) 513 } 514 515 // ExpectedViewCleanup represents an expectation for a call to DB.ViewCleanup(). 516 type ExpectedViewCleanup struct { 517 commonExpectation 518 callback func(ctx context.Context) error 519 } 520 521 // WillExecute sets a callback function to be called with any inputs to the 522 // original function. Any values returned by the callback will be returned as 523 // if generated by the driver. 524 func (e *ExpectedViewCleanup) WillExecute(cb func(ctx context.Context) error) *ExpectedViewCleanup { 525 e.callback = cb 526 return e 527 } 528 529 // WillReturnError sets the error value that will be returned by the call to DB.ViewCleanup(). 530 func (e *ExpectedViewCleanup) WillReturnError(err error) *ExpectedViewCleanup { 531 e.err = err 532 return e 533 } 534 535 // WillDelay causes the call to DB.ViewCleanup() to delay. 536 func (e *ExpectedViewCleanup) WillDelay(delay time.Duration) *ExpectedViewCleanup { 537 e.delay = delay 538 return e 539 } 540 541 func (e *ExpectedViewCleanup) met(_ expectation) bool { 542 return true 543 } 544 545 func (e *ExpectedViewCleanup) method(v bool) string { 546 if !v { 547 return "DB.ViewCleanup()" 548 } 549 return fmt.Sprintf("DB(%s).ViewCleanup(ctx)", e.dbo().name) 550 } 551 552 // ExpectedAllDocs represents an expectation for a call to DB.AllDocs(). 553 type ExpectedAllDocs struct { 554 commonExpectation 555 callback func(ctx context.Context, options driver.Options) (driver.Rows, error) 556 ret0 *Rows 557 } 558 559 // WithOptions sets the expected options for the call to DB.AllDocs(). 560 func (e *ExpectedAllDocs) WithOptions(options ...kivik.Option) *ExpectedAllDocs { 561 e.options = multiOptions{e.options, multiOptions(options)} 562 return e 563 } 564 565 // WillExecute sets a callback function to be called with any inputs to the 566 // original function. Any values returned by the callback will be returned as 567 // if generated by the driver. 568 func (e *ExpectedAllDocs) WillExecute(cb func(ctx context.Context, options driver.Options) (driver.Rows, error)) *ExpectedAllDocs { 569 e.callback = cb 570 return e 571 } 572 573 // WillReturn sets the values that will be returned by the call to DB.AllDocs(). 574 func (e *ExpectedAllDocs) WillReturn(ret0 *Rows) *ExpectedAllDocs { 575 e.ret0 = ret0 576 return e 577 } 578 579 // WillReturnError sets the error value that will be returned by the call to DB.AllDocs(). 580 func (e *ExpectedAllDocs) WillReturnError(err error) *ExpectedAllDocs { 581 e.err = err 582 return e 583 } 584 585 // WillDelay causes the call to DB.AllDocs() to delay. 586 func (e *ExpectedAllDocs) WillDelay(delay time.Duration) *ExpectedAllDocs { 587 e.delay = delay 588 return e 589 } 590 591 func (e *ExpectedAllDocs) met(_ expectation) bool { 592 return true 593 } 594 595 func (e *ExpectedAllDocs) method(v bool) string { 596 if !v { 597 return "DB.AllDocs()" 598 } 599 options := formatOptions(e.options) 600 return fmt.Sprintf("DB(%s).AllDocs(ctx, %s)", e.dbo().name, options) 601 } 602 603 // ExpectedBulkDocs represents an expectation for a call to DB.BulkDocs(). 604 type ExpectedBulkDocs struct { 605 commonExpectation 606 callback func(ctx context.Context, arg0 []interface{}, options driver.Options) ([]driver.BulkResult, error) 607 arg0 []interface{} 608 ret0 []driver.BulkResult 609 } 610 611 // WithOptions sets the expected options for the call to DB.BulkDocs(). 612 func (e *ExpectedBulkDocs) WithOptions(options ...kivik.Option) *ExpectedBulkDocs { 613 e.options = multiOptions{e.options, multiOptions(options)} 614 return e 615 } 616 617 // WillExecute sets a callback function to be called with any inputs to the 618 // original function. Any values returned by the callback will be returned as 619 // if generated by the driver. 620 func (e *ExpectedBulkDocs) WillExecute(cb func(ctx context.Context, arg0 []interface{}, options driver.Options) ([]driver.BulkResult, error)) *ExpectedBulkDocs { 621 e.callback = cb 622 return e 623 } 624 625 // WillReturn sets the values that will be returned by the call to DB.BulkDocs(). 626 func (e *ExpectedBulkDocs) WillReturn(ret0 []driver.BulkResult) *ExpectedBulkDocs { 627 e.ret0 = ret0 628 return e 629 } 630 631 // WillReturnError sets the error value that will be returned by the call to DB.BulkDocs(). 632 func (e *ExpectedBulkDocs) WillReturnError(err error) *ExpectedBulkDocs { 633 e.err = err 634 return e 635 } 636 637 // WillDelay causes the call to DB.BulkDocs() to delay. 638 func (e *ExpectedBulkDocs) WillDelay(delay time.Duration) *ExpectedBulkDocs { 639 e.delay = delay 640 return e 641 } 642 643 func (e *ExpectedBulkDocs) met(ex expectation) bool { 644 exp := ex.(*ExpectedBulkDocs) 645 if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) { 646 return false 647 } 648 return true 649 } 650 651 func (e *ExpectedBulkDocs) method(v bool) string { 652 if !v { 653 return "DB.BulkDocs()" 654 } 655 arg0, options := "?", formatOptions(e.options) 656 if e.arg0 != nil { 657 arg0 = fmt.Sprintf("%v", e.arg0) 658 } 659 return fmt.Sprintf("DB(%s).BulkDocs(ctx, %s, %s)", e.dbo().name, arg0, options) 660 } 661 662 // ExpectedBulkGet represents an expectation for a call to DB.BulkGet(). 663 type ExpectedBulkGet struct { 664 commonExpectation 665 callback func(ctx context.Context, arg0 []driver.BulkGetReference, options driver.Options) (driver.Rows, error) 666 arg0 []driver.BulkGetReference 667 ret0 *Rows 668 } 669 670 // WithOptions sets the expected options for the call to DB.BulkGet(). 671 func (e *ExpectedBulkGet) WithOptions(options ...kivik.Option) *ExpectedBulkGet { 672 e.options = multiOptions{e.options, multiOptions(options)} 673 return e 674 } 675 676 // WillExecute sets a callback function to be called with any inputs to the 677 // original function. Any values returned by the callback will be returned as 678 // if generated by the driver. 679 func (e *ExpectedBulkGet) WillExecute(cb func(ctx context.Context, arg0 []driver.BulkGetReference, options driver.Options) (driver.Rows, error)) *ExpectedBulkGet { 680 e.callback = cb 681 return e 682 } 683 684 // WillReturn sets the values that will be returned by the call to DB.BulkGet(). 685 func (e *ExpectedBulkGet) WillReturn(ret0 *Rows) *ExpectedBulkGet { 686 e.ret0 = ret0 687 return e 688 } 689 690 // WillReturnError sets the error value that will be returned by the call to DB.BulkGet(). 691 func (e *ExpectedBulkGet) WillReturnError(err error) *ExpectedBulkGet { 692 e.err = err 693 return e 694 } 695 696 // WillDelay causes the call to DB.BulkGet() to delay. 697 func (e *ExpectedBulkGet) WillDelay(delay time.Duration) *ExpectedBulkGet { 698 e.delay = delay 699 return e 700 } 701 702 func (e *ExpectedBulkGet) met(ex expectation) bool { 703 exp := ex.(*ExpectedBulkGet) 704 if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) { 705 return false 706 } 707 return true 708 } 709 710 func (e *ExpectedBulkGet) method(v bool) string { 711 if !v { 712 return "DB.BulkGet()" 713 } 714 arg0, options := "?", formatOptions(e.options) 715 if e.arg0 != nil { 716 arg0 = fmt.Sprintf("%v", e.arg0) 717 } 718 return fmt.Sprintf("DB(%s).BulkGet(ctx, %s, %s)", e.dbo().name, arg0, options) 719 } 720 721 // ExpectedChanges represents an expectation for a call to DB.Changes(). 722 type ExpectedChanges struct { 723 commonExpectation 724 callback func(ctx context.Context, options driver.Options) (driver.Changes, error) 725 ret0 *Changes 726 } 727 728 // WithOptions sets the expected options for the call to DB.Changes(). 729 func (e *ExpectedChanges) WithOptions(options ...kivik.Option) *ExpectedChanges { 730 e.options = multiOptions{e.options, multiOptions(options)} 731 return e 732 } 733 734 // WillExecute sets a callback function to be called with any inputs to the 735 // original function. Any values returned by the callback will be returned as 736 // if generated by the driver. 737 func (e *ExpectedChanges) WillExecute(cb func(ctx context.Context, options driver.Options) (driver.Changes, error)) *ExpectedChanges { 738 e.callback = cb 739 return e 740 } 741 742 // WillReturn sets the values that will be returned by the call to DB.Changes(). 743 func (e *ExpectedChanges) WillReturn(ret0 *Changes) *ExpectedChanges { 744 e.ret0 = ret0 745 return e 746 } 747 748 // WillReturnError sets the error value that will be returned by the call to DB.Changes(). 749 func (e *ExpectedChanges) WillReturnError(err error) *ExpectedChanges { 750 e.err = err 751 return e 752 } 753 754 // WillDelay causes the call to DB.Changes() to delay. 755 func (e *ExpectedChanges) WillDelay(delay time.Duration) *ExpectedChanges { 756 e.delay = delay 757 return e 758 } 759 760 func (e *ExpectedChanges) met(_ expectation) bool { 761 return true 762 } 763 764 func (e *ExpectedChanges) method(v bool) string { 765 if !v { 766 return "DB.Changes()" 767 } 768 options := formatOptions(e.options) 769 return fmt.Sprintf("DB(%s).Changes(ctx, %s)", e.dbo().name, options) 770 } 771 772 // ExpectedDelete represents an expectation for a call to DB.Delete(). 773 type ExpectedDelete struct { 774 commonExpectation 775 callback func(ctx context.Context, arg0 string, options driver.Options) (string, error) 776 arg0 string 777 ret0 string 778 } 779 780 // WithOptions sets the expected options for the call to DB.Delete(). 781 func (e *ExpectedDelete) WithOptions(options ...kivik.Option) *ExpectedDelete { 782 e.options = multiOptions{e.options, multiOptions(options)} 783 return e 784 } 785 786 // WillExecute sets a callback function to be called with any inputs to the 787 // original function. Any values returned by the callback will be returned as 788 // if generated by the driver. 789 func (e *ExpectedDelete) WillExecute(cb func(ctx context.Context, arg0 string, options driver.Options) (string, error)) *ExpectedDelete { 790 e.callback = cb 791 return e 792 } 793 794 // WillReturn sets the values that will be returned by the call to DB.Delete(). 795 func (e *ExpectedDelete) WillReturn(ret0 string) *ExpectedDelete { 796 e.ret0 = ret0 797 return e 798 } 799 800 // WillReturnError sets the error value that will be returned by the call to DB.Delete(). 801 func (e *ExpectedDelete) WillReturnError(err error) *ExpectedDelete { 802 e.err = err 803 return e 804 } 805 806 // WillDelay causes the call to DB.Delete() to delay. 807 func (e *ExpectedDelete) WillDelay(delay time.Duration) *ExpectedDelete { 808 e.delay = delay 809 return e 810 } 811 812 func (e *ExpectedDelete) met(ex expectation) bool { 813 exp := ex.(*ExpectedDelete) 814 if exp.arg0 != "" && exp.arg0 != e.arg0 { 815 return false 816 } 817 return true 818 } 819 820 func (e *ExpectedDelete) method(v bool) string { 821 if !v { 822 return "DB.Delete()" 823 } 824 arg0, options := "?", formatOptions(e.options) 825 if e.arg0 != "" { 826 arg0 = fmt.Sprintf("%q", e.arg0) 827 } 828 return fmt.Sprintf("DB(%s).Delete(ctx, %s, %s)", e.dbo().name, arg0, options) 829 } 830 831 // ExpectedDeleteAttachment represents an expectation for a call to DB.DeleteAttachment(). 832 type ExpectedDeleteAttachment struct { 833 commonExpectation 834 callback func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (string, error) 835 arg0 string 836 arg1 string 837 ret0 string 838 } 839 840 // WithOptions sets the expected options for the call to DB.DeleteAttachment(). 841 func (e *ExpectedDeleteAttachment) WithOptions(options ...kivik.Option) *ExpectedDeleteAttachment { 842 e.options = multiOptions{e.options, multiOptions(options)} 843 return e 844 } 845 846 // WillExecute sets a callback function to be called with any inputs to the 847 // original function. Any values returned by the callback will be returned as 848 // if generated by the driver. 849 func (e *ExpectedDeleteAttachment) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (string, error)) *ExpectedDeleteAttachment { 850 e.callback = cb 851 return e 852 } 853 854 // WillReturn sets the values that will be returned by the call to DB.DeleteAttachment(). 855 func (e *ExpectedDeleteAttachment) WillReturn(ret0 string) *ExpectedDeleteAttachment { 856 e.ret0 = ret0 857 return e 858 } 859 860 // WillReturnError sets the error value that will be returned by the call to DB.DeleteAttachment(). 861 func (e *ExpectedDeleteAttachment) WillReturnError(err error) *ExpectedDeleteAttachment { 862 e.err = err 863 return e 864 } 865 866 // WillDelay causes the call to DB.DeleteAttachment() to delay. 867 func (e *ExpectedDeleteAttachment) WillDelay(delay time.Duration) *ExpectedDeleteAttachment { 868 e.delay = delay 869 return e 870 } 871 872 func (e *ExpectedDeleteAttachment) met(ex expectation) bool { 873 exp := ex.(*ExpectedDeleteAttachment) 874 if exp.arg0 != "" && exp.arg0 != e.arg0 { 875 return false 876 } 877 if exp.arg1 != "" && exp.arg1 != e.arg1 { 878 return false 879 } 880 return true 881 } 882 883 func (e *ExpectedDeleteAttachment) method(v bool) string { 884 if !v { 885 return "DB.DeleteAttachment()" 886 } 887 arg0, arg1, options := "?", "?", formatOptions(e.options) 888 if e.arg0 != "" { 889 arg0 = fmt.Sprintf("%q", e.arg0) 890 } 891 if e.arg1 != "" { 892 arg1 = fmt.Sprintf("%q", e.arg1) 893 } 894 return fmt.Sprintf("DB(%s).DeleteAttachment(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options) 895 } 896 897 // ExpectedDesignDocs represents an expectation for a call to DB.DesignDocs(). 898 type ExpectedDesignDocs struct { 899 commonExpectation 900 callback func(ctx context.Context, options driver.Options) (driver.Rows, error) 901 ret0 *Rows 902 } 903 904 // WithOptions sets the expected options for the call to DB.DesignDocs(). 905 func (e *ExpectedDesignDocs) WithOptions(options ...kivik.Option) *ExpectedDesignDocs { 906 e.options = multiOptions{e.options, multiOptions(options)} 907 return e 908 } 909 910 // WillExecute sets a callback function to be called with any inputs to the 911 // original function. Any values returned by the callback will be returned as 912 // if generated by the driver. 913 func (e *ExpectedDesignDocs) WillExecute(cb func(ctx context.Context, options driver.Options) (driver.Rows, error)) *ExpectedDesignDocs { 914 e.callback = cb 915 return e 916 } 917 918 // WillReturn sets the values that will be returned by the call to DB.DesignDocs(). 919 func (e *ExpectedDesignDocs) WillReturn(ret0 *Rows) *ExpectedDesignDocs { 920 e.ret0 = ret0 921 return e 922 } 923 924 // WillReturnError sets the error value that will be returned by the call to DB.DesignDocs(). 925 func (e *ExpectedDesignDocs) WillReturnError(err error) *ExpectedDesignDocs { 926 e.err = err 927 return e 928 } 929 930 // WillDelay causes the call to DB.DesignDocs() to delay. 931 func (e *ExpectedDesignDocs) WillDelay(delay time.Duration) *ExpectedDesignDocs { 932 e.delay = delay 933 return e 934 } 935 936 func (e *ExpectedDesignDocs) met(_ expectation) bool { 937 return true 938 } 939 940 func (e *ExpectedDesignDocs) method(v bool) string { 941 if !v { 942 return "DB.DesignDocs()" 943 } 944 options := formatOptions(e.options) 945 return fmt.Sprintf("DB(%s).DesignDocs(ctx, %s)", e.dbo().name, options) 946 } 947 948 // ExpectedExplain represents an expectation for a call to DB.Explain(). 949 type ExpectedExplain struct { 950 commonExpectation 951 callback func(ctx context.Context, arg0 interface{}, options driver.Options) (*driver.QueryPlan, error) 952 arg0 interface{} 953 ret0 *driver.QueryPlan 954 } 955 956 // WithOptions sets the expected options for the call to DB.Explain(). 957 func (e *ExpectedExplain) WithOptions(options ...kivik.Option) *ExpectedExplain { 958 e.options = multiOptions{e.options, multiOptions(options)} 959 return e 960 } 961 962 // WillExecute sets a callback function to be called with any inputs to the 963 // original function. Any values returned by the callback will be returned as 964 // if generated by the driver. 965 func (e *ExpectedExplain) WillExecute(cb func(ctx context.Context, arg0 interface{}, options driver.Options) (*driver.QueryPlan, error)) *ExpectedExplain { 966 e.callback = cb 967 return e 968 } 969 970 // WillReturn sets the values that will be returned by the call to DB.Explain(). 971 func (e *ExpectedExplain) WillReturn(ret0 *driver.QueryPlan) *ExpectedExplain { 972 e.ret0 = ret0 973 return e 974 } 975 976 // WillReturnError sets the error value that will be returned by the call to DB.Explain(). 977 func (e *ExpectedExplain) WillReturnError(err error) *ExpectedExplain { 978 e.err = err 979 return e 980 } 981 982 // WillDelay causes the call to DB.Explain() to delay. 983 func (e *ExpectedExplain) WillDelay(delay time.Duration) *ExpectedExplain { 984 e.delay = delay 985 return e 986 } 987 988 func (e *ExpectedExplain) met(ex expectation) bool { 989 exp := ex.(*ExpectedExplain) 990 if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) { 991 return false 992 } 993 return true 994 } 995 996 func (e *ExpectedExplain) method(v bool) string { 997 if !v { 998 return "DB.Explain()" 999 } 1000 arg0, options := "?", formatOptions(e.options) 1001 if e.arg0 != nil { 1002 arg0 = fmt.Sprintf("%v", e.arg0) 1003 } 1004 return fmt.Sprintf("DB(%s).Explain(ctx, %s, %s)", e.dbo().name, arg0, options) 1005 } 1006 1007 // ExpectedFind represents an expectation for a call to DB.Find(). 1008 type ExpectedFind struct { 1009 commonExpectation 1010 callback func(ctx context.Context, arg0 interface{}, options driver.Options) (driver.Rows, error) 1011 arg0 interface{} 1012 ret0 *Rows 1013 } 1014 1015 // WithOptions sets the expected options for the call to DB.Find(). 1016 func (e *ExpectedFind) WithOptions(options ...kivik.Option) *ExpectedFind { 1017 e.options = multiOptions{e.options, multiOptions(options)} 1018 return e 1019 } 1020 1021 // WillExecute sets a callback function to be called with any inputs to the 1022 // original function. Any values returned by the callback will be returned as 1023 // if generated by the driver. 1024 func (e *ExpectedFind) WillExecute(cb func(ctx context.Context, arg0 interface{}, options driver.Options) (driver.Rows, error)) *ExpectedFind { 1025 e.callback = cb 1026 return e 1027 } 1028 1029 // WillReturn sets the values that will be returned by the call to DB.Find(). 1030 func (e *ExpectedFind) WillReturn(ret0 *Rows) *ExpectedFind { 1031 e.ret0 = ret0 1032 return e 1033 } 1034 1035 // WillReturnError sets the error value that will be returned by the call to DB.Find(). 1036 func (e *ExpectedFind) WillReturnError(err error) *ExpectedFind { 1037 e.err = err 1038 return e 1039 } 1040 1041 // WillDelay causes the call to DB.Find() to delay. 1042 func (e *ExpectedFind) WillDelay(delay time.Duration) *ExpectedFind { 1043 e.delay = delay 1044 return e 1045 } 1046 1047 func (e *ExpectedFind) met(ex expectation) bool { 1048 exp := ex.(*ExpectedFind) 1049 if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) { 1050 return false 1051 } 1052 return true 1053 } 1054 1055 func (e *ExpectedFind) method(v bool) string { 1056 if !v { 1057 return "DB.Find()" 1058 } 1059 arg0, options := "?", formatOptions(e.options) 1060 if e.arg0 != nil { 1061 arg0 = fmt.Sprintf("%v", e.arg0) 1062 } 1063 return fmt.Sprintf("DB(%s).Find(ctx, %s, %s)", e.dbo().name, arg0, options) 1064 } 1065 1066 // ExpectedGet represents an expectation for a call to DB.Get(). 1067 type ExpectedGet struct { 1068 commonExpectation 1069 callback func(ctx context.Context, arg0 string, options driver.Options) (*driver.Document, error) 1070 arg0 string 1071 ret0 *driver.Document 1072 } 1073 1074 // WithOptions sets the expected options for the call to DB.Get(). 1075 func (e *ExpectedGet) WithOptions(options ...kivik.Option) *ExpectedGet { 1076 e.options = multiOptions{e.options, multiOptions(options)} 1077 return e 1078 } 1079 1080 // WillExecute sets a callback function to be called with any inputs to the 1081 // original function. Any values returned by the callback will be returned as 1082 // if generated by the driver. 1083 func (e *ExpectedGet) WillExecute(cb func(ctx context.Context, arg0 string, options driver.Options) (*driver.Document, error)) *ExpectedGet { 1084 e.callback = cb 1085 return e 1086 } 1087 1088 // WillReturn sets the values that will be returned by the call to DB.Get(). 1089 func (e *ExpectedGet) WillReturn(ret0 *driver.Document) *ExpectedGet { 1090 e.ret0 = ret0 1091 return e 1092 } 1093 1094 // WillReturnError sets the error value that will be returned by the call to DB.Get(). 1095 func (e *ExpectedGet) WillReturnError(err error) *ExpectedGet { 1096 e.err = err 1097 return e 1098 } 1099 1100 // WillDelay causes the call to DB.Get() to delay. 1101 func (e *ExpectedGet) WillDelay(delay time.Duration) *ExpectedGet { 1102 e.delay = delay 1103 return e 1104 } 1105 1106 func (e *ExpectedGet) met(ex expectation) bool { 1107 exp := ex.(*ExpectedGet) 1108 if exp.arg0 != "" && exp.arg0 != e.arg0 { 1109 return false 1110 } 1111 return true 1112 } 1113 1114 func (e *ExpectedGet) method(v bool) string { 1115 if !v { 1116 return "DB.Get()" 1117 } 1118 arg0, options := "?", formatOptions(e.options) 1119 if e.arg0 != "" { 1120 arg0 = fmt.Sprintf("%q", e.arg0) 1121 } 1122 return fmt.Sprintf("DB(%s).Get(ctx, %s, %s)", e.dbo().name, arg0, options) 1123 } 1124 1125 // ExpectedGetAttachment represents an expectation for a call to DB.GetAttachment(). 1126 type ExpectedGetAttachment struct { 1127 commonExpectation 1128 callback func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (*driver.Attachment, error) 1129 arg0 string 1130 arg1 string 1131 ret0 *driver.Attachment 1132 } 1133 1134 // WithOptions sets the expected options for the call to DB.GetAttachment(). 1135 func (e *ExpectedGetAttachment) WithOptions(options ...kivik.Option) *ExpectedGetAttachment { 1136 e.options = multiOptions{e.options, multiOptions(options)} 1137 return e 1138 } 1139 1140 // WillExecute sets a callback function to be called with any inputs to the 1141 // original function. Any values returned by the callback will be returned as 1142 // if generated by the driver. 1143 func (e *ExpectedGetAttachment) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (*driver.Attachment, error)) *ExpectedGetAttachment { 1144 e.callback = cb 1145 return e 1146 } 1147 1148 // WillReturn sets the values that will be returned by the call to DB.GetAttachment(). 1149 func (e *ExpectedGetAttachment) WillReturn(ret0 *driver.Attachment) *ExpectedGetAttachment { 1150 e.ret0 = ret0 1151 return e 1152 } 1153 1154 // WillReturnError sets the error value that will be returned by the call to DB.GetAttachment(). 1155 func (e *ExpectedGetAttachment) WillReturnError(err error) *ExpectedGetAttachment { 1156 e.err = err 1157 return e 1158 } 1159 1160 // WillDelay causes the call to DB.GetAttachment() to delay. 1161 func (e *ExpectedGetAttachment) WillDelay(delay time.Duration) *ExpectedGetAttachment { 1162 e.delay = delay 1163 return e 1164 } 1165 1166 func (e *ExpectedGetAttachment) met(ex expectation) bool { 1167 exp := ex.(*ExpectedGetAttachment) 1168 if exp.arg0 != "" && exp.arg0 != e.arg0 { 1169 return false 1170 } 1171 if exp.arg1 != "" && exp.arg1 != e.arg1 { 1172 return false 1173 } 1174 return true 1175 } 1176 1177 func (e *ExpectedGetAttachment) method(v bool) string { 1178 if !v { 1179 return "DB.GetAttachment()" 1180 } 1181 arg0, arg1, options := "?", "?", formatOptions(e.options) 1182 if e.arg0 != "" { 1183 arg0 = fmt.Sprintf("%q", e.arg0) 1184 } 1185 if e.arg1 != "" { 1186 arg1 = fmt.Sprintf("%q", e.arg1) 1187 } 1188 return fmt.Sprintf("DB(%s).GetAttachment(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options) 1189 } 1190 1191 // ExpectedGetAttachmentMeta represents an expectation for a call to DB.GetAttachmentMeta(). 1192 type ExpectedGetAttachmentMeta struct { 1193 commonExpectation 1194 callback func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (*driver.Attachment, error) 1195 arg0 string 1196 arg1 string 1197 ret0 *driver.Attachment 1198 } 1199 1200 // WithOptions sets the expected options for the call to DB.GetAttachmentMeta(). 1201 func (e *ExpectedGetAttachmentMeta) WithOptions(options ...kivik.Option) *ExpectedGetAttachmentMeta { 1202 e.options = multiOptions{e.options, multiOptions(options)} 1203 return e 1204 } 1205 1206 // WillExecute sets a callback function to be called with any inputs to the 1207 // original function. Any values returned by the callback will be returned as 1208 // if generated by the driver. 1209 func (e *ExpectedGetAttachmentMeta) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (*driver.Attachment, error)) *ExpectedGetAttachmentMeta { 1210 e.callback = cb 1211 return e 1212 } 1213 1214 // WillReturn sets the values that will be returned by the call to DB.GetAttachmentMeta(). 1215 func (e *ExpectedGetAttachmentMeta) WillReturn(ret0 *driver.Attachment) *ExpectedGetAttachmentMeta { 1216 e.ret0 = ret0 1217 return e 1218 } 1219 1220 // WillReturnError sets the error value that will be returned by the call to DB.GetAttachmentMeta(). 1221 func (e *ExpectedGetAttachmentMeta) WillReturnError(err error) *ExpectedGetAttachmentMeta { 1222 e.err = err 1223 return e 1224 } 1225 1226 // WillDelay causes the call to DB.GetAttachmentMeta() to delay. 1227 func (e *ExpectedGetAttachmentMeta) WillDelay(delay time.Duration) *ExpectedGetAttachmentMeta { 1228 e.delay = delay 1229 return e 1230 } 1231 1232 func (e *ExpectedGetAttachmentMeta) met(ex expectation) bool { 1233 exp := ex.(*ExpectedGetAttachmentMeta) 1234 if exp.arg0 != "" && exp.arg0 != e.arg0 { 1235 return false 1236 } 1237 if exp.arg1 != "" && exp.arg1 != e.arg1 { 1238 return false 1239 } 1240 return true 1241 } 1242 1243 func (e *ExpectedGetAttachmentMeta) method(v bool) string { 1244 if !v { 1245 return "DB.GetAttachmentMeta()" 1246 } 1247 arg0, arg1, options := "?", "?", formatOptions(e.options) 1248 if e.arg0 != "" { 1249 arg0 = fmt.Sprintf("%q", e.arg0) 1250 } 1251 if e.arg1 != "" { 1252 arg1 = fmt.Sprintf("%q", e.arg1) 1253 } 1254 return fmt.Sprintf("DB(%s).GetAttachmentMeta(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options) 1255 } 1256 1257 // ExpectedGetIndexes represents an expectation for a call to DB.GetIndexes(). 1258 type ExpectedGetIndexes struct { 1259 commonExpectation 1260 callback func(ctx context.Context, options driver.Options) ([]driver.Index, error) 1261 ret0 []driver.Index 1262 } 1263 1264 // WithOptions sets the expected options for the call to DB.GetIndexes(). 1265 func (e *ExpectedGetIndexes) WithOptions(options ...kivik.Option) *ExpectedGetIndexes { 1266 e.options = multiOptions{e.options, multiOptions(options)} 1267 return e 1268 } 1269 1270 // WillExecute sets a callback function to be called with any inputs to the 1271 // original function. Any values returned by the callback will be returned as 1272 // if generated by the driver. 1273 func (e *ExpectedGetIndexes) WillExecute(cb func(ctx context.Context, options driver.Options) ([]driver.Index, error)) *ExpectedGetIndexes { 1274 e.callback = cb 1275 return e 1276 } 1277 1278 // WillReturn sets the values that will be returned by the call to DB.GetIndexes(). 1279 func (e *ExpectedGetIndexes) WillReturn(ret0 []driver.Index) *ExpectedGetIndexes { 1280 e.ret0 = ret0 1281 return e 1282 } 1283 1284 // WillReturnError sets the error value that will be returned by the call to DB.GetIndexes(). 1285 func (e *ExpectedGetIndexes) WillReturnError(err error) *ExpectedGetIndexes { 1286 e.err = err 1287 return e 1288 } 1289 1290 // WillDelay causes the call to DB.GetIndexes() to delay. 1291 func (e *ExpectedGetIndexes) WillDelay(delay time.Duration) *ExpectedGetIndexes { 1292 e.delay = delay 1293 return e 1294 } 1295 1296 func (e *ExpectedGetIndexes) met(_ expectation) bool { 1297 return true 1298 } 1299 1300 func (e *ExpectedGetIndexes) method(v bool) string { 1301 if !v { 1302 return "DB.GetIndexes()" 1303 } 1304 options := formatOptions(e.options) 1305 return fmt.Sprintf("DB(%s).GetIndexes(ctx, %s)", e.dbo().name, options) 1306 } 1307 1308 // ExpectedLocalDocs represents an expectation for a call to DB.LocalDocs(). 1309 type ExpectedLocalDocs struct { 1310 commonExpectation 1311 callback func(ctx context.Context, options driver.Options) (driver.Rows, error) 1312 ret0 *Rows 1313 } 1314 1315 // WithOptions sets the expected options for the call to DB.LocalDocs(). 1316 func (e *ExpectedLocalDocs) WithOptions(options ...kivik.Option) *ExpectedLocalDocs { 1317 e.options = multiOptions{e.options, multiOptions(options)} 1318 return e 1319 } 1320 1321 // WillExecute sets a callback function to be called with any inputs to the 1322 // original function. Any values returned by the callback will be returned as 1323 // if generated by the driver. 1324 func (e *ExpectedLocalDocs) WillExecute(cb func(ctx context.Context, options driver.Options) (driver.Rows, error)) *ExpectedLocalDocs { 1325 e.callback = cb 1326 return e 1327 } 1328 1329 // WillReturn sets the values that will be returned by the call to DB.LocalDocs(). 1330 func (e *ExpectedLocalDocs) WillReturn(ret0 *Rows) *ExpectedLocalDocs { 1331 e.ret0 = ret0 1332 return e 1333 } 1334 1335 // WillReturnError sets the error value that will be returned by the call to DB.LocalDocs(). 1336 func (e *ExpectedLocalDocs) WillReturnError(err error) *ExpectedLocalDocs { 1337 e.err = err 1338 return e 1339 } 1340 1341 // WillDelay causes the call to DB.LocalDocs() to delay. 1342 func (e *ExpectedLocalDocs) WillDelay(delay time.Duration) *ExpectedLocalDocs { 1343 e.delay = delay 1344 return e 1345 } 1346 1347 func (e *ExpectedLocalDocs) met(_ expectation) bool { 1348 return true 1349 } 1350 1351 func (e *ExpectedLocalDocs) method(v bool) string { 1352 if !v { 1353 return "DB.LocalDocs()" 1354 } 1355 options := formatOptions(e.options) 1356 return fmt.Sprintf("DB(%s).LocalDocs(ctx, %s)", e.dbo().name, options) 1357 } 1358 1359 // ExpectedOpenRevs represents an expectation for a call to DB.OpenRevs(). 1360 type ExpectedOpenRevs struct { 1361 commonExpectation 1362 callback func(ctx context.Context, arg0 string, arg1 []string, options driver.Options) (driver.Rows, error) 1363 arg0 string 1364 arg1 []string 1365 ret0 *Rows 1366 } 1367 1368 // WithOptions sets the expected options for the call to DB.OpenRevs(). 1369 func (e *ExpectedOpenRevs) WithOptions(options ...kivik.Option) *ExpectedOpenRevs { 1370 e.options = multiOptions{e.options, multiOptions(options)} 1371 return e 1372 } 1373 1374 // WillExecute sets a callback function to be called with any inputs to the 1375 // original function. Any values returned by the callback will be returned as 1376 // if generated by the driver. 1377 func (e *ExpectedOpenRevs) WillExecute(cb func(ctx context.Context, arg0 string, arg1 []string, options driver.Options) (driver.Rows, error)) *ExpectedOpenRevs { 1378 e.callback = cb 1379 return e 1380 } 1381 1382 // WillReturn sets the values that will be returned by the call to DB.OpenRevs(). 1383 func (e *ExpectedOpenRevs) WillReturn(ret0 *Rows) *ExpectedOpenRevs { 1384 e.ret0 = ret0 1385 return e 1386 } 1387 1388 // WillReturnError sets the error value that will be returned by the call to DB.OpenRevs(). 1389 func (e *ExpectedOpenRevs) WillReturnError(err error) *ExpectedOpenRevs { 1390 e.err = err 1391 return e 1392 } 1393 1394 // WillDelay causes the call to DB.OpenRevs() to delay. 1395 func (e *ExpectedOpenRevs) WillDelay(delay time.Duration) *ExpectedOpenRevs { 1396 e.delay = delay 1397 return e 1398 } 1399 1400 func (e *ExpectedOpenRevs) met(ex expectation) bool { 1401 exp := ex.(*ExpectedOpenRevs) 1402 if exp.arg0 != "" && exp.arg0 != e.arg0 { 1403 return false 1404 } 1405 if exp.arg1 != nil && !reflect.DeepEqual(exp.arg1, e.arg1) { 1406 return false 1407 } 1408 return true 1409 } 1410 1411 func (e *ExpectedOpenRevs) method(v bool) string { 1412 if !v { 1413 return "DB.OpenRevs()" 1414 } 1415 arg0, arg1, options := "?", "?", formatOptions(e.options) 1416 if e.arg0 != "" { 1417 arg0 = fmt.Sprintf("%q", e.arg0) 1418 } 1419 if e.arg1 != nil { 1420 arg1 = fmt.Sprintf("%v", e.arg1) 1421 } 1422 return fmt.Sprintf("DB(%s).OpenRevs(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options) 1423 } 1424 1425 // ExpectedPartitionStats represents an expectation for a call to DB.PartitionStats(). 1426 type ExpectedPartitionStats struct { 1427 commonExpectation 1428 callback func(ctx context.Context, arg0 string) (*driver.PartitionStats, error) 1429 arg0 string 1430 ret0 *driver.PartitionStats 1431 } 1432 1433 // WillExecute sets a callback function to be called with any inputs to the 1434 // original function. Any values returned by the callback will be returned as 1435 // if generated by the driver. 1436 func (e *ExpectedPartitionStats) WillExecute(cb func(ctx context.Context, arg0 string) (*driver.PartitionStats, error)) *ExpectedPartitionStats { 1437 e.callback = cb 1438 return e 1439 } 1440 1441 // WillReturn sets the values that will be returned by the call to DB.PartitionStats(). 1442 func (e *ExpectedPartitionStats) WillReturn(ret0 *driver.PartitionStats) *ExpectedPartitionStats { 1443 e.ret0 = ret0 1444 return e 1445 } 1446 1447 // WillReturnError sets the error value that will be returned by the call to DB.PartitionStats(). 1448 func (e *ExpectedPartitionStats) WillReturnError(err error) *ExpectedPartitionStats { 1449 e.err = err 1450 return e 1451 } 1452 1453 // WillDelay causes the call to DB.PartitionStats() to delay. 1454 func (e *ExpectedPartitionStats) WillDelay(delay time.Duration) *ExpectedPartitionStats { 1455 e.delay = delay 1456 return e 1457 } 1458 1459 func (e *ExpectedPartitionStats) met(ex expectation) bool { 1460 exp := ex.(*ExpectedPartitionStats) 1461 if exp.arg0 != "" && exp.arg0 != e.arg0 { 1462 return false 1463 } 1464 return true 1465 } 1466 1467 func (e *ExpectedPartitionStats) method(v bool) string { 1468 if !v { 1469 return "DB.PartitionStats()" 1470 } 1471 arg0 := "?" 1472 if e.arg0 != "" { 1473 arg0 = fmt.Sprintf("%q", e.arg0) 1474 } 1475 return fmt.Sprintf("DB(%s).PartitionStats(ctx, %s)", e.dbo().name, arg0) 1476 } 1477 1478 // ExpectedPurge represents an expectation for a call to DB.Purge(). 1479 type ExpectedPurge struct { 1480 commonExpectation 1481 callback func(ctx context.Context, arg0 map[string][]string) (*driver.PurgeResult, error) 1482 arg0 map[string][]string 1483 ret0 *driver.PurgeResult 1484 } 1485 1486 // WillExecute sets a callback function to be called with any inputs to the 1487 // original function. Any values returned by the callback will be returned as 1488 // if generated by the driver. 1489 func (e *ExpectedPurge) WillExecute(cb func(ctx context.Context, arg0 map[string][]string) (*driver.PurgeResult, error)) *ExpectedPurge { 1490 e.callback = cb 1491 return e 1492 } 1493 1494 // WillReturn sets the values that will be returned by the call to DB.Purge(). 1495 func (e *ExpectedPurge) WillReturn(ret0 *driver.PurgeResult) *ExpectedPurge { 1496 e.ret0 = ret0 1497 return e 1498 } 1499 1500 // WillReturnError sets the error value that will be returned by the call to DB.Purge(). 1501 func (e *ExpectedPurge) WillReturnError(err error) *ExpectedPurge { 1502 e.err = err 1503 return e 1504 } 1505 1506 // WillDelay causes the call to DB.Purge() to delay. 1507 func (e *ExpectedPurge) WillDelay(delay time.Duration) *ExpectedPurge { 1508 e.delay = delay 1509 return e 1510 } 1511 1512 func (e *ExpectedPurge) met(ex expectation) bool { 1513 exp := ex.(*ExpectedPurge) 1514 if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) { 1515 return false 1516 } 1517 return true 1518 } 1519 1520 func (e *ExpectedPurge) method(v bool) string { 1521 if !v { 1522 return "DB.Purge()" 1523 } 1524 arg0 := "?" 1525 if e.arg0 != nil { 1526 arg0 = fmt.Sprintf("%v", e.arg0) 1527 } 1528 return fmt.Sprintf("DB(%s).Purge(ctx, %s)", e.dbo().name, arg0) 1529 } 1530 1531 // ExpectedPutAttachment represents an expectation for a call to DB.PutAttachment(). 1532 type ExpectedPutAttachment struct { 1533 commonExpectation 1534 callback func(ctx context.Context, arg0 string, arg1 *driver.Attachment, options driver.Options) (string, error) 1535 arg0 string 1536 arg1 *driver.Attachment 1537 ret0 string 1538 } 1539 1540 // WithOptions sets the expected options for the call to DB.PutAttachment(). 1541 func (e *ExpectedPutAttachment) WithOptions(options ...kivik.Option) *ExpectedPutAttachment { 1542 e.options = multiOptions{e.options, multiOptions(options)} 1543 return e 1544 } 1545 1546 // WillExecute sets a callback function to be called with any inputs to the 1547 // original function. Any values returned by the callback will be returned as 1548 // if generated by the driver. 1549 func (e *ExpectedPutAttachment) WillExecute(cb func(ctx context.Context, arg0 string, arg1 *driver.Attachment, options driver.Options) (string, error)) *ExpectedPutAttachment { 1550 e.callback = cb 1551 return e 1552 } 1553 1554 // WillReturn sets the values that will be returned by the call to DB.PutAttachment(). 1555 func (e *ExpectedPutAttachment) WillReturn(ret0 string) *ExpectedPutAttachment { 1556 e.ret0 = ret0 1557 return e 1558 } 1559 1560 // WillReturnError sets the error value that will be returned by the call to DB.PutAttachment(). 1561 func (e *ExpectedPutAttachment) WillReturnError(err error) *ExpectedPutAttachment { 1562 e.err = err 1563 return e 1564 } 1565 1566 // WillDelay causes the call to DB.PutAttachment() to delay. 1567 func (e *ExpectedPutAttachment) WillDelay(delay time.Duration) *ExpectedPutAttachment { 1568 e.delay = delay 1569 return e 1570 } 1571 1572 func (e *ExpectedPutAttachment) met(ex expectation) bool { 1573 exp := ex.(*ExpectedPutAttachment) 1574 if exp.arg0 != "" && exp.arg0 != e.arg0 { 1575 return false 1576 } 1577 if exp.arg1 != nil && !reflect.DeepEqual(exp.arg1, e.arg1) { 1578 return false 1579 } 1580 return true 1581 } 1582 1583 func (e *ExpectedPutAttachment) method(v bool) string { 1584 if !v { 1585 return "DB.PutAttachment()" 1586 } 1587 arg0, arg1, options := "?", "?", formatOptions(e.options) 1588 if e.arg0 != "" { 1589 arg0 = fmt.Sprintf("%q", e.arg0) 1590 } 1591 if e.arg1 != nil { 1592 arg1 = fmt.Sprintf("%v", e.arg1) 1593 } 1594 return fmt.Sprintf("DB(%s).PutAttachment(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options) 1595 } 1596 1597 // ExpectedQuery represents an expectation for a call to DB.Query(). 1598 type ExpectedQuery struct { 1599 commonExpectation 1600 callback func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (driver.Rows, error) 1601 arg0 string 1602 arg1 string 1603 ret0 *Rows 1604 } 1605 1606 // WithOptions sets the expected options for the call to DB.Query(). 1607 func (e *ExpectedQuery) WithOptions(options ...kivik.Option) *ExpectedQuery { 1608 e.options = multiOptions{e.options, multiOptions(options)} 1609 return e 1610 } 1611 1612 // WillExecute sets a callback function to be called with any inputs to the 1613 // original function. Any values returned by the callback will be returned as 1614 // if generated by the driver. 1615 func (e *ExpectedQuery) WillExecute(cb func(ctx context.Context, arg0 string, arg1 string, options driver.Options) (driver.Rows, error)) *ExpectedQuery { 1616 e.callback = cb 1617 return e 1618 } 1619 1620 // WillReturn sets the values that will be returned by the call to DB.Query(). 1621 func (e *ExpectedQuery) WillReturn(ret0 *Rows) *ExpectedQuery { 1622 e.ret0 = ret0 1623 return e 1624 } 1625 1626 // WillReturnError sets the error value that will be returned by the call to DB.Query(). 1627 func (e *ExpectedQuery) WillReturnError(err error) *ExpectedQuery { 1628 e.err = err 1629 return e 1630 } 1631 1632 // WillDelay causes the call to DB.Query() to delay. 1633 func (e *ExpectedQuery) WillDelay(delay time.Duration) *ExpectedQuery { 1634 e.delay = delay 1635 return e 1636 } 1637 1638 func (e *ExpectedQuery) met(ex expectation) bool { 1639 exp := ex.(*ExpectedQuery) 1640 if exp.arg0 != "" && exp.arg0 != e.arg0 { 1641 return false 1642 } 1643 if exp.arg1 != "" && exp.arg1 != e.arg1 { 1644 return false 1645 } 1646 return true 1647 } 1648 1649 func (e *ExpectedQuery) method(v bool) string { 1650 if !v { 1651 return "DB.Query()" 1652 } 1653 arg0, arg1, options := "?", "?", formatOptions(e.options) 1654 if e.arg0 != "" { 1655 arg0 = fmt.Sprintf("%q", e.arg0) 1656 } 1657 if e.arg1 != "" { 1658 arg1 = fmt.Sprintf("%q", e.arg1) 1659 } 1660 return fmt.Sprintf("DB(%s).Query(ctx, %s, %s, %s)", e.dbo().name, arg0, arg1, options) 1661 } 1662 1663 // ExpectedRevsDiff represents an expectation for a call to DB.RevsDiff(). 1664 type ExpectedRevsDiff struct { 1665 commonExpectation 1666 callback func(ctx context.Context, arg0 interface{}) (driver.Rows, error) 1667 arg0 interface{} 1668 ret0 *Rows 1669 } 1670 1671 // WillExecute sets a callback function to be called with any inputs to the 1672 // original function. Any values returned by the callback will be returned as 1673 // if generated by the driver. 1674 func (e *ExpectedRevsDiff) WillExecute(cb func(ctx context.Context, arg0 interface{}) (driver.Rows, error)) *ExpectedRevsDiff { 1675 e.callback = cb 1676 return e 1677 } 1678 1679 // WillReturn sets the values that will be returned by the call to DB.RevsDiff(). 1680 func (e *ExpectedRevsDiff) WillReturn(ret0 *Rows) *ExpectedRevsDiff { 1681 e.ret0 = ret0 1682 return e 1683 } 1684 1685 // WillReturnError sets the error value that will be returned by the call to DB.RevsDiff(). 1686 func (e *ExpectedRevsDiff) WillReturnError(err error) *ExpectedRevsDiff { 1687 e.err = err 1688 return e 1689 } 1690 1691 // WillDelay causes the call to DB.RevsDiff() to delay. 1692 func (e *ExpectedRevsDiff) WillDelay(delay time.Duration) *ExpectedRevsDiff { 1693 e.delay = delay 1694 return e 1695 } 1696 1697 func (e *ExpectedRevsDiff) met(ex expectation) bool { 1698 exp := ex.(*ExpectedRevsDiff) 1699 if exp.arg0 != nil && !jsonMeets(exp.arg0, e.arg0) { 1700 return false 1701 } 1702 return true 1703 } 1704 1705 func (e *ExpectedRevsDiff) method(v bool) string { 1706 if !v { 1707 return "DB.RevsDiff()" 1708 } 1709 arg0 := "?" 1710 if e.arg0 != nil { 1711 arg0 = fmt.Sprintf("%v", e.arg0) 1712 } 1713 return fmt.Sprintf("DB(%s).RevsDiff(ctx, %s)", e.dbo().name, arg0) 1714 } 1715 1716 // ExpectedSecurity represents an expectation for a call to DB.Security(). 1717 type ExpectedSecurity struct { 1718 commonExpectation 1719 callback func(ctx context.Context) (*driver.Security, error) 1720 ret0 *driver.Security 1721 } 1722 1723 // WillExecute sets a callback function to be called with any inputs to the 1724 // original function. Any values returned by the callback will be returned as 1725 // if generated by the driver. 1726 func (e *ExpectedSecurity) WillExecute(cb func(ctx context.Context) (*driver.Security, error)) *ExpectedSecurity { 1727 e.callback = cb 1728 return e 1729 } 1730 1731 // WillReturn sets the values that will be returned by the call to DB.Security(). 1732 func (e *ExpectedSecurity) WillReturn(ret0 *driver.Security) *ExpectedSecurity { 1733 e.ret0 = ret0 1734 return e 1735 } 1736 1737 // WillReturnError sets the error value that will be returned by the call to DB.Security(). 1738 func (e *ExpectedSecurity) WillReturnError(err error) *ExpectedSecurity { 1739 e.err = err 1740 return e 1741 } 1742 1743 // WillDelay causes the call to DB.Security() to delay. 1744 func (e *ExpectedSecurity) WillDelay(delay time.Duration) *ExpectedSecurity { 1745 e.delay = delay 1746 return e 1747 } 1748 1749 func (e *ExpectedSecurity) met(_ expectation) bool { 1750 return true 1751 } 1752 1753 func (e *ExpectedSecurity) method(v bool) string { 1754 if !v { 1755 return "DB.Security()" 1756 } 1757 return fmt.Sprintf("DB(%s).Security(ctx)", e.dbo().name) 1758 } 1759 1760 // ExpectedSetSecurity represents an expectation for a call to DB.SetSecurity(). 1761 type ExpectedSetSecurity struct { 1762 commonExpectation 1763 callback func(ctx context.Context, arg0 *driver.Security) error 1764 arg0 *driver.Security 1765 } 1766 1767 // WillExecute sets a callback function to be called with any inputs to the 1768 // original function. Any values returned by the callback will be returned as 1769 // if generated by the driver. 1770 func (e *ExpectedSetSecurity) WillExecute(cb func(ctx context.Context, arg0 *driver.Security) error) *ExpectedSetSecurity { 1771 e.callback = cb 1772 return e 1773 } 1774 1775 // WillReturnError sets the error value that will be returned by the call to DB.SetSecurity(). 1776 func (e *ExpectedSetSecurity) WillReturnError(err error) *ExpectedSetSecurity { 1777 e.err = err 1778 return e 1779 } 1780 1781 // WillDelay causes the call to DB.SetSecurity() to delay. 1782 func (e *ExpectedSetSecurity) WillDelay(delay time.Duration) *ExpectedSetSecurity { 1783 e.delay = delay 1784 return e 1785 } 1786 1787 func (e *ExpectedSetSecurity) met(ex expectation) bool { 1788 exp := ex.(*ExpectedSetSecurity) 1789 if exp.arg0 != nil && !reflect.DeepEqual(exp.arg0, e.arg0) { 1790 return false 1791 } 1792 return true 1793 } 1794 1795 func (e *ExpectedSetSecurity) method(v bool) string { 1796 if !v { 1797 return "DB.SetSecurity()" 1798 } 1799 arg0 := "?" 1800 if e.arg0 != nil { 1801 arg0 = fmt.Sprintf("%v", e.arg0) 1802 } 1803 return fmt.Sprintf("DB(%s).SetSecurity(ctx, %s)", e.dbo().name, arg0) 1804 } 1805 1806 // ExpectedStats represents an expectation for a call to DB.Stats(). 1807 type ExpectedStats struct { 1808 commonExpectation 1809 callback func(ctx context.Context) (*driver.DBStats, error) 1810 ret0 *driver.DBStats 1811 } 1812 1813 // WillExecute sets a callback function to be called with any inputs to the 1814 // original function. Any values returned by the callback will be returned as 1815 // if generated by the driver. 1816 func (e *ExpectedStats) WillExecute(cb func(ctx context.Context) (*driver.DBStats, error)) *ExpectedStats { 1817 e.callback = cb 1818 return e 1819 } 1820 1821 // WillReturn sets the values that will be returned by the call to DB.Stats(). 1822 func (e *ExpectedStats) WillReturn(ret0 *driver.DBStats) *ExpectedStats { 1823 e.ret0 = ret0 1824 return e 1825 } 1826 1827 // WillReturnError sets the error value that will be returned by the call to DB.Stats(). 1828 func (e *ExpectedStats) WillReturnError(err error) *ExpectedStats { 1829 e.err = err 1830 return e 1831 } 1832 1833 // WillDelay causes the call to DB.Stats() to delay. 1834 func (e *ExpectedStats) WillDelay(delay time.Duration) *ExpectedStats { 1835 e.delay = delay 1836 return e 1837 } 1838 1839 func (e *ExpectedStats) met(_ expectation) bool { 1840 return true 1841 } 1842 1843 func (e *ExpectedStats) method(v bool) string { 1844 if !v { 1845 return "DB.Stats()" 1846 } 1847 return fmt.Sprintf("DB(%s).Stats(ctx)", e.dbo().name) 1848 }