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

Method RaiseDocumentChangeEvent

db/event_manager.go:163–178  ·  view source on GitHub ↗

Raises a document change event based on the the document body and channel set. If the event manager doesn't have a listener for this event, ignores.

(ctx context.Context, docBytes []byte, docID string, oldBodyJSON string, channels base.Set, winningRevChange bool)

Source from the content-addressed store, hash-verified

161// Raises a document change event based on the the document body and channel set. If the
162// event manager doesn't have a listener for this event, ignores.
163func (em *EventManager) RaiseDocumentChangeEvent(ctx context.Context, docBytes []byte, docID string, oldBodyJSON string, channels base.Set, winningRevChange bool) error {
164
165 if !em.activeEventTypes[DocumentChange] {
166 return nil
167 }
168 event := &DocumentChangeEvent{
169 DocID: docID,
170 DocBytes: docBytes,
171 OldDoc: oldBodyJSON,
172 Channels: channels,
173 WinningRevChange: winningRevChange,
174 }
175
176 return em.raiseEvent(ctx, event)
177
178}
179
180// Raises a DB state change event based on the db name, admininterface, new state, reason and local system time.
181// If the event manager doesn't have a listener for this event, ignores.

Callers 10

TestDocumentChangeEventFunction · 0.95
TestCustomHandlerFunction · 0.95
TestUnhandledEventFunction · 0.95
TestWebhookBasicFunction · 0.95
TestWebhookOverflowsFunction · 0.95
TestWebhookOldDocFunction · 0.95
TestWebhookTimeoutFunction · 0.95
TestUnavailableWebhookFunction · 0.95
updateAndReturnDocMethod · 0.80

Calls 1

raiseEventMethod · 0.95

Tested by 9

TestDocumentChangeEventFunction · 0.76
TestCustomHandlerFunction · 0.76
TestUnhandledEventFunction · 0.76
TestWebhookBasicFunction · 0.76
TestWebhookOverflowsFunction · 0.76
TestWebhookOldDocFunction · 0.76
TestWebhookTimeoutFunction · 0.76
TestUnavailableWebhookFunction · 0.76