Documentation ¶
Overview ¶
Package mongo provides basic API for documents management in a mongo database.
Index ¶
- Variables
- func Delete(col *mgo.Collection, idStr string) error
- func GetID(col *mgo.Collection, idStr string, dst interface{}) error
- func GetOne(col *mgo.Collection, query, dst interface{}) error
- func Save(col *mgo.Collection, selector interface{}, item interface{}) error
- func UpdateID(col *mgo.Collection, idStr string, set interface{}, dst interface{}) error
- func UpdateOne(col *mgo.Collection, query, set, dst interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidID = errors.New("invalid ID")
)
Functions ¶
func GetID ¶
func GetID(col *mgo.Collection, idStr string, dst interface{}) error
GetID fetches a document from a database into the provided interface.
func GetOne ¶
func GetOne(col *mgo.Collection, query, dst interface{}) error
GetOne fetches an item from a database.
func Save ¶
func Save(col *mgo.Collection, selector interface{}, item interface{}) error
func UpdateID ¶
func UpdateID(col *mgo.Collection, idStr string, set interface{}, dst interface{}) error
UpdateID updates a database by the specified ID with the provided mgo.Change.
func UpdateOne ¶
func UpdateOne(col *mgo.Collection, query, set, dst interface{}) error
UpdateOne updates a record found by a query.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.