CBLIndexable
@protocol CBLIndexable <NSObject>
The Indexable interface defines a set of functions for managing the query indexes.
-
Get the names of all indexes of the collection.
Declaration
Objective-C
- (nullable NSArray<NSString *> *)indexes:(NSError *_Nullable *_Nullable)error;
Parameters
error
On return, the error if any.
Return Value
Names of all indexes of the collection or empty array if no indexes exist. It will return nil if an error occurred.
-
Create an index with the index name and config.
Declaration
Objective-C
- (BOOL)createIndexWithName:(nonnull NSString *)name config:(nonnull CBLIndexConfiguration *)config error:(NSError *_Nullable *_Nullable)error;
Parameters
name
The index name.
config
The index configuration.
error
On return, the error if any.
Return Value
True if index is created successfully, otherwise false.
-
Create an index with the index name and index.
Note
To be used with Index BuilderDeclaration
Objective-C
- (BOOL)createIndex:(nonnull CBLIndex *)index name:(nonnull NSString *)name error:(NSError *_Nullable *_Nullable)error;
Parameters
index
The index instance.
name
The index name.
error
On return, the error if any.
Return Value
True if index is created successfully, otherwise false.
-
Delete an index by name.
Declaration
Objective-C
- (BOOL)deleteIndexWithName:(nonnull NSString *)name error:(NSError *_Nullable *_Nullable)error;
Parameters
name
The index name.
error
On return, the error if any.
Return Value
True if index is deleted successfully, otherwise false.
-
Get an index object by name.
Declaration
Objective-C
- (nullable CBLQueryIndex *)indexWithName:(nonnull NSString *)name error:(NSError *_Nullable *_Nullable)error;
Parameters
name
The index name.
error
On return, the error if any.
Return Value
The index object, or nil if the index does not exist or an error occurred.