refresh

package
v0.0.0-...-4bb1132 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(session *mgo.Session, collection *mgo.Collection, query interface{}) error

Delete remove documents from a collection.

func GetByID

func GetByID(session *mgo.Session, collection *mgo.Collection, id interface{}, i interface{})

GetByID get a single record by ID

func GetMany

func GetMany(session *mgo.Session, collection *mgo.Collection, q interface{}, doc interface{}) error

GetMany get multiple records based on a condition

func GetUniqueOne

func GetUniqueOne(session *mgo.Session, collection *mgo.Collection, q interface{}, doc interface{}) error

GetUniqueOne get a single record by query

func Insert

func Insert(session *mgo.Session, collection *mgo.Collection, doc interface{}) error

Insert add new documents to a collection.

func IsValidObjectHex

func IsValidObjectHex(id string) bool

IsValidObjectHex check whether the id can be converted to be a qualified ObjectId

func IsValidObjectID

func IsValidObjectID(id bson.ObjectId) bool

IsValidObjectID check whether the id is a qualified ObjectId

func Update

func Update(session *mgo.Session, collection *mgo.Collection, query interface{}, i interface{}) error

Update modify existing documents in a collection.

func UpdateByQueryField

func UpdateByQueryField(session *mgo.Session, collection *mgo.Collection, q interface{}, field string, value interface{}) (*mgo.ChangeInfo, error)

UpdateByQueryField modify all eligible documents.

func Upsert

func Upsert(session *mgo.Session, collection *mgo.Collection, query interface{}, i interface{}) (*mgo.ChangeInfo, error)

Upsert creates a new document and inserts it if no documents match the specified filter. If there are matching documents, then the operation modifies or replaces the matching document or documents.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL