MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / GetDatabase

Method GetDatabase

rest/server_context.go:319–326  ·  view source on GitHub ↗

GetDatabase attempts to return the DatabaseContext of the database. It will load the database if necessary.

(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

317
318// GetDatabase attempts to return the DatabaseContext of the database. It will load the database if necessary.
319func (sc *ServerContext) GetDatabase(ctx context.Context, name string) (*db.DatabaseContext, error) {
320 dbc, err := sc.GetActiveDatabase(name)
321 if err == base.ErrNotFound {
322 dbc, _, err := sc.GetInactiveDatabase(ctx, name)
323 return dbc, err
324 }
325 return dbc, err
326}
327
328// GetActiveDatabase attempts to return the DatabaseContext of a loaded database. If not found, the database name will be
329// validated to make sure it's valid and then an error returned.

Calls 2

GetActiveDatabaseMethod · 0.95
GetInactiveDatabaseMethod · 0.95