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

Function getScopeAndCollectionFromKeyspace

rest/utilities_testing.go:2482–2491  ·  view source on GitHub ↗

getScopeAndCollectionFromKeyspace returns the scope and collection from a keyspace, e.g. /db/ -> _default._default , or /db.scope1.collection1 -> scope1.collection1

(t testing.TB, keyspace string)

Source from the content-addressed store, hash-verified

2480
2481// getScopeAndCollectionFromKeyspace returns the scope and collection from a keyspace, e.g. /db/ -> _default._default , or /db.scope1.collection1 -> scope1.collection1
2482func getScopeAndCollectionFromKeyspace(t testing.TB, keyspace string) string {
2483 _, scope, collection, err := ParseKeyspace(keyspace)
2484 require.NoError(t, err)
2485 if scope == nil && collection == nil {
2486 return strings.Join([]string{base.DefaultScope, base.DefaultCollection}, base.ScopeCollectionSeparator)
2487 }
2488 require.NotNil(t, scope, "Expected scope to be non-nil for %s", keyspace)
2489 require.NotNil(t, collection, "Expected collection to be non-nil for %s", keyspace)
2490 return strings.Join([]string{*scope, *collection}, base.ScopeCollectionSeparator)
2491}
2492
2493// getKeyspaces returns the names of all the keyspaces on the rest tester. Currently assumes a single database.
2494func getKeyspaces(t testing.TB, database *db.DatabaseContext) []string {

Callers 1

templateResourceMethod · 0.85

Calls 1

ParseKeyspaceFunction · 0.85

Tested by

no test coverage detected