Documentation ¶
Index ¶
- Variables
- func Connect(url, database string)
- func Cursor(m Model) *mgo.Collection
- func Exists(u Updatable) bool
- func Find(m Model, query interface{}) *mgo.Query
- func Latest(o OrderedModel, query interface{}) *mgo.Query
- func Register(m Model)
- func RegisterAllIndexes()
- func RegisterIndexes(m Model)
- func Upsert(u Updatable) (info *mgo.ChangeInfo, err error)
- type Connection
- type Model
- type OrderedModel
- type Updatable
Constants ¶
This section is empty.
Variables ¶
View Source
var Current = new(Connection)
View Source
var Models = []Model{}
Functions ¶
func Cursor ¶
func Cursor(m Model) *mgo.Collection
func Latest ¶
func Latest(o OrderedModel, query interface{}) *mgo.Query
func RegisterAllIndexes ¶
func RegisterAllIndexes()
func RegisterIndexes ¶
func RegisterIndexes(m Model)
Types ¶
type Connection ¶
type Model ¶
A thin Model interface. Implementing this interface will allow a number of simplifications to be executed on that model, like applying default ordering, atomatically creating indexes, etc. Though not necessary to use the interface, you should add an empty instance of your model to db.Models, which will auto-register indexes at connection time.
type OrderedModel ¶
Click to show internal directories.
Click to hide internal directories.