mongo

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package mongo is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = mgo.ErrNotFound

Functions

func FormatAddr

func FormatAddr(hosts []string) string

Types

type BulkInserter

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

func NewBulkInserter

func NewBulkInserter(session *mgo.Session, dbName string, collectionNamer func() string) *BulkInserter

func (*BulkInserter) Flush

func (bi *BulkInserter) Flush()

func (*BulkInserter) Insert

func (bi *BulkInserter) Insert(doc interface{})

func (*BulkInserter) SetResultHandler

func (bi *BulkInserter) SetResultHandler(handler ResultHandler)

type ClosableIter

type ClosableIter struct {
	Iter
	Cleanup func()
}

func (*ClosableIter) Close

func (it *ClosableIter) Close() error

type Collection

type Collection interface {
	Find(query interface{}) Query
	FindId(id interface{}) Query
	Insert(docs ...interface{}) error
	Pipe(pipeline interface{}) Pipe
	Remove(selector interface{}) error
	RemoveAll(selector interface{}) (*mgo.ChangeInfo, error)
	RemoveId(id interface{}) error
	Update(selector, update interface{}) error
	UpdateId(id, update interface{}) error
	Upsert(selector, update interface{}) (*mgo.ChangeInfo, error)
}

type Iter

type Iter interface {
	All(result interface{}) error
	Close() error
	Done() bool
	Err() error
	For(result interface{}, f func() error) error
	Next(result interface{}) bool
	State() (int64, []bson.Raw)
	Timeout() bool
}

type MockIter

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

MockIter is a mock of Iter interface

func NewMockIter

func NewMockIter(ctrl *gomock.Controller) *MockIter

NewMockIter creates a new mock instance

func (*MockIter) All

func (m *MockIter) All(result interface{}) error

All mocks base method

func (*MockIter) Close

func (m *MockIter) Close() error

Close mocks base method

func (*MockIter) Done

func (m *MockIter) Done() bool

Done mocks base method

func (*MockIter) EXPECT

func (m *MockIter) EXPECT() *MockIterMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockIter) Err

func (m *MockIter) Err() error

Err mocks base method

func (*MockIter) For

func (m *MockIter) For(result interface{}, f func() error) error

For mocks base method

func (*MockIter) Next

func (m *MockIter) Next(result interface{}) bool

Next mocks base method

func (*MockIter) State

func (m *MockIter) State() (int64, []bson.Raw)

State mocks base method

func (*MockIter) Timeout

func (m *MockIter) Timeout() bool

Timeout mocks base method

type MockIterMockRecorder

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

MockIterMockRecorder is the mock recorder for MockIter

func (*MockIterMockRecorder) All

func (mr *MockIterMockRecorder) All(result interface{}) *gomock.Call

All indicates an expected call of All

func (*MockIterMockRecorder) Close

func (mr *MockIterMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockIterMockRecorder) Done

func (mr *MockIterMockRecorder) Done() *gomock.Call

Done indicates an expected call of Done

func (*MockIterMockRecorder) Err

func (mr *MockIterMockRecorder) Err() *gomock.Call

Err indicates an expected call of Err

func (*MockIterMockRecorder) For

func (mr *MockIterMockRecorder) For(result, f interface{}) *gomock.Call

For indicates an expected call of For

func (*MockIterMockRecorder) Next

func (mr *MockIterMockRecorder) Next(result interface{}) *gomock.Call

Next indicates an expected call of Next

func (*MockIterMockRecorder) State

func (mr *MockIterMockRecorder) State() *gomock.Call

State indicates an expected call of State

func (*MockIterMockRecorder) Timeout

func (mr *MockIterMockRecorder) Timeout() *gomock.Call

Timeout indicates an expected call of Timeout

type Model

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

func MustNewModel

func MustNewModel(url, collection string, opts ...Option) *Model

func NewModel

func NewModel(url, collection string, opts ...Option) (*Model, error)

func (*Model) Find

func (mm *Model) Find(query interface{}) (Query, error)

func (*Model) FindId

func (mm *Model) FindId(id interface{}) (Query, error)

func (*Model) GetCollection

func (mm *Model) GetCollection(session *mgo.Session) Collection

func (*Model) Insert

func (mm *Model) Insert(docs ...interface{}) error

func (*Model) Pipe

func (mm *Model) Pipe(pipeline interface{}) (Pipe, error)

func (*Model) PutSession

func (mm *Model) PutSession(session *mgo.Session)

func (*Model) Remove

func (mm *Model) Remove(selector interface{}) error

func (*Model) RemoveAll

func (mm *Model) RemoveAll(selector interface{}) (*mgo.ChangeInfo, error)

func (*Model) RemoveId

func (mm *Model) RemoveId(id interface{}) error

func (*Model) TakeSession

func (mm *Model) TakeSession() (*mgo.Session, error)

func (*Model) Update

func (mm *Model) Update(selector, update interface{}) error

func (*Model) UpdateId

func (mm *Model) UpdateId(id, update interface{}) error

func (*Model) Upsert

func (mm *Model) Upsert(selector, update interface{}) (*mgo.ChangeInfo, error)

type Option

type Option func(opts *options)

func WithTimeout

func WithTimeout(timeout time.Duration) Option

type Pipe

type Pipe interface {
	All(result interface{}) error
	AllowDiskUse() Pipe
	Batch(n int) Pipe
	Collation(collation *mgo.Collation) Pipe
	Explain(result interface{}) error
	Iter() Iter
	One(result interface{}) error
	SetMaxTime(d time.Duration) Pipe
}

type Query

type Query interface {
	All(result interface{}) error
	Apply(change mgo.Change, result interface{}) (*mgo.ChangeInfo, error)
	Batch(n int) Query
	Collation(collation *mgo.Collation) Query
	Comment(comment string) Query
	Count() (int, error)
	Distinct(key string, result interface{}) error
	Explain(result interface{}) error
	For(result interface{}, f func() error) error
	Hint(indexKey ...string) Query
	Iter() Iter
	Limit(n int) Query
	LogReplay() Query
	MapReduce(job *mgo.MapReduce, result interface{}) (*mgo.MapReduceInfo, error)
	One(result interface{}) error
	Prefetch(p float64) Query
	Select(selector interface{}) Query
	SetMaxScan(n int) Query
	SetMaxTime(d time.Duration) Query
	Skip(n int) Query
	Snapshot() Query
	Sort(fields ...string) Query
	Tail(timeout time.Duration) Iter
}

type ResultHandler

type ResultHandler func(*mgo.BulkResult, error)

Directories

Path Synopsis
Package internal is a generated GoMock package.
Package internal is a generated GoMock package.

Jump to

Keyboard shortcuts

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