Mocking mgo chaining functions
问题 While testing some of my codebase I found it useful to mock out objects from "gopkg.in/mgo.v2" with interfaces. I'm running into a problem where mgo.Query does not implement my interface Query. import mgo "gopkg.in/mgo.v2" type Collection interface { FindId(interface{}) Query Find(interface{}) Query UpdateId(interface{}, interface{}) error Update(interface{}, interface{}) error UpsertId(interface{}, interface{}) (interface{}, error) Insert(...interface{}) error RemoveId(interface{}) error }