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

Function GetDefaultSyncFunction

channels/channelmapper.go:56–62  ·  view source on GitHub ↗

GetDefaultSyncFunction returns a sync function. The case of default collection will return a different sync function than one for collections.

(scopeName, collectionName string)

Source from the content-addressed store, hash-verified

54
55// GetDefaultSyncFunction returns a sync function. The case of default collection will return a different sync function than one for collections.
56func GetDefaultSyncFunction(scopeName, collectionName string) string {
57 if base.IsDefaultCollection(scopeName, collectionName) {
58 return DocChannelsSyncFunction
59 }
60 return `function(doc){channel("` + collectionName + `");}`
61
62}
63
64func (mapper *ChannelMapper) MapToChannelsAndAccess(ctx context.Context, body map[string]interface{}, oldBodyJSON string, metaMap map[string]interface{}, userCtx map[string]interface{}) (*ChannelMapperOutput, error) {
65 numberFixBody := ConvertJSONNumbers(body)

Callers 5

NewDatabaseContextFunction · 0.92
SyncFnDryRunMethod · 0.92
TestDefaultChannelMapperFunction · 0.85

Calls 1

IsDefaultCollectionFunction · 0.92

Tested by 3

TestDefaultChannelMapperFunction · 0.68