-
Notifications
You must be signed in to change notification settings - Fork 0
/
stream.go
46 lines (36 loc) · 1020 Bytes
/
stream.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package dbm
import (
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
type ChangeStreamOptions = options.ChangeStreamOptions
func NewChangeStreamOptions() *ChangeStreamOptions {
return options.ChangeStream()
}
type ChangeStream = mongo.ChangeStream
type OperationType string
const (
OperationTypeInsert = "insert"
OperationTypeDelete = "delete"
OperationTypeReplace = "replace"
OperationTypeUpdate = "update"
OperationTypeInvalidate = "invalidate"
)
type ChangeEvent struct {
Id EventId `bson:"_id"`
OperationType OperationType `bson:"operationType"`
ClusterTime Timestamp `bson:"clusterTime"`
Namespace Namespace `bson:"ns"`
WallTime DateTime `bson:"wallTime"`
DocumentKey DocumentKey `bson:"documentKey"`
}
type EventId struct {
Data string `bson:"_data"`
}
type Namespace struct {
Database string `bson:"db"`
Collection string `bson:"coll"`
}
type DocumentKey struct {
Id string `bson:"_id"`
}