collection.go 655 B

12345678910111213141516171819
  1. //go:generate mockgen -package internal -destination collection_mock.go -source collection.go
  2. package internal
  3. import "github.com/globalsign/mgo"
  4. // MgoCollection interface represents a mgo collection.
  5. type MgoCollection interface {
  6. Find(query interface{}) *mgo.Query
  7. FindId(id interface{}) *mgo.Query
  8. Insert(docs ...interface{}) error
  9. Pipe(pipeline interface{}) *mgo.Pipe
  10. Remove(selector interface{}) error
  11. RemoveAll(selector interface{}) (*mgo.ChangeInfo, error)
  12. RemoveId(id interface{}) error
  13. Update(selector, update interface{}) error
  14. UpdateId(id, update interface{}) error
  15. Upsert(selector, update interface{}) (*mgo.ChangeInfo, error)
  16. }