Documentation
¶
Index ¶
- func WriteToResultInterface(value, result interface{}) error
- type Collection
- type CollectionMock
- func (c *CollectionMock) Count() (int, error)
- func (c *CollectionMock) DropAllIndexes() error
- func (c *CollectionMock) DropCollection() error
- func (c *CollectionMock) DropIndex(key ...string) error
- func (c *CollectionMock) DropIndexName(name string) error
- func (c *CollectionMock) EnsureIndex(index mgo.Index) error
- func (c *CollectionMock) EnsureIndexKey(key ...string) error
- func (c *CollectionMock) Find(query interface{}) Query
- func (c *CollectionMock) FindId(id interface{}) Query
- func (c *CollectionMock) FindWithPaging(query interface{}, skip, limit int) (Query, int, error)
- func (c *CollectionMock) Indexes() ([]mgo.Index, error)
- func (c *CollectionMock) Insert(docs ...interface{}) error
- func (c *CollectionMock) Remove(selector interface{}) error
- func (c *CollectionMock) RemoveAll(selector interface{}) (*mgo.ChangeInfo, error)
- func (c *CollectionMock) RemoveId(id interface{}) error
- func (c *CollectionMock) Update(selector interface{}, update interface{}) error
- func (c *CollectionMock) UpdateAll(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
- func (c *CollectionMock) UpdateId(id interface{}, update interface{}) error
- func (c *CollectionMock) Upsert(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
- func (c *CollectionMock) UpsertId(id interface{}, update interface{}) (*mgo.ChangeInfo, error)
- type Database
- type DatabaseMock
- type DatabaseUploadResponse
- type DatabaseUploader
- type GridFS
- type GridFSMock
- func (g *GridFSMock) Create(name string) (GridFile, error)
- func (g *GridFSMock) Find(query interface{}) Query
- func (g *GridFSMock) Open(name string) (GridFile, error)
- func (g *GridFSMock) OpenId(id interface{}) (GridFile, error)
- func (g *GridFSMock) Remove(name string) (err error)
- func (g *GridFSMock) RemoveId(id interface{}) error
- type GridFile
- type GridFileMock
- func (g *GridFileMock) Abort()
- func (g *GridFileMock) Close() error
- func (g *GridFileMock) ContentType() string
- func (g *GridFileMock) GetMeta(result interface{}) error
- func (g *GridFileMock) Id() interface{}
- func (g *GridFileMock) MD5() string
- func (g *GridFileMock) Name() string
- func (g *GridFileMock) Read(b []byte) (int, error)
- func (g *GridFileMock) Seek(offset int64, whence int) (int64, error)
- func (g *GridFileMock) SetChunkSize(bytes int)
- func (g *GridFileMock) SetContentType(ctype string)
- func (g *GridFileMock) SetId(id interface{})
- func (g *GridFileMock) SetMeta(metadata interface{})
- func (g *GridFileMock) SetName(name string)
- func (g *GridFileMock) SetUploadDate(t time.Time)
- func (g *GridFileMock) Size() int64
- func (g *GridFileMock) Write(data []byte) (int, error)
- type Iter
- type IterMock
- func (i *IterMock) All(result interface{}) error
- func (i *IterMock) Close() error
- func (i *IterMock) Done() bool
- func (i *IterMock) Err() error
- func (i *IterMock) For(result interface{}, f func() error) error
- func (i *IterMock) Next(result interface{}) bool
- func (i *IterMock) State() (int64, []bson.Raw)
- func (i *IterMock) Timeout() bool
- type MongoCollection
- func (c *MongoCollection) Count() (int, error)
- func (c *MongoCollection) DropAllIndexes() error
- func (c *MongoCollection) DropCollection() error
- func (c *MongoCollection) DropIndex(key ...string) error
- func (c *MongoCollection) DropIndexName(name string) error
- func (c *MongoCollection) EnsureIndex(index mgo.Index) error
- func (c *MongoCollection) EnsureIndexKey(key ...string) error
- func (c *MongoCollection) Find(query interface{}) Query
- func (c *MongoCollection) FindId(id interface{}) Query
- func (c *MongoCollection) FindWithPaging(query interface{}, skip, limit int) (Query, int, error)
- func (c *MongoCollection) Indexes() ([]mgo.Index, error)
- func (c *MongoCollection) Insert(docs ...interface{}) error
- func (c *MongoCollection) Remove(selector interface{}) error
- func (c *MongoCollection) RemoveAll(selector interface{}) (*mgo.ChangeInfo, error)
- func (c *MongoCollection) RemoveId(id interface{}) error
- func (c *MongoCollection) Update(selector interface{}, update interface{}) error
- func (c *MongoCollection) UpdateAll(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
- func (c *MongoCollection) UpdateId(id interface{}, update interface{}) error
- func (c *MongoCollection) Upsert(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
- func (c *MongoCollection) UpsertId(id interface{}, update interface{}) (*mgo.ChangeInfo, error)
- type MongoDatabase
- type MongoGridFS
- func (gfs *MongoGridFS) Create(name string) (GridFile, error)
- func (gfs *MongoGridFS) Find(query interface{}) Query
- func (gfs *MongoGridFS) Open(name string) (GridFile, error)
- func (gfs *MongoGridFS) OpenId(id interface{}) (GridFile, error)
- func (gfs *MongoGridFS) Remove(name string) error
- func (gfs *MongoGridFS) RemoveId(id interface{}) error
- type MongoGridFile
- func (mgf *MongoGridFile) Abort()
- func (mgf *MongoGridFile) Close() error
- func (mgf *MongoGridFile) ContentType() string
- func (mgf *MongoGridFile) GetMeta(result interface{}) error
- func (mgf *MongoGridFile) Id() interface{}
- func (mgf *MongoGridFile) MD5() string
- func (mgf *MongoGridFile) Name() string
- func (mgf *MongoGridFile) Read(b []byte) (int, error)
- func (mgf *MongoGridFile) Seek(offset int64, whence int) (int64, error)
- func (mgf *MongoGridFile) SetChunkSize(bytes int)
- func (mgf *MongoGridFile) SetContentType(ctype string)
- func (mgf *MongoGridFile) SetId(id interface{})
- func (mgf *MongoGridFile) SetMeta(metadata interface{})
- func (mgf *MongoGridFile) SetName(name string)
- func (mgf *MongoGridFile) SetUploadDate(t time.Time)
- func (mgf *MongoGridFile) Size() int64
- func (mgf *MongoGridFile) Write(data []byte) (int, error)
- type MongoIter
- func (iter *MongoIter) All(result interface{}) error
- func (iter *MongoIter) Close() error
- func (iter *MongoIter) Done() bool
- func (iter *MongoIter) Err() error
- func (iter *MongoIter) For(result interface{}, f func() error) error
- func (iter *MongoIter) Next(result interface{}) bool
- func (iter *MongoIter) State() (int64, []bson.Raw)
- func (iter *MongoIter) Timeout() bool
- type MongoQuery
- func (q *MongoQuery) All(result interface{}) error
- func (q *MongoQuery) Count() (int, error)
- func (q *MongoQuery) Distinct(key string, result interface{}) error
- func (q *MongoQuery) Limit(n int) Query
- func (q *MongoQuery) One(result interface{}) error
- func (q *MongoQuery) Select(selector interface{}) Query
- func (q *MongoQuery) Skip(n int) Query
- func (q *MongoQuery) Sort(fields ...string) Query
- type MongoSession
- type MongoUploader
- type Query
- type QueryMock
- func (q *QueryMock) All(result interface{}) error
- func (q *QueryMock) Count() (int, error)
- func (q *QueryMock) Distinct(key string, result interface{}) error
- func (q *QueryMock) Limit(n int) Query
- func (q *QueryMock) One(result interface{}) error
- func (q *QueryMock) Select(selector interface{}) Query
- func (q *QueryMock) Skip(n int) Query
- func (q *QueryMock) Sort(fields ...string) Query
- type Session
- type SessionMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteToResultInterface ¶
func WriteToResultInterface(value, result interface{}) error
WriteToResultInterface writes a value to an interface
Types ¶
type Collection ¶
type Collection interface {
Count() (int, error)
DropAllIndexes() error
DropCollection() error
DropIndex(key ...string) error
DropIndexName(name string) error
EnsureIndex(index mgo.Index) error
EnsureIndexKey(key ...string) error
Find(query interface{}) Query
FindWithPaging(query interface{}, skip, limit int) (Query, int, error)
FindId(id interface{}) Query
Indexes() ([]mgo.Index, error)
Insert(docs ...interface{}) error
Remove(selector interface{}) error
RemoveAll(selector interface{}) (*mgo.ChangeInfo, error)
RemoveId(id interface{}) error
Update(selector interface{}, update interface{}) error
UpdateAll(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
UpdateId(id interface{}, update interface{}) error
Upsert(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
UpsertId(id interface{}, update interface{}) (*mgo.ChangeInfo, error)
}
Collection is an interface to access to the collection struct.
type CollectionMock ¶
type CollectionMock struct {
CountFunc func() (int, error)
DropAllIndexesFunc func() error
DropCollectionFunc func() error
DropIndexFunc func(key ...string) error
DropIndexNameFunc func(name string) error
EnsureIndexFunc func(index mgo.Index) error
EnsureIndexKeyFunc func(key ...string) error
FindFunc func(query interface{}) Query
FindIdFunc func(id interface{}) Query
FindWithPagingFunc func(query interface{}, skip, limit int) (Query, int, error)
IndexesFunc func() ([]mgo.Index, error)
InsertFunc func(docs ...interface{}) error
RemoveFunc func(selector interface{}) error
RemoveAllFunc func(selector interface{}) (*mgo.ChangeInfo, error)
RemoveIdFunc func(id interface{}) error
UpdateFunc func(selector interface{}, update interface{}) error
UpdateAllFunc func(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
UpdateIdFunc func(id interface{}, update interface{}) error
UpsertFunc func(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
UpsertIdFunc func(id interface{}, update interface{}) (*mgo.ChangeInfo, error)
}
CollectionMock is a mock Collection
func (*CollectionMock) Count ¶
func (c *CollectionMock) Count() (int, error)
Count is a mock function
func (*CollectionMock) DropAllIndexes ¶
func (c *CollectionMock) DropAllIndexes() error
DropAllIndexes is a mock function
func (*CollectionMock) DropCollection ¶
func (c *CollectionMock) DropCollection() error
DropCollection is a mock function
func (*CollectionMock) DropIndex ¶
func (c *CollectionMock) DropIndex(key ...string) error
DropIndex is a mock function
func (*CollectionMock) DropIndexName ¶
func (c *CollectionMock) DropIndexName(name string) error
DropIndexName is a mock function
func (*CollectionMock) EnsureIndex ¶
func (c *CollectionMock) EnsureIndex(index mgo.Index) error
EnsureIndex is a mock function
func (*CollectionMock) EnsureIndexKey ¶
func (c *CollectionMock) EnsureIndexKey(key ...string) error
EnsureIndexKey is a mock function
func (*CollectionMock) Find ¶
func (c *CollectionMock) Find(query interface{}) Query
Find is a mock function
func (*CollectionMock) FindId ¶
func (c *CollectionMock) FindId(id interface{}) Query
FindId is a mock function
func (*CollectionMock) FindWithPaging ¶
func (c *CollectionMock) FindWithPaging(query interface{}, skip, limit int) (Query, int, error)
FindWithPaging is a mock function
func (*CollectionMock) Indexes ¶
func (c *CollectionMock) Indexes() ([]mgo.Index, error)
Indexes is a mock function
func (*CollectionMock) Insert ¶
func (c *CollectionMock) Insert(docs ...interface{}) error
Insert is a mock function
func (*CollectionMock) Remove ¶
func (c *CollectionMock) Remove(selector interface{}) error
Remov is a mock functione
func (*CollectionMock) RemoveAll ¶
func (c *CollectionMock) RemoveAll(selector interface{}) (*mgo.ChangeInfo, error)
RemoveAll is a mock function
func (*CollectionMock) RemoveId ¶
func (c *CollectionMock) RemoveId(id interface{}) error
RemoveId is a mock function
func (*CollectionMock) Update ¶
func (c *CollectionMock) Update(selector interface{}, update interface{}) error
Update is a mock function
func (*CollectionMock) UpdateAll ¶
func (c *CollectionMock) UpdateAll(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
UpdateAll is a mock function
func (*CollectionMock) UpdateId ¶
func (c *CollectionMock) UpdateId(id interface{}, update interface{}) error
UpdateId is a mock function
func (*CollectionMock) Upsert ¶
func (c *CollectionMock) Upsert(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
Upsert is a mock function
func (*CollectionMock) UpsertId ¶
func (c *CollectionMock) UpsertId(id interface{}, update interface{}) (*mgo.ChangeInfo, error)
UpsertId is a mock function
type Database ¶
type Database interface {
C(name string) Collection
GridFS(prefix string) GridFS
}
DataLayer is an interface to access to the database struct.
type DatabaseMock ¶
type DatabaseMock struct {
CFunc func(name string) Collection
GridFSFunc func(prefix string) GridFS
}
DatabaseMock is a mock Database
func (*DatabaseMock) GridFS ¶
func (d *DatabaseMock) GridFS(prefix string) GridFS
GridFS is a mock function
type DatabaseUploadResponse ¶
type DatabaseUploadResponse struct {
BytesWritten int `json:"bytesWritten"`
FileID bson.ObjectId `json:"fileID"`
FileName string `json:"fileName"`
Height int `json:"height"`
Width int `json:"width"`
}
A DatabaseUploadResponse is used to alert a caller information about their uploaded file.
type DatabaseUploader ¶
type DatabaseUploader interface {
Upload(reader io.Reader, name, path string) (*DatabaseUploadResponse, error)
}
A DatabaseUploader defines an interface for uploading files to a database
type GridFS ¶
type GridFS interface {
Create(name string) (GridFile, error)
Find(query interface{}) Query
Open(name string) (GridFile, error)
OpenId(id interface{}) (GridFile, error)
Remove(name string) (err error)
RemoveId(id interface{}) error
}
GridFS stores files in a MongoDB database
type GridFSMock ¶
type GridFSMock struct {
CreateFunc func(name string) (GridFile, error)
FindFunc func(query interface{}) Query
OpenFunc func(name string) (GridFile, error)
OpenIdFunc func(id interface{}) (GridFile, error)
RemoveFunc func(name string) (err error)
RemoveIdFunc func(id interface{}) error
}
GridFSMock mocks GridFS
func (*GridFSMock) Create ¶
func (g *GridFSMock) Create(name string) (GridFile, error)
All is a mock function
func (*GridFSMock) Open ¶
func (g *GridFSMock) Open(name string) (GridFile, error)
All is a mock function
func (*GridFSMock) OpenId ¶
func (g *GridFSMock) OpenId(id interface{}) (GridFile, error)
All is a mock function
func (*GridFSMock) Remove ¶
func (g *GridFSMock) Remove(name string) (err error)
All is a mock function
func (*GridFSMock) RemoveId ¶
func (g *GridFSMock) RemoveId(id interface{}) error
All is a mock function
type GridFile ¶
type GridFile interface {
Abort()
Close() error
ContentType() string
GetMeta(result interface{}) error
Id() interface{}
MD5() string
Name() string
Read(b []byte) (int, error)
Seek(offset int64, whence int) (int64, error)
SetChunkSize(bytes int)
SetContentType(ctype string)
SetId(id interface{})
SetMeta(metadata interface{})
SetName(name string)
SetUploadDate(t time.Time)
Size() int64
Write(data []byte) (int, error)
}
GridFile represents a single file in GridFS
type GridFileMock ¶
type GridFileMock struct {
AbortFunc func()
CloseFunc func() error
ContentTypeFunc func() string
GetMetaFunc func(result interface{}) error
IdFunc func() interface{}
MD5Func func() string
NameFunc func() string
ReadFunc func(b []byte) (int, error)
SeekFunc func(offset int64, whence int) (int64, error)
SetChunkSizeFunc func(bytes int)
SetContentTypeFunc func(ctype string)
SetIdFunc func(id interface{})
SetMetaFunc func(metadata interface{})
SetNameFunc func(name string)
SetUploadDateFunc func(t time.Time)
SizeFunc func() int64
WriteFunc func(data []byte) (int, error)
}
GridFileMock is a mock GridFile
func (*GridFileMock) ContentType ¶
func (g *GridFileMock) ContentType() string
All is a mock function
func (*GridFileMock) GetMeta ¶
func (g *GridFileMock) GetMeta(result interface{}) error
All is a mock function
func (*GridFileMock) Read ¶
func (g *GridFileMock) Read(b []byte) (int, error)
All is a mock function
func (*GridFileMock) Seek ¶
func (g *GridFileMock) Seek(offset int64, whence int) (int64, error)
All is a mock function
func (*GridFileMock) SetChunkSize ¶
func (g *GridFileMock) SetChunkSize(bytes int)
All is a mock function
func (*GridFileMock) SetContentType ¶
func (g *GridFileMock) SetContentType(ctype string)
All is a mock function
func (*GridFileMock) SetMeta ¶
func (g *GridFileMock) SetMeta(metadata interface{})
All is a mock function
func (*GridFileMock) SetUploadDate ¶
func (g *GridFileMock) SetUploadDate(t time.Time)
All is a mock function
type IterMock ¶
type IterMock struct {
AllFunc func(result interface{}) error
CloseFunc func() error
DoneFunc func() bool
ErrFunc func() error
ForFunc func(result interface{}, f func() error) error
NextFunc func(result interface{}) bool
StateFunc func() (int64, []bson.Raw)
TimeoutFunc func() bool
}
IterMock is a mock Iter
type MongoCollection ¶
type MongoCollection struct {
*mgo.Collection
}
MongoCollection wraps a mgo.Collection to embed methods in models.
func (*MongoCollection) Count ¶
func (c *MongoCollection) Count() (int, error)
func (*MongoCollection) DropAllIndexes ¶
func (c *MongoCollection) DropAllIndexes() error
func (*MongoCollection) DropCollection ¶
func (c *MongoCollection) DropCollection() error
func (*MongoCollection) DropIndex ¶
func (c *MongoCollection) DropIndex(key ...string) error
func (*MongoCollection) DropIndexName ¶
func (c *MongoCollection) DropIndexName(name string) error
func (*MongoCollection) EnsureIndex ¶
func (c *MongoCollection) EnsureIndex(index mgo.Index) error
func (*MongoCollection) EnsureIndexKey ¶
func (c *MongoCollection) EnsureIndexKey(key ...string) error
func (*MongoCollection) Find ¶
func (c *MongoCollection) Find(query interface{}) Query
Find shadows *mgo.Collection to returns a Query interface instead of *mgo.Query.
func (*MongoCollection) FindId ¶
func (c *MongoCollection) FindId(id interface{}) Query
func (*MongoCollection) FindWithPaging ¶
func (c *MongoCollection) FindWithPaging(query interface{}, skip, limit int) (Query, int, error)
func (*MongoCollection) Insert ¶
func (c *MongoCollection) Insert(docs ...interface{}) error
func (*MongoCollection) Remove ¶
func (c *MongoCollection) Remove(selector interface{}) error
func (*MongoCollection) RemoveAll ¶
func (c *MongoCollection) RemoveAll(selector interface{}) (*mgo.ChangeInfo, error)
func (*MongoCollection) RemoveId ¶
func (c *MongoCollection) RemoveId(id interface{}) error
func (*MongoCollection) Update ¶
func (c *MongoCollection) Update(selector interface{}, update interface{}) error
func (*MongoCollection) UpdateAll ¶
func (c *MongoCollection) UpdateAll(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
func (*MongoCollection) UpdateId ¶
func (c *MongoCollection) UpdateId(id interface{}, update interface{}) error
func (*MongoCollection) Upsert ¶
func (c *MongoCollection) Upsert(selector interface{}, update interface{}) (*mgo.ChangeInfo, error)
func (*MongoCollection) UpsertId ¶
func (c *MongoCollection) UpsertId(id interface{}, update interface{}) (*mgo.ChangeInfo, error)
type MongoDatabase ¶
MongoDatabase wraps a mgo.Database to embed methods in models.
func (MongoDatabase) C ¶
func (d MongoDatabase) C(name string) Collection
C shadows *mgo.DB to returns a DataLayer interface instead of *mgo.Database.
func (MongoDatabase) GridFS ¶
func (d MongoDatabase) GridFS(prefix string) GridFS
type MongoGridFS ¶
MongoGridFS is the wrapper around GridFS
func (*MongoGridFS) Create ¶
func (gfs *MongoGridFS) Create(name string) (GridFile, error)
Create makes a new GridFS storage
func (*MongoGridFS) Find ¶
func (gfs *MongoGridFS) Find(query interface{}) Query
Find queries GridFS
func (*MongoGridFS) Open ¶
func (gfs *MongoGridFS) Open(name string) (GridFile, error)
Open opens a grid file
func (*MongoGridFS) OpenId ¶
func (gfs *MongoGridFS) OpenId(id interface{}) (GridFile, error)
func (*MongoGridFS) Remove ¶
func (gfs *MongoGridFS) Remove(name string) error
func (*MongoGridFS) RemoveId ¶
func (gfs *MongoGridFS) RemoveId(id interface{}) error
type MongoGridFile ¶
func (*MongoGridFile) Abort ¶
func (mgf *MongoGridFile) Abort()
func (*MongoGridFile) Close ¶
func (mgf *MongoGridFile) Close() error
func (*MongoGridFile) ContentType ¶
func (mgf *MongoGridFile) ContentType() string
func (*MongoGridFile) GetMeta ¶
func (mgf *MongoGridFile) GetMeta(result interface{}) error
func (*MongoGridFile) Id ¶
func (mgf *MongoGridFile) Id() interface{}
func (*MongoGridFile) MD5 ¶
func (mgf *MongoGridFile) MD5() string
func (*MongoGridFile) Name ¶
func (mgf *MongoGridFile) Name() string
func (*MongoGridFile) Seek ¶
func (mgf *MongoGridFile) Seek(offset int64, whence int) (int64, error)
func (*MongoGridFile) SetChunkSize ¶
func (mgf *MongoGridFile) SetChunkSize(bytes int)
func (*MongoGridFile) SetContentType ¶
func (mgf *MongoGridFile) SetContentType(ctype string)
func (*MongoGridFile) SetId ¶
func (mgf *MongoGridFile) SetId(id interface{})
func (*MongoGridFile) SetMeta ¶
func (mgf *MongoGridFile) SetMeta(metadata interface{})
func (*MongoGridFile) SetName ¶
func (mgf *MongoGridFile) SetName(name string)
func (*MongoGridFile) SetUploadDate ¶
func (mgf *MongoGridFile) SetUploadDate(t time.Time)
func (*MongoGridFile) Size ¶
func (mgf *MongoGridFile) Size() int64
type MongoQuery ¶
MongoQuery wraps a mgo.Query to embed methods in models.
func (*MongoQuery) All ¶
func (q *MongoQuery) All(result interface{}) error
func (*MongoQuery) Count ¶
func (q *MongoQuery) Count() (int, error)
func (*MongoQuery) Distinct ¶
func (q *MongoQuery) Distinct(key string, result interface{}) error
func (*MongoQuery) Limit ¶
func (q *MongoQuery) Limit(n int) Query
func (*MongoQuery) One ¶
func (q *MongoQuery) One(result interface{}) error
func (*MongoQuery) Select ¶
func (q *MongoQuery) Select(selector interface{}) Query
func (*MongoQuery) Skip ¶
func (q *MongoQuery) Skip(n int) Query
func (*MongoQuery) Sort ¶
func (q *MongoQuery) Sort(fields ...string) Query
type MongoSession ¶
MongoSession is currently a Mongo session.
func (MongoSession) DB ¶
func (s MongoSession) DB(name string) Database
DB shadows *mgo.DB to returns a DataLayer interface instead of *mgo.Database.
type MongoUploader ¶
type MongoUploader struct {
DB Database
}
A MongoUploader uploads files to a MongoDB database. This struct satisfies the DatabaseUploader interface
func (*MongoUploader) Upload ¶
func (u *MongoUploader) Upload(reader io.Reader, name, path string) (*DatabaseUploadResponse, error)
Upload uploads a file into the MongoDB GridFS system
type Query ¶
type Query interface {
All(result interface{}) error
Count() (int, error)
Distinct(key string, result interface{}) error
Limit(n int) Query
One(result interface{}) (err error)
Select(selector interface{}) Query
Skip(n int) Query
Sort(fields ...string) Query
}
Query is an interface to access to the database struct
type QueryMock ¶
type QueryMock struct {
AllFunc func(result interface{}) error
CountFunc func() (int, error)
DistinctFunc func(key string, result interface{}) error
LimitFunc func(n int) Query
OneFunc func(result interface{}) error
SelectFunc func(selector interface{}) Query
SkipFunc func(n int) Query
SortFunc func(fields ...string) Query
}
QueryMock mocks a Query
type SessionMock ¶
SessionMock is a mock of Session