Couchbase Lite C
Couchbase Lite C API
Typedefs | Functions
Scope

A CBLScope represents a scope or namespace of the collections. More...

Typedefs

typedef struct CBLScope CBLScope
 A collection's scope. More...
 

Functions

static const CBLScopeCBLScope_Retain (const CBLScope *t)
 
static void CBLScope_Release (const CBLScope *t)
 

Default Scope Name

The default scope name constant.

CBL_PUBLIC const FLString kCBLDefaultScopeName
 The default scope's name. More...
 

Scope Accessors

Getting information about a scope.

FLString CBLScope_Name (const CBLScope *scope)
 Returns the name of the scope. More...
 
CBLDatabaseCBLScope_Database (const CBLScope *scope)
 Returns the scope's database. More...
 

Collections

Accessing the collections under the scope.

FLMutableArray _cbl_nullable CBLScope_CollectionNames (const CBLScope *scope, CBLError *_cbl_nullable outError)
 Returns the names of all collections in the scope. More...
 
CBLCollection *_cbl_nullable CBLScope_Collection (const CBLScope *scope, FLString collectionName, CBLError *_cbl_nullable outError)
 Returns an existing collection in the scope with the given name. More...
 

Detailed Description

A CBLScope represents a scope or namespace of the collections.

The scope implicitly exists when there is at least one collection created under the scope. The default scope is exceptional in that it will always exists even there are no collections under it.

CBLScope Lifespan

CBLScope is ref-counted. Same as the CBLCollection, the CBLScope objects retrieved from the database must be released after you are done using them. When the database is closed or released, the scope objects will become invalid, most operations on the invalid CBLCollection object will fail with kCBLErrorNotOpen error result.

Typedef Documentation

◆ CBLScope

typedef struct CBLScope CBLScope

A collection's scope.

Function Documentation

◆ CBLScope_Collection()

CBLCollection *_cbl_nullable CBLScope_Collection ( const CBLScope scope,
FLString  collectionName,
CBLError *_cbl_nullable  outError 
)

Returns an existing collection in the scope with the given name.

Note
You are responsible for releasing the returned collection.
Parameters
scopeThe scope.
collectionNameThe name of the collection.
outErrorOn failure, the error will be written here.
Returns
A CBLCollection instance, or NULL if the collection doesn't exist or an error occurred.

◆ CBLScope_CollectionNames()

FLMutableArray _cbl_nullable CBLScope_CollectionNames ( const CBLScope scope,
CBLError *_cbl_nullable  outError 
)

Returns the names of all collections in the scope.

Note
You are responsible for releasing the returned array.
Parameters
scopeThe scope.
outErrorOn failure, the error will be written here.
Returns
The names of all collections in the scope, or NULL if an error occurred.

◆ CBLScope_Database()

CBLDatabase * CBLScope_Database ( const CBLScope scope)

Returns the scope's database.

Note
The database object is owned by the scope object; you do not need to release it.
Parameters
scopeThe scope.
Returns
The database of the scope.

◆ CBLScope_Name()

FLString CBLScope_Name ( const CBLScope scope)

Returns the name of the scope.

Parameters
scopeThe scope.
Returns
The name of the scope.

◆ CBLScope_Release()

static void CBLScope_Release ( const CBLScope t)
inlinestatic

◆ CBLScope_Retain()

static const CBLScope * CBLScope_Retain ( const CBLScope t)
inlinestatic

Variable Documentation

◆ kCBLDefaultScopeName

CBL_PUBLIC const FLString kCBLDefaultScopeName
extern

The default scope's name.