KeyExists checks whether a key exists in the default collection for the specified bucket
(ctx context.Context, location, docID string)
| 432 | |
| 433 | // KeyExists checks whether a key exists in the default collection for the specified bucket |
| 434 | func (cc *CouchbaseCluster) KeyExists(ctx context.Context, location, docID string) (exists bool, err error) { |
| 435 | if cc == nil { |
| 436 | return false, errors.New("nil CouchbaseCluster") |
| 437 | } |
| 438 | |
| 439 | b, teardown, err := cc.getBucket(ctx, location) |
| 440 | |
| 441 | if err != nil { |
| 442 | return false, err |
| 443 | } |
| 444 | |
| 445 | defer teardown() |
| 446 | |
| 447 | return cc.configPersistence.keyExists(b.DefaultCollection(), docID) |
| 448 | } |
| 449 | |
| 450 | // GetDocument fetches a document from the default collection. Does not use configPersistence - callers |
| 451 | // requiring configPersistence handling should use GetMetadataDocument. |