model

package
v0.0.0-...-c354ab8 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iter

type Iter struct {
	*mgo.Iter
}

func (*Iter) All

func (iter *Iter) All(result interface{}) error

This is an overridden version of All() iterator, because original one doesn't support dynamically created slices. When it does, this stuff could be removed.

type Model

type Model struct {
	// contains filtered or unexported fields
}

'collection'

Collection name. By default it's made from SchemeName. E.g. 'UserScheme'
becames 'Users' collection, simply by trimming 'Scheme' literal and adding
's' to tne end.

Arguments list is optional:

It expects a map[string]interface{}, containing following members (ony one so far):
'collection'	(string) - collection name

E.g.: New(UserScheme{}, map[string]interface{"collection": "accounts"})

func New

func New(scheme interface{}, args ...interface{}) *Model

func (*Model) Create

func (this *Model) Create(query interface{}) interface{}

func (*Model) Delete

func (this *Model) Delete(selector interface{}) bool

func (*Model) Expand

func (this *Model) Expand(result interface{}, fieldTag string)

func (*Model) Find

func (this *Model) Find(args ...interface{}) *Query

empty for all or id (as a bson.ObjectId or string) all other arguments are the same as mgo Find method applies (map, struct)

func (*Model) Update

func (this *Model) Update(selector interface{}, query interface{}) (interface{}, error)

type Query

type Query struct {
	*mgo.Query
	// contains filtered or unexported fields
}

func (*Query) All

func (q *Query) All() interface{}

func (*Query) Limit

func (q *Query) Limit(n int) *Query

func (*Query) One

func (q *Query) One() interface{}

func (*Query) Skip

func (q *Query) Skip(n int) *Query

Jump to

Keyboard shortcuts

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