/
opt_op_context_gen.go
47 lines (37 loc) · 960 Bytes
/
opt_op_context_gen.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
47
// Generated by optioner -type OpContext; DO NOT EDIT
// If you have any questions, please create issues and submit contributions at:
// https://github.com/chenmingyong0423/go-optioner
package operation
import (
"go.mongodb.org/mongo-driver/mongo"
)
type OpContextOption func(*OpContext)
func NewOpContext(col *mongo.Collection, opts ...OpContextOption) *OpContext {
opContext := &OpContext{
Col: col,
}
for _, opt := range opts {
opt(opContext)
}
return opContext
}
func WithDoc(doc any) OpContextOption {
return func(opContext *OpContext) {
opContext.Doc = doc
}
}
func WithFilter(filter any) OpContextOption {
return func(opContext *OpContext) {
opContext.Filter = filter
}
}
func WithReplacement(replacement any) OpContextOption {
return func(opContext *OpContext) {
opContext.Replacement = replacement
}
}
func WithUpdate(update any) OpContextOption {
return func(opContext *OpContext) {
opContext.Updates = update
}
}