Skip to content

FIPress/fipmgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fipmgo

fipmgo is a wrapper of mgo. It provides some convenient api to mgo.

Usage

  1. Init connection
dbConn := "mongodb://localhost/test"
fipmgo.InitMgoWithConn(dbConn)
  1. Get accessor by collection name
var userAccessor = &MgoAccessor{"user"}
  1. Use the accessor to do CRUD on the connection
userAccessor.Insert(user)
userAccessor.Update(user)
userAccessor.UpdatePartial(user)
userAccessor.Delete(user)
userAccessor.DeleteAll(query)

//query
userAccessor.Get(id,result)
userAccessor.FindOne(query,selector,result,sort-field...)
userAccessor.FindAll(query,selector,result)
userAccessor.FindPage(query,selector,result,pageSize,pageIndex,sort-field...)

//pipeline
userAccessor.PipeOne(pipeline, result)
userAccessor.PipeAll(pipeline, result)

For detailed usage, please visit the ptoject page.

About

[fipmgo](https://fipress.org/project/fipmgo) is a wrapper of mgo. It provides some convenient api to mgo.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages