-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructs.go
41 lines (35 loc) · 946 Bytes
/
structs.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
package betterwatcher
import (
"context"
"time"
"github.com/go-redis/redis"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
)
type WatcherFactory struct {
redisClient *redis.Client
options Options
}
type Options struct {
Context context.Context
AttachDocumentOnUpdate bool
WatcherSwitchAfter time.Duration
MaxRetries int
}
type RedisConfig struct {
Url string
Client *redis.Client
}
type ChangeDoc struct {
Id *bson.Raw `bson:"_id"`
DocKey struct {
Id primitive.ObjectID `bson:"_id"`
} `bson:"documentKey"`
Operation string `bson:"operationType"`
FullDoc *bson.Raw `bson:"fullDocument"`
Timestamp primitive.Timestamp `bson:"clusterTime"`
UpdateDescription struct {
UpdatedFields *bson.Raw `bson:"updatedFields"`
RemovedFields []string `bson:"removedFields"`
} `bson:"updateDescription"`
}