Versions in this module Expand all Collapse all v1 v1.1.0 May 26, 2022 v1.0.0 May 26, 2022 Changes in this version + var ErrCursorNotFound = errors.New("cursor not found") + var ErrDocumentTooLarge = errors.New("an inserted document is too large") + var ErrFilterType = errors.New("filter for list collections operation must be a string") + var ErrMultiDocCommandResponse = errors.New("command returned multiple documents") + var ErrNoDocCommandResponse = errors.New("command returned no documents") + var ErrNonPrimaryReadPref = errors.New("read preference in a transaction must be primary") + var ErrReplyDocumentMismatch = errors.New("number of documents returned does not match numberReturned field") + var ErrUnacknowledgedWrite = errors.New("unacknowledged write") + var ErrUnsupportedStorageEngine = errors.New(...) + var NetworkError = "NetworkError" + var TransientTransactionError = "TransientTransactionError" + var UnknownTransactionCommitResult = "UnknownTransactionCommitResult" + type BatchCursor struct + func NewBatchCursor(cr CursorResponse, clientSession *session.Client, clock *session.ClusterClock, ...) (*BatchCursor, error) + func NewEmptyBatchCursor() *BatchCursor + func (bc *BatchCursor) Batch() *bsoncore.DocumentSequence + func (bc *BatchCursor) Close(ctx context.Context) error + func (bc *BatchCursor) Err() error + func (bc *BatchCursor) ID() int64 + func (bc *BatchCursor) KillCursor(ctx context.Context) error + func (bc *BatchCursor) Next(ctx context.Context) bool + func (bc *BatchCursor) PostBatchResumeToken() bsoncore.Document + func (bc *BatchCursor) Server() Server + type Batches struct + Current []bsoncore.Document + Documents []bsoncore.Document + Identifier string + Ordered *bool + func (b *Batches) AdvanceBatch(maxCount, targetBatchSize int) error + func (b *Batches) ClearBatch() + func (b *Batches) Valid() bool + type Compressor interface + CompressWireMessage func(src, dst []byte) ([]byte, error) + type Connection interface + Address func() address.Address + Close func() error + Description func() description.Server + ID func() string + ReadWireMessage func(ctx context.Context, dst []byte) ([]byte, error) + WriteWireMessage func(context.Context, []byte) error + type CursorOptions struct + BatchSize int32 + CommandMonitor *event.CommandMonitor + Limit int32 + MaxTimeMS int64 + type CursorResponse struct + Collection string + Database string + Desc description.Server + FirstBatch *bsoncore.DocumentSequence + ID int64 + Server Server + func NewCursorResponse(response bsoncore.Document, server Server, desc description.Server) (CursorResponse, error) + type Deployment interface + Kind func() description.TopologyKind + SelectServer func(context.Context, description.ServerSelector) (Server, error) + SupportsRetryWrites func() bool + type Error struct + Code int32 + Labels []string + Message string + Name string + func (e Error) Error() string + func (e Error) HasErrorLabel(label string) bool + func (e Error) NamespaceNotFound() bool + func (e Error) NetworkError() bool + func (e Error) NodeIsRecovering() bool + func (e Error) NodeIsShuttingDown() bool + func (e Error) NotMaster() bool + func (e Error) Retryable() bool + func (e Error) UnsupportedStorageEngine() bool + type ErrorProcessor interface + ProcessError func(error) + type Expirable interface + Alive func() bool + Expire func() error + type Handshaker interface + FinishHandshake func(context.Context, Connection) error + GetDescription func(context.Context, address.Address, Connection) (description.Server, error) + type InvalidOperationError struct + MissingField string + func (err InvalidOperationError) Error() string + type LegacyOperationKind uint + const LegacyFind + const LegacyGetMore + const LegacyKillCursors + const LegacyListCollections + const LegacyListIndexes + const LegacyNone + type ListCollectionsBatchCursor struct + func NewLegacyListCollectionsBatchCursor(bc *BatchCursor) (*ListCollectionsBatchCursor, error) + func NewListCollectionsBatchCursor(bc *BatchCursor) (*ListCollectionsBatchCursor, error) + func (lcbc *ListCollectionsBatchCursor) Batch() *bsoncore.DocumentSequence + func (lcbc *ListCollectionsBatchCursor) Close(ctx context.Context) error + func (lcbc *ListCollectionsBatchCursor) Err() error + func (lcbc *ListCollectionsBatchCursor) ID() int64 + func (lcbc *ListCollectionsBatchCursor) Next(ctx context.Context) bool + func (lcbc *ListCollectionsBatchCursor) Server() Server + type LocalAddresser interface + LocalAddress func() address.Address + type Operation struct + Batches *Batches + Client *session.Client + Clock *session.ClusterClock + CommandFn func(dst []byte, desc description.SelectedServer) ([]byte, error) + CommandMonitor *event.CommandMonitor + Database string + Deployment Deployment + Legacy LegacyOperationKind + MinimumReadConcernWireVersion int32 + MinimumWriteConcernWireVersion int32 + ProcessResponseFn func(response bsoncore.Document, srvr Server, desc description.Server) error + ReadConcern *readconcern.ReadConcern + ReadPreference *readpref.ReadPref + RetryMode *RetryMode + Selector description.ServerSelector + Type Type + WriteConcern *writeconcern.WriteConcern + func (op Operation) Execute(ctx context.Context, scratch []byte) error + func (op Operation) Validate() error + type QueryFailureError struct + Message string + Response bsoncore.Document + func (e QueryFailureError) Error() string + type ResponseError struct + Message string + Wrapped error + func NewCommandResponseError(msg string, err error) ResponseError + func (e ResponseError) Error() string + type RetryMode uint + const RetryContext + const RetryNone + const RetryOnce + const RetryOncePerCommand + func (rm RetryMode) Enabled() bool + type Server interface + Connection func(context.Context) (Connection, error) + type SingleConnectionDeployment struct + C Connection + func (ssd SingleConnectionDeployment) Connection(context.Context) (Connection, error) + func (ssd SingleConnectionDeployment) Kind() description.TopologyKind + func (ssd SingleConnectionDeployment) SelectServer(context.Context, description.ServerSelector) (Server, error) + func (ssd SingleConnectionDeployment) SupportsRetryWrites() bool + type SingleServerDeployment struct + func (SingleServerDeployment) Kind() description.TopologyKind + func (SingleServerDeployment) SupportsRetryWrites() bool + func (ssd SingleServerDeployment) SelectServer(context.Context, description.ServerSelector) (Server, error) + type Type uint + const Read + const Write + type WriteCommandError struct + WriteConcernError *WriteConcernError + WriteErrors WriteErrors + func (wce WriteCommandError) Error() string + func (wce WriteCommandError) Retryable() bool + func (wce WriteCommandError) UnsupportedStorageEngine() bool + type WriteConcernError struct + Code int64 + Details bsoncore.Document + Message string + Name string + func (wce WriteConcernError) Error() string + func (wce WriteConcernError) NodeIsRecovering() bool + func (wce WriteConcernError) NodeIsShuttingDown() bool + func (wce WriteConcernError) NotMaster() bool + func (wce WriteConcernError) Retryable() bool + type WriteError struct + Code int64 + Index int64 + Message string + func (we WriteError) Error() string + type WriteErrors []WriteError + func (we WriteErrors) Error() string