mongodb

package
v1.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MongodbTimeoutConnect is the timeout for connecting to the database
	MongodbTimeoutConnect = 10 * time.Second
	// MongodbTimeoutCommit is the timeout for committing a batch transaction
	MongodbTimeoutCommit = 12 * time.Second
	// MongodbTimeoutQuery is the timeout for querying the database
	MongodbTimeoutQuery = 4 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyVal

type KeyVal struct {
	Key   string `bson:"_id" json:"key"` // needs to be an ugly string because of regex
	Value []byte `bson:"value" json:"value"`
}

type MongoDB

type MongoDB struct {
	// contains filtered or unexported fields
}

MongoDB is a MongoDB implementation of the db.DB interface

func New

func New(opts db.Options) (*MongoDB, error)

func (*MongoDB) Close

func (d *MongoDB) Close() error

func (*MongoDB) Compact

func (d *MongoDB) Compact() error

func (*MongoDB) Get

func (d *MongoDB) Get(key []byte) ([]byte, error)

func (*MongoDB) Iterate

func (d *MongoDB) Iterate(prefix []byte, callback func(key, value []byte) bool) error

func (*MongoDB) WriteTx

func (d *MongoDB) WriteTx() db.WriteTx

type WriteTx

type WriteTx struct {
	// contains filtered or unexported fields
}

func (*WriteTx) Apply

func (tx *WriteTx) Apply(other db.WriteTx) error

func (*WriteTx) Commit

func (tx *WriteTx) Commit() error

func (*WriteTx) Delete

func (tx *WriteTx) Delete(k []byte) error

func (*WriteTx) Discard

func (tx *WriteTx) Discard()

func (*WriteTx) Get

func (tx *WriteTx) Get(k []byte) ([]byte, error)

func (*WriteTx) Iterate

func (tx *WriteTx) Iterate(prefix []byte, callback func(key, value []byte) bool) error

func (*WriteTx) Set

func (tx *WriteTx) Set(k, v []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL