github.com/go-kivik/kivik/v4@v4.3.2/mockdb/db_gen.go (about) 1 /* This file is auto-generated. Do not edit it! */ 2 3 package mockdb 4 5 import ( 6 "context" 7 8 "github.com/go-kivik/kivik/v4/driver" 9 ) 10 11 var _ = (*driver.Attachment)(nil) 12 13 func (db *driverDB) Compact(ctx context.Context) error { 14 expected := &ExpectedCompact{ 15 commonExpectation: commonExpectation{ 16 db: db.DB, 17 }, 18 } 19 if err := db.client.nextExpectation(expected); err != nil { 20 return err 21 } 22 if expected.callback != nil { 23 return expected.callback(ctx) 24 } 25 return expected.wait(ctx) 26 } 27 28 func (db *driverDB) CompactView(ctx context.Context, arg0 string) error { 29 expected := &ExpectedCompactView{ 30 arg0: arg0, 31 commonExpectation: commonExpectation{ 32 db: db.DB, 33 }, 34 } 35 if err := db.client.nextExpectation(expected); err != nil { 36 return err 37 } 38 if expected.callback != nil { 39 return expected.callback(ctx, arg0) 40 } 41 return expected.wait(ctx) 42 } 43 44 func (db *driverDB) Copy(ctx context.Context, arg0 string, arg1 string, options driver.Options) (string, error) { 45 expected := &ExpectedCopy{ 46 arg0: arg0, 47 arg1: arg1, 48 commonExpectation: commonExpectation{ 49 db: db.DB, 50 options: options, 51 }, 52 } 53 if err := db.client.nextExpectation(expected); err != nil { 54 return "", err 55 } 56 if expected.callback != nil { 57 return expected.callback(ctx, arg0, arg1, options) 58 } 59 return expected.ret0, expected.wait(ctx) 60 } 61 62 func (db *driverDB) CreateDoc(ctx context.Context, arg0 interface{}, options driver.Options) (string, string, error) { 63 expected := &ExpectedCreateDoc{ 64 arg0: arg0, 65 commonExpectation: commonExpectation{ 66 db: db.DB, 67 options: options, 68 }, 69 } 70 if err := db.client.nextExpectation(expected); err != nil { 71 return "", "", err 72 } 73 if expected.callback != nil { 74 return expected.callback(ctx, arg0, options) 75 } 76 return expected.ret0, expected.ret1, expected.wait(ctx) 77 } 78 79 func (db *driverDB) CreateIndex(ctx context.Context, arg0 string, arg1 string, arg2 interface{}, options driver.Options) error { 80 expected := &ExpectedCreateIndex{ 81 arg0: arg0, 82 arg1: arg1, 83 arg2: arg2, 84 commonExpectation: commonExpectation{ 85 db: db.DB, 86 options: options, 87 }, 88 } 89 if err := db.client.nextExpectation(expected); err != nil { 90 return err 91 } 92 if expected.callback != nil { 93 return expected.callback(ctx, arg0, arg1, arg2, options) 94 } 95 return expected.wait(ctx) 96 } 97 98 func (db *driverDB) DeleteIndex(ctx context.Context, arg0 string, arg1 string, options driver.Options) error { 99 expected := &ExpectedDeleteIndex{ 100 arg0: arg0, 101 arg1: arg1, 102 commonExpectation: commonExpectation{ 103 db: db.DB, 104 options: options, 105 }, 106 } 107 if err := db.client.nextExpectation(expected); err != nil { 108 return err 109 } 110 if expected.callback != nil { 111 return expected.callback(ctx, arg0, arg1, options) 112 } 113 return expected.wait(ctx) 114 } 115 116 func (db *driverDB) Flush(ctx context.Context) error { 117 expected := &ExpectedFlush{ 118 commonExpectation: commonExpectation{ 119 db: db.DB, 120 }, 121 } 122 if err := db.client.nextExpectation(expected); err != nil { 123 return err 124 } 125 if expected.callback != nil { 126 return expected.callback(ctx) 127 } 128 return expected.wait(ctx) 129 } 130 131 func (db *driverDB) GetRev(ctx context.Context, arg0 string, options driver.Options) (string, error) { 132 expected := &ExpectedGetRev{ 133 arg0: arg0, 134 commonExpectation: commonExpectation{ 135 db: db.DB, 136 options: options, 137 }, 138 } 139 if err := db.client.nextExpectation(expected); err != nil { 140 return "", err 141 } 142 if expected.callback != nil { 143 return expected.callback(ctx, arg0, options) 144 } 145 return expected.ret0, expected.wait(ctx) 146 } 147 148 func (db *driverDB) Put(ctx context.Context, arg0 string, arg1 interface{}, options driver.Options) (string, error) { 149 expected := &ExpectedPut{ 150 arg0: arg0, 151 arg1: arg1, 152 commonExpectation: commonExpectation{ 153 db: db.DB, 154 options: options, 155 }, 156 } 157 if err := db.client.nextExpectation(expected); err != nil { 158 return "", err 159 } 160 if expected.callback != nil { 161 return expected.callback(ctx, arg0, arg1, options) 162 } 163 return expected.ret0, expected.wait(ctx) 164 } 165 166 func (db *driverDB) ViewCleanup(ctx context.Context) error { 167 expected := &ExpectedViewCleanup{ 168 commonExpectation: commonExpectation{ 169 db: db.DB, 170 }, 171 } 172 if err := db.client.nextExpectation(expected); err != nil { 173 return err 174 } 175 if expected.callback != nil { 176 return expected.callback(ctx) 177 } 178 return expected.wait(ctx) 179 } 180 181 func (db *driverDB) AllDocs(ctx context.Context, options driver.Options) (driver.Rows, error) { 182 expected := &ExpectedAllDocs{ 183 commonExpectation: commonExpectation{ 184 db: db.DB, 185 options: options, 186 }, 187 } 188 if err := db.client.nextExpectation(expected); err != nil { 189 return nil, err 190 } 191 if expected.callback != nil { 192 return expected.callback(ctx, options) 193 } 194 return &driverRows{Context: ctx, Rows: coalesceRows(expected.ret0)}, expected.wait(ctx) 195 } 196 197 func (db *driverDB) BulkDocs(ctx context.Context, arg0 []interface{}, options driver.Options) ([]driver.BulkResult, error) { 198 expected := &ExpectedBulkDocs{ 199 arg0: arg0, 200 commonExpectation: commonExpectation{ 201 db: db.DB, 202 options: options, 203 }, 204 } 205 if err := db.client.nextExpectation(expected); err != nil { 206 return nil, err 207 } 208 if expected.callback != nil { 209 return expected.callback(ctx, arg0, options) 210 } 211 return expected.ret0, expected.wait(ctx) 212 } 213 214 func (db *driverDB) BulkGet(ctx context.Context, arg0 []driver.BulkGetReference, options driver.Options) (driver.Rows, error) { 215 expected := &ExpectedBulkGet{ 216 arg0: arg0, 217 commonExpectation: commonExpectation{ 218 db: db.DB, 219 options: options, 220 }, 221 } 222 if err := db.client.nextExpectation(expected); err != nil { 223 return nil, err 224 } 225 if expected.callback != nil { 226 return expected.callback(ctx, arg0, options) 227 } 228 return &driverRows{Context: ctx, Rows: coalesceRows(expected.ret0)}, expected.wait(ctx) 229 } 230 231 func (db *driverDB) Changes(ctx context.Context, options driver.Options) (driver.Changes, error) { 232 expected := &ExpectedChanges{ 233 commonExpectation: commonExpectation{ 234 db: db.DB, 235 options: options, 236 }, 237 } 238 if err := db.client.nextExpectation(expected); err != nil { 239 return nil, err 240 } 241 if expected.callback != nil { 242 return expected.callback(ctx, options) 243 } 244 return &driverChanges{Context: ctx, Changes: coalesceChanges(expected.ret0)}, expected.wait(ctx) 245 } 246 247 func (db *driverDB) Delete(ctx context.Context, arg0 string, options driver.Options) (string, error) { 248 expected := &ExpectedDelete{ 249 arg0: arg0, 250 commonExpectation: commonExpectation{ 251 db: db.DB, 252 options: options, 253 }, 254 } 255 if err := db.client.nextExpectation(expected); err != nil { 256 return "", err 257 } 258 if expected.callback != nil { 259 return expected.callback(ctx, arg0, options) 260 } 261 return expected.ret0, expected.wait(ctx) 262 } 263 264 func (db *driverDB) DeleteAttachment(ctx context.Context, arg0 string, arg1 string, options driver.Options) (string, error) { 265 expected := &ExpectedDeleteAttachment{ 266 arg0: arg0, 267 arg1: arg1, 268 commonExpectation: commonExpectation{ 269 db: db.DB, 270 options: options, 271 }, 272 } 273 if err := db.client.nextExpectation(expected); err != nil { 274 return "", err 275 } 276 if expected.callback != nil { 277 return expected.callback(ctx, arg0, arg1, options) 278 } 279 return expected.ret0, expected.wait(ctx) 280 } 281 282 func (db *driverDB) DesignDocs(ctx context.Context, options driver.Options) (driver.Rows, error) { 283 expected := &ExpectedDesignDocs{ 284 commonExpectation: commonExpectation{ 285 db: db.DB, 286 options: options, 287 }, 288 } 289 if err := db.client.nextExpectation(expected); err != nil { 290 return nil, err 291 } 292 if expected.callback != nil { 293 return expected.callback(ctx, options) 294 } 295 return &driverRows{Context: ctx, Rows: coalesceRows(expected.ret0)}, expected.wait(ctx) 296 } 297 298 func (db *driverDB) Explain(ctx context.Context, arg0 interface{}, options driver.Options) (*driver.QueryPlan, error) { 299 expected := &ExpectedExplain{ 300 arg0: arg0, 301 commonExpectation: commonExpectation{ 302 db: db.DB, 303 options: options, 304 }, 305 } 306 if err := db.client.nextExpectation(expected); err != nil { 307 return nil, err 308 } 309 if expected.callback != nil { 310 return expected.callback(ctx, arg0, options) 311 } 312 return expected.ret0, expected.wait(ctx) 313 } 314 315 func (db *driverDB) Find(ctx context.Context, arg0 interface{}, options driver.Options) (driver.Rows, error) { 316 expected := &ExpectedFind{ 317 arg0: arg0, 318 commonExpectation: commonExpectation{ 319 db: db.DB, 320 options: options, 321 }, 322 } 323 if err := db.client.nextExpectation(expected); err != nil { 324 return nil, err 325 } 326 if expected.callback != nil { 327 return expected.callback(ctx, arg0, options) 328 } 329 return &driverRows{Context: ctx, Rows: coalesceRows(expected.ret0)}, expected.wait(ctx) 330 } 331 332 func (db *driverDB) Get(ctx context.Context, arg0 string, options driver.Options) (*driver.Document, error) { 333 expected := &ExpectedGet{ 334 arg0: arg0, 335 commonExpectation: commonExpectation{ 336 db: db.DB, 337 options: options, 338 }, 339 } 340 if err := db.client.nextExpectation(expected); err != nil { 341 return nil, err 342 } 343 if expected.callback != nil { 344 return expected.callback(ctx, arg0, options) 345 } 346 return expected.ret0, expected.wait(ctx) 347 } 348 349 func (db *driverDB) GetAttachment(ctx context.Context, arg0 string, arg1 string, options driver.Options) (*driver.Attachment, error) { 350 expected := &ExpectedGetAttachment{ 351 arg0: arg0, 352 arg1: arg1, 353 commonExpectation: commonExpectation{ 354 db: db.DB, 355 options: options, 356 }, 357 } 358 if err := db.client.nextExpectation(expected); err != nil { 359 return nil, err 360 } 361 if expected.callback != nil { 362 return expected.callback(ctx, arg0, arg1, options) 363 } 364 return expected.ret0, expected.wait(ctx) 365 } 366 367 func (db *driverDB) GetAttachmentMeta(ctx context.Context, arg0 string, arg1 string, options driver.Options) (*driver.Attachment, error) { 368 expected := &ExpectedGetAttachmentMeta{ 369 arg0: arg0, 370 arg1: arg1, 371 commonExpectation: commonExpectation{ 372 db: db.DB, 373 options: options, 374 }, 375 } 376 if err := db.client.nextExpectation(expected); err != nil { 377 return nil, err 378 } 379 if expected.callback != nil { 380 return expected.callback(ctx, arg0, arg1, options) 381 } 382 return expected.ret0, expected.wait(ctx) 383 } 384 385 func (db *driverDB) GetIndexes(ctx context.Context, options driver.Options) ([]driver.Index, error) { 386 expected := &ExpectedGetIndexes{ 387 commonExpectation: commonExpectation{ 388 db: db.DB, 389 options: options, 390 }, 391 } 392 if err := db.client.nextExpectation(expected); err != nil { 393 return nil, err 394 } 395 if expected.callback != nil { 396 return expected.callback(ctx, options) 397 } 398 return expected.ret0, expected.wait(ctx) 399 } 400 401 func (db *driverDB) LocalDocs(ctx context.Context, options driver.Options) (driver.Rows, error) { 402 expected := &ExpectedLocalDocs{ 403 commonExpectation: commonExpectation{ 404 db: db.DB, 405 options: options, 406 }, 407 } 408 if err := db.client.nextExpectation(expected); err != nil { 409 return nil, err 410 } 411 if expected.callback != nil { 412 return expected.callback(ctx, options) 413 } 414 return &driverRows{Context: ctx, Rows: coalesceRows(expected.ret0)}, expected.wait(ctx) 415 } 416 417 func (db *driverDB) OpenRevs(ctx context.Context, arg0 string, arg1 []string, options driver.Options) (driver.Rows, error) { 418 expected := &ExpectedOpenRevs{ 419 arg0: arg0, 420 arg1: arg1, 421 commonExpectation: commonExpectation{ 422 db: db.DB, 423 options: options, 424 }, 425 } 426 if err := db.client.nextExpectation(expected); err != nil { 427 return nil, err 428 } 429 if expected.callback != nil { 430 return expected.callback(ctx, arg0, arg1, options) 431 } 432 return &driverRows{Context: ctx, Rows: coalesceRows(expected.ret0)}, expected.wait(ctx) 433 } 434 435 func (db *driverDB) PartitionStats(ctx context.Context, arg0 string) (*driver.PartitionStats, error) { 436 expected := &ExpectedPartitionStats{ 437 arg0: arg0, 438 commonExpectation: commonExpectation{ 439 db: db.DB, 440 }, 441 } 442 if err := db.client.nextExpectation(expected); err != nil { 443 return nil, err 444 } 445 if expected.callback != nil { 446 return expected.callback(ctx, arg0) 447 } 448 return expected.ret0, expected.wait(ctx) 449 } 450 451 func (db *driverDB) Purge(ctx context.Context, arg0 map[string][]string) (*driver.PurgeResult, error) { 452 expected := &ExpectedPurge{ 453 arg0: arg0, 454 commonExpectation: commonExpectation{ 455 db: db.DB, 456 }, 457 } 458 if err := db.client.nextExpectation(expected); err != nil { 459 return nil, err 460 } 461 if expected.callback != nil { 462 return expected.callback(ctx, arg0) 463 } 464 return expected.ret0, expected.wait(ctx) 465 } 466 467 func (db *driverDB) PutAttachment(ctx context.Context, arg0 string, arg1 *driver.Attachment, options driver.Options) (string, error) { 468 expected := &ExpectedPutAttachment{ 469 arg0: arg0, 470 arg1: arg1, 471 commonExpectation: commonExpectation{ 472 db: db.DB, 473 options: options, 474 }, 475 } 476 if err := db.client.nextExpectation(expected); err != nil { 477 return "", err 478 } 479 if expected.callback != nil { 480 return expected.callback(ctx, arg0, arg1, options) 481 } 482 return expected.ret0, expected.wait(ctx) 483 } 484 485 func (db *driverDB) Query(ctx context.Context, arg0 string, arg1 string, options driver.Options) (driver.Rows, error) { 486 expected := &ExpectedQuery{ 487 arg0: arg0, 488 arg1: arg1, 489 commonExpectation: commonExpectation{ 490 db: db.DB, 491 options: options, 492 }, 493 } 494 if err := db.client.nextExpectation(expected); err != nil { 495 return nil, err 496 } 497 if expected.callback != nil { 498 return expected.callback(ctx, arg0, arg1, options) 499 } 500 return &driverRows{Context: ctx, Rows: coalesceRows(expected.ret0)}, expected.wait(ctx) 501 } 502 503 func (db *driverDB) RevsDiff(ctx context.Context, arg0 interface{}) (driver.Rows, error) { 504 expected := &ExpectedRevsDiff{ 505 arg0: arg0, 506 commonExpectation: commonExpectation{ 507 db: db.DB, 508 }, 509 } 510 if err := db.client.nextExpectation(expected); err != nil { 511 return nil, err 512 } 513 if expected.callback != nil { 514 return expected.callback(ctx, arg0) 515 } 516 return &driverRows{Context: ctx, Rows: coalesceRows(expected.ret0)}, expected.wait(ctx) 517 } 518 519 func (db *driverDB) Security(ctx context.Context) (*driver.Security, error) { 520 expected := &ExpectedSecurity{ 521 commonExpectation: commonExpectation{ 522 db: db.DB, 523 }, 524 } 525 if err := db.client.nextExpectation(expected); err != nil { 526 return nil, err 527 } 528 if expected.callback != nil { 529 return expected.callback(ctx) 530 } 531 return expected.ret0, expected.wait(ctx) 532 } 533 534 func (db *driverDB) SetSecurity(ctx context.Context, arg0 *driver.Security) error { 535 expected := &ExpectedSetSecurity{ 536 arg0: arg0, 537 commonExpectation: commonExpectation{ 538 db: db.DB, 539 }, 540 } 541 if err := db.client.nextExpectation(expected); err != nil { 542 return err 543 } 544 if expected.callback != nil { 545 return expected.callback(ctx, arg0) 546 } 547 return expected.wait(ctx) 548 } 549 550 func (db *driverDB) Stats(ctx context.Context) (*driver.DBStats, error) { 551 expected := &ExpectedStats{ 552 commonExpectation: commonExpectation{ 553 db: db.DB, 554 }, 555 } 556 if err := db.client.nextExpectation(expected); err != nil { 557 return nil, err 558 } 559 if expected.callback != nil { 560 return expected.callback(ctx) 561 } 562 return expected.ret0, expected.wait(ctx) 563 }