Versions in this module Expand all Collapse all v1 v1.0.1 Jun 16, 2021 v1.0.0 Jun 11, 2021 Changes in this version + var ErrNotFound = mgo.ErrNotFound + func FormatAddr(hosts []string) string + type BulkInserter struct + func NewBulkInserter(session *mgo.Session, dbName string, collectionNamer func() string) *BulkInserter + func (bi *BulkInserter) Flush() + func (bi *BulkInserter) Insert(doc interface{}) + func (bi *BulkInserter) SetResultHandler(handler ResultHandler) + type ClosableIter struct + Cleanup func() + func (it *ClosableIter) Close() error + type Collection interface + Find func(query interface{}) Query + FindId func(id interface{}) Query + Insert func(docs ...interface{}) error + Pipe func(pipeline interface{}) Pipe + Remove func(selector interface{}) error + RemoveAll func(selector interface{}) (*mgo.ChangeInfo, error) + RemoveId func(id interface{}) error + Update func(selector, update interface{}) error + UpdateId func(id, update interface{}) error + Upsert func(selector, update interface{}) (*mgo.ChangeInfo, error) + type Iter interface + All func(result interface{}) error + Close func() error + Done func() bool + Err func() error + For func(result interface{}, f func() error) error + Next func(result interface{}) bool + State func() (int64, []bson.Raw) + Timeout func() bool + type MockIter struct + func NewMockIter(ctrl *gomock.Controller) *MockIter + func (m *MockIter) All(result interface{}) error + func (m *MockIter) Close() error + func (m *MockIter) Done() bool + func (m *MockIter) EXPECT() *MockIterMockRecorder + func (m *MockIter) Err() error + func (m *MockIter) For(result interface{}, f func() error) error + func (m *MockIter) Next(result interface{}) bool + func (m *MockIter) State() (int64, []bson.Raw) + func (m *MockIter) Timeout() bool + type MockIterMockRecorder struct + func (mr *MockIterMockRecorder) All(result interface{}) *gomock.Call + func (mr *MockIterMockRecorder) Close() *gomock.Call + func (mr *MockIterMockRecorder) Done() *gomock.Call + func (mr *MockIterMockRecorder) Err() *gomock.Call + func (mr *MockIterMockRecorder) For(result, f interface{}) *gomock.Call + func (mr *MockIterMockRecorder) Next(result interface{}) *gomock.Call + func (mr *MockIterMockRecorder) State() *gomock.Call + func (mr *MockIterMockRecorder) Timeout() *gomock.Call + type Model struct + func MustNewModel(url, collection string, opts ...Option) *Model + func NewModel(url, collection string, opts ...Option) (*Model, error) + func (mm *Model) Find(query interface{}) (Query, error) + func (mm *Model) FindId(id interface{}) (Query, error) + func (mm *Model) GetCollection(session *mgo.Session) Collection + func (mm *Model) Insert(docs ...interface{}) error + func (mm *Model) Pipe(pipeline interface{}) (Pipe, error) + func (mm *Model) PutSession(session *mgo.Session) + func (mm *Model) Remove(selector interface{}) error + func (mm *Model) RemoveAll(selector interface{}) (*mgo.ChangeInfo, error) + func (mm *Model) RemoveId(id interface{}) error + func (mm *Model) TakeSession() (*mgo.Session, error) + func (mm *Model) Update(selector, update interface{}) error + func (mm *Model) UpdateId(id, update interface{}) error + func (mm *Model) Upsert(selector, update interface{}) (*mgo.ChangeInfo, error) + type Option func(opts *options) + func WithTimeout(timeout time.Duration) Option + type Pipe interface + All func(result interface{}) error + AllowDiskUse func() Pipe + Batch func(n int) Pipe + Collation func(collation *mgo.Collation) Pipe + Explain func(result interface{}) error + Iter func() Iter + One func(result interface{}) error + SetMaxTime func(d time.Duration) Pipe + type Query interface + All func(result interface{}) error + Apply func(change mgo.Change, result interface{}) (*mgo.ChangeInfo, error) + Batch func(n int) Query + Collation func(collation *mgo.Collation) Query + Comment func(comment string) Query + Count func() (int, error) + Distinct func(key string, result interface{}) error + Explain func(result interface{}) error + For func(result interface{}, f func() error) error + Hint func(indexKey ...string) Query + Iter func() Iter + Limit func(n int) Query + LogReplay func() Query + MapReduce func(job *mgo.MapReduce, result interface{}) (*mgo.MapReduceInfo, error) + One func(result interface{}) error + Prefetch func(p float64) Query + Select func(selector interface{}) Query + SetMaxScan func(n int) Query + SetMaxTime func(d time.Duration) Query + Skip func(n int) Query + Snapshot func() Query + Sort func(fields ...string) Query + Tail func(timeout time.Duration) Iter + type ResultHandler func(*mgo.BulkResult, error)