-
Notifications
You must be signed in to change notification settings - Fork 883
/
models.go
81 lines (65 loc) · 2.14 KB
/
models.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright (C) MongoDB, Inc. 2017-present.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
package driver
import (
"go.mongodb.org/mongo-driver/mongo/options"
)
// WriteModel is the interface satisfied by all models for bulk writes.
type WriteModel interface {
writeModel()
}
// InsertOneModel is the write model for insert operations.
type InsertOneModel struct {
Document interface{}
}
func (InsertOneModel) writeModel() {}
// DeleteOneModel is the write model for delete operations.
type DeleteOneModel struct {
Filter interface{}
Collation *options.Collation
}
func (DeleteOneModel) writeModel() {}
// DeleteManyModel is the write model for deleteMany operations.
type DeleteManyModel struct {
Filter interface{}
Collation *options.Collation
}
func (DeleteManyModel) writeModel() {}
// UpdateModel contains the fields that are shared between the ReplaceOneModel, UpdateOneModel, and UpdateManyModel types
type UpdateModel struct {
Collation *options.Collation
Upsert bool
UpsertSet bool
}
// ReplaceOneModel is the write model for replace operations.
type ReplaceOneModel struct {
Filter interface{}
Replacement interface{}
UpdateModel
}
func (ReplaceOneModel) writeModel() {}
// UpdateOneModel is the write model for update operations.
type UpdateOneModel struct {
Filter interface{}
Update interface{}
// default is to not send a value. for servers < 3.6, error raised if value given. for unack writes using opcodes,
// error raised if value given
ArrayFilters options.ArrayFilters
ArrayFiltersSet bool
UpdateModel
}
func (UpdateOneModel) writeModel() {}
// UpdateManyModel is the write model for updateMany operations.
type UpdateManyModel struct {
Filter interface{}
Update interface{}
// default is to not send a value. for servers < 3.6, error raised if value given. for unack writes using opcodes,
// error raised if value given
ArrayFilters options.ArrayFilters
ArrayFiltersSet bool
UpdateModel
}
func (UpdateManyModel) writeModel() {}