mongox

package
v2.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingResumeToken  = mongo.ErrMissingResumeToken
	ErrNilCursor           = mongo.ErrNilCursor
	ErrUnacknowledgedWrite = mongo.ErrUnacknowledgedWrite
	ErrClientDisconnected  = mongo.ErrClientDisconnected
	ErrNilDocument         = mongo.ErrNilDocument
	ErrEmptySlice          = mongo.ErrEmptySlice
	ErrInvalidIndexValue   = mongo.ErrInvalidIndexValue
	ErrNonStringIndexName  = mongo.ErrNonStringIndexName
	ErrMultipleIndexDrop   = mongo.ErrMultipleIndexDrop
	ErrWrongClient         = mongo.ErrWrongClient
	ErrNoDocuments         = mongo.ErrNoDocuments
)

Reexported mongo errors

Functions

This section is empty.

Types

type Client

type Client = mongo.Client

Reexport basic mongo structs

type Collection

type Collection = mongo.Collection

Reexport basic mongo structs

type Cursor

type Cursor = mongo.Cursor

Reexport basic mongo structs

type Database

type Database interface {
	Client() (client *Client)
	Context() (context context.Context)
	Name() (name string)
	New(ctx context.Context) (db Database)
	GetCollectionOf(document interface{}) (collection *Collection)
	Count(target interface{}, filters ...interface{}) (count int64, err error)
	DeleteArray(target interface{}, filters ...interface{}) (err error)
	DeleteOne(target interface{}, filters ...interface{}) (err error)
	LoadArray(target interface{}, filters ...interface{}) (err error)
	LoadOne(target interface{}, filters ...interface{}) (err error)
	LoadStream(target interface{}, filters ...interface{}) (loader StreamLoader, err error)
	SaveOne(source interface{}, filters ...interface{}) (err error)
	UpdateOne(target interface{}, filters ...interface{}) (err error)
	IndexEnsure(cfg interface{}, document interface{}) (err error)
}

Database is the mongox database interface

type InterfaceBased

type InterfaceBased interface {
	GetID() (id interface{})
	SetID(id interface{})
}

InterfaceBased is an interface for documents that have custom declated type for the _id field

type JSONBased

type JSONBased interface {
	GetID() (id primitive.D)
	SetID(id primitive.D)
}

JSONBased is an interface for documents that have object type for the _id field

type OIDBased

type OIDBased interface {
	GetID() (id primitive.ObjectID)
	SetID(id primitive.ObjectID)
}

OIDBased is an interface for documents that have objectId type for the _id field

type StreamLoader

type StreamLoader interface {
	Cursor() (cursor *Cursor)
	DecodeNextMsg(i interface{}) (err error)
	DecodeMsg(i interface{}) (err error)
	Next() (err error)
	Close() (err error)
	Err() (err error)
}

StreamLoader is a interface to control database cursor

type StringBased

type StringBased interface {
	GetID() (id string)
	SetID(id string)
}

StringBased is an interface for documents that have string type for the _id field

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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