package writeconcern
import "go.mongodb.org/mongo-driver/mongo/writeconcern"
Index ¶
- Variables
- func AckWrite(wc *WriteConcern) bool
- func AcknowledgedValue(rawv bson.RawValue) bool
- type Option
- func J(j bool) Option
- func W(w int) Option
- func WMajority() Option
- func WTagSet(tag string) Option
- func WTimeout(d time.Duration) Option
- type WriteConcern
- func New(options ...Option) *WriteConcern
- func (wc *WriteConcern) Acknowledged() bool
- func (wc *WriteConcern) GetJ() bool
- func (wc *WriteConcern) GetW() interface{}
- func (wc *WriteConcern) GetWTimeout() time.Duration
- func (wc *WriteConcern) IsValid() bool
- func (wc *WriteConcern) MarshalBSONValue() (bsontype.Type, []byte, error)
- func (wc *WriteConcern) WithOptions(options ...Option) *WriteConcern
Variables ¶
ErrEmptyWriteConcern indicates that a write concern has no fields set.
ErrInconsistent indicates that an inconsistent write concern was specified.
ErrNegativeW indicates that a negative integer `w` field was specified.
ErrNegativeWTimeout indicates that a negative WTimeout was specified.
Functions ¶
func AckWrite ¶
func AckWrite(wc *WriteConcern) bool
AckWrite returns true if a write concern represents an acknowledged write
func AcknowledgedValue ¶
AcknowledgedValue returns true if a BSON RawValue for a write concern represents an acknowledged write concern. The element's value must be a document representing a write concern.
Types ¶
type Option ¶
type Option func(concern *WriteConcern)
Option is an option to provide when creating a WriteConcern.
func J ¶
J requests acknowledgement from MongoDB that write operations are written to the journal.
func W ¶
W requests acknowledgement that write operations propagate to the specified number of mongod instances.
func WMajority ¶
func WMajority() Option
WMajority requests acknowledgement that write operations propagate to the majority of mongod instances.
func WTagSet ¶
WTagSet requests acknowledgement that write operations propagate to the specified mongod instance.
func WTimeout ¶
WTimeout specifies specifies a time limit for the write concern.
Deprecated: This option is deprecated and will eventually be removed in version 2.0 of the driver. The more general Client, Database or Collection Timeout options should be used in its place to control the amount of time that a single operation can run before returning an error.
type WriteConcern ¶
type WriteConcern struct {
// contains filtered or unexported fields
}
WriteConcern describes the level of acknowledgement requested from MongoDB for write operations to a standalone mongod or to replica sets or to sharded clusters.
func New ¶
func New(options ...Option) *WriteConcern
New constructs a new WriteConcern.
func (*WriteConcern) Acknowledged ¶
func (wc *WriteConcern) Acknowledged() bool
Acknowledged indicates whether or not a write with the given write concern will be acknowledged.
func (*WriteConcern) GetJ ¶
func (wc *WriteConcern) GetJ() bool
GetJ returns the write concern journaling level.
func (*WriteConcern) GetW ¶
func (wc *WriteConcern) GetW() interface{}
GetW returns the write concern w level.
func (*WriteConcern) GetWTimeout ¶
func (wc *WriteConcern) GetWTimeout() time.Duration
GetWTimeout returns the write concern timeout.
func (*WriteConcern) IsValid ¶
func (wc *WriteConcern) IsValid() bool
IsValid checks whether the write concern is invalid.
func (*WriteConcern) MarshalBSONValue ¶
func (wc *WriteConcern) MarshalBSONValue() (bsontype.Type, []byte, error)
MarshalBSONValue implements the bson.ValueMarshaler interface.
func (*WriteConcern) WithOptions ¶
func (wc *WriteConcern) WithOptions(options ...Option) *WriteConcern
WithOptions returns a copy of this WriteConcern with the options set.
Source Files ¶
writeconcern.go
- Version
- v1.10.0
- Published
- Jul 14, 2022
- Platform
- windows/amd64
- Imports
- 5 packages
- Last checked
- 5 minutes ago –
Tools for package owners.