Documentation ¶
Overview ¶
Wraps MongoDB to make it compatible with the model package.
Built on top of Gustavo Niemeyer's great mgo package: http://labix.org/mgo
Index ¶
- Variables
- func CheckRefs(refs []Ref) (validRefs []Ref, invalidRefs []Ref, err error)
- func FindRefWithID(refs []Ref, id bson.ObjectId) (index int, found bool)
- func InitLocalhost(database, user, password string) (err error)
- func InitRefs(document interface{})
- func MatchBsonField(bsonName string) reflection.MatchStructFieldFunc
- func NewMongoIterator(query Query) model.Iterator
- func RemoveInvalidRefsInAllCollections() (invalidCollectionRefs map[string][]InvalidRefData, err error)
- func ReverseBsonD(d bson.D)
- func SortRefs(refs []Ref, lessFunc func(a, b *Ref) bool)
- type Collection
- func (self *Collection) Collection() *Collection
- func (self *Collection) Count() (n int, err error)
- func (self *Collection) DeleteAllNotWithIDs(ids ...bson.ObjectId) (numDeleted int, err error)
- func (self *Collection) DeleteAllWithIDs(ids ...bson.ObjectId) (numDeleted int, err error)
- func (self *Collection) DeleteWithID(id bson.ObjectId) error
- func (self *Collection) DocumentIDs() (ids []bson.ObjectId, err error)
- func (self *Collection) DocumentLabel(docId bson.ObjectId, labelSelectors ...string) (string, error)
- func (self *Collection) DocumentWithID(id bson.ObjectId, resultRef interface{}) error
- func (self *Collection) DocumentWithIDIterator(id bson.ObjectId) model.Iterator
- func (self *Collection) Explain() string
- func (self *Collection) Filter(selector string, value interface{}) Query
- func (self *Collection) FilterAllIn(selector string, values ...interface{}) Query
- func (self *Collection) FilterArraySize(selector string, size int) Query
- func (self *Collection) FilterContains(selector string, str string) Query
- func (self *Collection) FilterContainsCaseInsensitive(selector string, str string) Query
- func (self *Collection) FilterEndsWith(selector string, str string) Query
- func (self *Collection) FilterEndsWithCaseInsensitive(selector string, str string) Query
- func (self *Collection) FilterEqualCaseInsensitive(selector string, str string) Query
- func (self *Collection) FilterExists(selector string, exists bool) Query
- func (self *Collection) FilterFunc(passFilter model.FilterFunc) model.Iterator
- func (self *Collection) FilterGreater(selector string, value interface{}) Query
- func (self *Collection) FilterGreaterEqual(selector string, value interface{}) Query
- func (self *Collection) FilterID(ids ...bson.ObjectId) Query
- func (self *Collection) FilterIn(selector string, values ...interface{}) Query
- func (self *Collection) FilterLess(selector string, value interface{}) Query
- func (self *Collection) FilterLessEqual(selector string, value interface{}) Query
- func (self *Collection) FilterModulo(selector string, divisor, result interface{}) Query
- func (self *Collection) FilterNotEqual(selector string, value interface{}) Query
- func (self *Collection) FilterNotIn(selector string, values ...interface{}) Query
- func (self *Collection) FilterRef(selector string, refs ...Ref) Query
- func (self *Collection) FilterReferenced(refs ...Ref) Query
- func (self *Collection) FilterStartsWith(selector string, str string) Query
- func (self *Collection) FilterStartsWithCaseInsensitive(selector string, str string) Query
- func (self *Collection) FilterWhere(javascript string) Query
- func (self *Collection) Init()
- func (self *Collection) InitAndSaveDocument(doc Document) error
- func (self *Collection) InitDocument(doc Document)
- func (self *Collection) InitSubDocument(subDoc interface{})
- func (self *Collection) IsFilter() bool
- func (self *Collection) Iterator() model.Iterator
- func (self *Collection) Limit(limit int) Query
- func (self *Collection) OneDocument(resultRef interface{}) error
- func (self *Collection) OneDocumentID() (id bson.ObjectId, err error)
- func (self *Collection) OneSubDocument(selector string, resultRef interface{}) error
- func (self *Collection) Or() Query
- func (self *Collection) ParentQuery() Query
- func (self *Collection) RefForID(id bson.ObjectId) Ref
- func (self *Collection) Refs() (refs []Ref, err error)
- func (self *Collection) RemoveAll() (numRemoved int, err error)
- func (self *Collection) RemoveInvalidRefs() (invalidRefs []InvalidRefData, err error)
- func (self *Collection) Selector() string
- func (self *Collection) Skip(skip int) Query
- func (self *Collection) Sort(selectors ...string) Query
- func (self *Collection) SortFunc(compareFunc interface{}) model.Iterator
- func (self *Collection) String() string
- func (self *Collection) SubDocument(selector string) Query
- func (self *Collection) SubDocumentWithID(id bson.ObjectId, selector string, resultRef interface{}) error
- func (self *Collection) TryDocumentWithID(id bson.ObjectId, resultRef interface{}) (found bool, err error)
- func (self *Collection) TryDocumentWithIDIterator(id bson.ObjectId) model.Iterator
- func (self *Collection) TryOneDocument(resultRef interface{}) (found bool, err error)
- func (self *Collection) TryOneDocumentID() (id bson.ObjectId, found bool, err error)
- func (self *Collection) TryOneSubDocument(selector string, resultRef interface{}) (found bool, err error)
- func (self *Collection) TrySubDocumentWithID(id bson.ObjectId, selector string, resultRef interface{}) (found bool, err error)
- func (self *Collection) UpdateAll(selector string, value interface{}) (numUpdated int, err error)
- func (self *Collection) UpdateOne(selector string, value interface{}) error
- func (self *Collection) UpdateSubDocument(selector string, subDocument interface{}) error
- func (self *Collection) UpdateSubDocumentWithID(id bson.ObjectId, selector string, subDocument interface{}) error
- func (self *Collection) ValidateSelectors(selectors ...string) (err error)
- type Configuration
- type DereferenceIterator
- type Document
- type DocumentBase
- func (self *DocumentBase) Collection() *Collection
- func (self *DocumentBase) CreationTime() (t time.Time)
- func (self *DocumentBase) Delete() error
- func (self *DocumentBase) Init(collection *Collection, embeddingStructPtr interface{})
- func (self *DocumentBase) Iterator() model.Iterator
- func (self *DocumentBase) ObjectId() bson.ObjectId
- func (self *DocumentBase) Ref() Ref
- func (self *DocumentBase) RemoveInvalidRefs() (invalidRefs []InvalidRefData, err error)
- func (self *DocumentBase) Save() (err error)
- func (self *DocumentBase) SetObjectId(id bson.ObjectId)
- type ForeignRef
- type InvalidRefData
- type MongoIterator
- type Query
- type QueryError
- func (self *QueryError) Collection() *Collection
- func (self *QueryError) Count() (n int, err error)
- func (self *QueryError) DocumentIDs() (ids []bson.ObjectId, err error)
- func (self *QueryError) Explain() string
- func (self *QueryError) Filter(selector string, value interface{}) Query
- func (self *QueryError) FilterAllIn(selector string, values ...interface{}) Query
- func (self *QueryError) FilterArraySize(selector string, size int) Query
- func (self *QueryError) FilterContains(selector string, str string) Query
- func (self *QueryError) FilterContainsCaseInsensitive(selector string, str string) Query
- func (self *QueryError) FilterEndsWith(selector string, str string) Query
- func (self *QueryError) FilterEndsWithCaseInsensitive(selector string, str string) Query
- func (self *QueryError) FilterEqualCaseInsensitive(selector string, str string) Query
- func (self *QueryError) FilterExists(selector string, exists bool) Query
- func (self *QueryError) FilterFunc(passFilter model.FilterFunc) model.Iterator
- func (self *QueryError) FilterGreater(selector string, value interface{}) Query
- func (self *QueryError) FilterGreaterEqual(selector string, value interface{}) Query
- func (self *QueryError) FilterID(id ...bson.ObjectId) Query
- func (self *QueryError) FilterIn(selector string, values ...interface{}) Query
- func (self *QueryError) FilterLess(selector string, value interface{}) Query
- func (self *QueryError) FilterLessEqual(selector string, value interface{}) Query
- func (self *QueryError) FilterModulo(selector string, divisor, result interface{}) Query
- func (self *QueryError) FilterNotEqual(selector string, value interface{}) Query
- func (self *QueryError) FilterNotIn(selector string, values ...interface{}) Query
- func (self *QueryError) FilterRef(selector string, ref ...Ref) Query
- func (self *QueryError) FilterStartsWith(selector string, str string) Query
- func (self *QueryError) FilterStartsWithCaseInsensitive(selector string, str string) Query
- func (self *QueryError) FilterWhere(javascript string) Query
- func (self *QueryError) HasDocumentWithID(id bson.ObjectId) (bool, error)
- func (self *QueryError) IsFilter() bool
- func (self *QueryError) Iterator() model.Iterator
- func (self *QueryError) Limit(int) Query
- func (self *QueryError) OneDocument(resultRef interface{}) error
- func (self *QueryError) OneDocumentID() (id bson.ObjectId, err error)
- func (self *QueryError) OneSubDocument(selector string, resultRef interface{}) error
- func (self *QueryError) Or() Query
- func (self *QueryError) ParentQuery() Query
- func (self *QueryError) Refs() (refs []Ref, err error)
- func (self *QueryError) RemoveAll() (numRemoved int, err error)
- func (self *QueryError) Selector() string
- func (self *QueryError) Skip(int) Query
- func (self *QueryError) Sort(selectors ...string) Query
- func (self *QueryError) SortFunc(compareFunc interface{}) model.Iterator
- func (self *QueryError) SubDocument(selector string) Query
- func (self *QueryError) TryOneDocument(resultRef interface{}) (found bool, err error)
- func (self *QueryError) TryOneDocumentID() (id bson.ObjectId, found bool, err error)
- func (self *QueryError) TryOneSubDocument(selector string, resultRef interface{}) (found bool, err error)
- func (self *QueryError) UpdateAll(selector string, value interface{}) (numUpdated int, err error)
- func (self *QueryError) UpdateOne(selector string, value interface{}) error
- func (self *QueryError) UpdateSubDocument(selector string, subDocument interface{}) error
- type Ref
- func (self *Ref) CheckID() (bool, error)
- func (self *Ref) Collection() *Collection
- func (self *Ref) DocumentLabel() (string, error)
- func (self *Ref) Get(resultRef interface{}) error
- func (self Ref) GetBSON() (interface{}, error)
- func (self *Ref) IsEmpty() bool
- func (self *Ref) References(doc Document) (ok bool, err error)
- func (self *Ref) Required(metaData *model.MetaData) bool
- func (self *Ref) Set(document Document)
- func (self *Ref) SetBSON(raw bson.Raw) error
- func (self *Ref) SetStringID(str string) error
- func (self *Ref) String() string
- func (self *Ref) StringID() string
- func (self *Ref) TryGet(resultRef interface{}) (found bool, err error)
- func (self *Ref) Validate(metaData *model.MetaData) error
- type SortableRefs
Constants ¶
This section is empty.
Variables ¶
var Collections = map[string]*Collection{}
var Config = Configuration{ Safe: mgo.Safe{ W: 1, FSync: false, J: true, }, CheckQuerySelectors: true, }
var Database *mgo.Database
Functions ¶
func InitLocalhost ¶
func MatchBsonField ¶
func MatchBsonField(bsonName string) reflection.MatchStructFieldFunc
func NewMongoIterator ¶
func RemoveInvalidRefsInAllCollections ¶
func RemoveInvalidRefsInAllCollections() (invalidCollectionRefs map[string][]InvalidRefData, err error)
func ReverseBsonD ¶
Types ¶
type Collection ¶
type Collection struct { Name string DocLabelSelectors []string DocLabelSeparator string // contains filtered or unexported fields }
Collection represents a MongoDB collection and implements mongo.Query for all documents in the collection.
Example for creating, modifying and saving a document:
user := models.Users.NewDocument().(*models.User) user.Name.First.Set("Erik") user.Name.Last.Set("Unger") err := user.Save()
func CollectionByName ¶
func CollectionByName(name string) (collection *Collection, ok bool)
func NewCollection ¶
func NewCollection(name string, documentLabelSelectors ...string) *Collection
func (*Collection) Collection ¶
func (self *Collection) Collection() *Collection
func (*Collection) Count ¶
func (self *Collection) Count() (n int, err error)
func (*Collection) DeleteAllNotWithIDs ¶
func (self *Collection) DeleteAllNotWithIDs(ids ...bson.ObjectId) (numDeleted int, err error)
func (*Collection) DeleteAllWithIDs ¶
func (self *Collection) DeleteAllWithIDs(ids ...bson.ObjectId) (numDeleted int, err error)
func (*Collection) DeleteWithID ¶
func (self *Collection) DeleteWithID(id bson.ObjectId) error
func (*Collection) DocumentIDs ¶
func (*Collection) DocumentLabel ¶
func (*Collection) DocumentWithID ¶
func (self *Collection) DocumentWithID(id bson.ObjectId, resultRef interface{}) error
func (*Collection) DocumentWithIDIterator ¶
func (self *Collection) DocumentWithIDIterator(id bson.ObjectId) model.Iterator
func (*Collection) FilterAllIn ¶
func (*Collection) FilterArraySize ¶
func (*Collection) FilterContains ¶
func (*Collection) FilterContainsCaseInsensitive ¶
func (*Collection) FilterEndsWith ¶
func (*Collection) FilterEndsWithCaseInsensitive ¶
func (*Collection) FilterEqualCaseInsensitive ¶
func (*Collection) FilterExists ¶
func (*Collection) FilterFunc ¶
func (self *Collection) FilterFunc(passFilter model.FilterFunc) model.Iterator
func (*Collection) FilterGreater ¶
func (*Collection) FilterGreaterEqual ¶
func (*Collection) FilterLess ¶
func (*Collection) FilterLessEqual ¶
func (*Collection) FilterModulo ¶
func (*Collection) FilterNotEqual ¶
func (*Collection) FilterNotIn ¶
func (*Collection) FilterReferenced ¶
func (self *Collection) FilterReferenced(refs ...Ref) Query
FilterReferenced filters the collection for documents, that are referenced by refs.
func (*Collection) FilterStartsWith ¶
func (*Collection) FilterStartsWithCaseInsensitive ¶
func (*Collection) FilterWhere ¶
func (*Collection) Init ¶
func (self *Collection) Init()
func (*Collection) InitAndSaveDocument ¶
func (self *Collection) InitAndSaveDocument(doc Document) error
func (*Collection) InitDocument ¶
func (self *Collection) InitDocument(doc Document)
func (*Collection) InitSubDocument ¶
func (self *Collection) InitSubDocument(subDoc interface{})
func (*Collection) OneDocument ¶
func (self *Collection) OneDocument(resultRef interface{}) error
func (*Collection) OneDocumentID ¶
func (*Collection) OneSubDocument ¶
func (*Collection) ParentQuery ¶
func (self *Collection) ParentQuery() Query
func (*Collection) RemoveInvalidRefs ¶
func (self *Collection) RemoveInvalidRefs() (invalidRefs []InvalidRefData, err error)
RemoveInvalidRefs removes invalid refs from all documents and saves the changes.
func (*Collection) Selector ¶
func (self *Collection) Selector() string
func (*Collection) String ¶
func (self *Collection) String() string
func (*Collection) SubDocument ¶
func (*Collection) SubDocumentWithID ¶
func (self *Collection) SubDocumentWithID(id bson.ObjectId, selector string, resultRef interface{}) error
func (*Collection) TryDocumentWithID ¶
func (self *Collection) TryDocumentWithID(id bson.ObjectId, resultRef interface{}) (found bool, err error)
func (*Collection) TryDocumentWithIDIterator ¶
func (self *Collection) TryDocumentWithIDIterator(id bson.ObjectId) model.Iterator
func (*Collection) TryOneDocument ¶
func (*Collection) TryOneDocumentID ¶
func (*Collection) TryOneSubDocument ¶
func (*Collection) TrySubDocumentWithID ¶
func (*Collection) UpdateSubDocument ¶
func (*Collection) UpdateSubDocumentWithID ¶
func (self *Collection) UpdateSubDocumentWithID(id bson.ObjectId, selector string, subDocument interface{}) error
func (*Collection) ValidateSelectors ¶
func (self *Collection) ValidateSelectors(selectors ...string) (err error)
todo
type Configuration ¶
type Configuration struct { Host string Database string User string Password string Safe mgo.Safe CheckQuerySelectors bool }
func (*Configuration) Close ¶
func (self *Configuration) Close() error
func (*Configuration) Init ¶
func (self *Configuration) Init() error
func (*Configuration) Name ¶
func (self *Configuration) Name() string
type DereferenceIterator ¶
type DereferenceIterator struct { Refs []Ref // contains filtered or unexported fields }
func NewDereferenceIterator ¶
func NewDereferenceIterator(refs ...Ref) *DereferenceIterator
Returns an iterator of dereferenced refs, or an error iterator if there was an error
func (*DereferenceIterator) Err ¶
func (self *DereferenceIterator) Err() error
func (*DereferenceIterator) Next ¶
func (self *DereferenceIterator) Next(resultRef interface{}) bool
type Document ¶
type Document interface { Init(collection *Collection, embeddingStruct interface{}) Collection() *Collection ObjectId() bson.ObjectId SetObjectId(id bson.ObjectId) // Iterator returns an iterator that iterates only this document. Iterator() model.Iterator CreationTime() time.Time Ref() Ref Save() error Delete() error // RemoveInvalidRefs sets all invalid mongo.Ref instances to empty, // but does not save the document. RemoveInvalidRefs() (invalidRefs []InvalidRefData, err error) }
type DocumentBase ¶
type DocumentBase struct { ID bson.ObjectId `bson:"_id,omitempty" gostart:"-"` // contains filtered or unexported fields }
func (*DocumentBase) Collection ¶
func (self *DocumentBase) Collection() *Collection
func (*DocumentBase) CreationTime ¶
func (self *DocumentBase) CreationTime() (t time.Time)
func (*DocumentBase) Delete ¶
func (self *DocumentBase) Delete() error
func (*DocumentBase) Init ¶
func (self *DocumentBase) Init(collection *Collection, embeddingStructPtr interface{})
func (*DocumentBase) Iterator ¶
func (self *DocumentBase) Iterator() model.Iterator
func (*DocumentBase) ObjectId ¶
func (self *DocumentBase) ObjectId() bson.ObjectId
func (*DocumentBase) Ref ¶
func (self *DocumentBase) Ref() Ref
func (*DocumentBase) RemoveInvalidRefs ¶
func (self *DocumentBase) RemoveInvalidRefs() (invalidRefs []InvalidRefData, err error)
func (*DocumentBase) Save ¶
func (self *DocumentBase) Save() (err error)
func (*DocumentBase) SetObjectId ¶
func (self *DocumentBase) SetObjectId(id bson.ObjectId)
type ForeignRef ¶
type ForeignRef struct { Collection *Collection Selector string }
type InvalidRefData ¶
func RemoveInvalidRefs ¶
func RemoveInvalidRefs(document interface{}) (invalidRefs []InvalidRefData, err error)
type MongoIterator ¶
type MongoIterator struct {
// contains filtered or unexported fields
}
func (*MongoIterator) Err ¶
func (self *MongoIterator) Err() error
func (*MongoIterator) Next ¶
func (self *MongoIterator) Next(resultRef interface{}) bool
type Query ¶
type Query interface { Selector() string ParentQuery() Query Collection() *Collection SubDocument(selector string) Query Skip(int) Query Limit(int) Query Sort(selectors ...string) Query // sort reverse by prefixing the selector with a minus - // SortFunc will sort the query according to compareFunc. // compareFunc must have two arguments that are assignable from // the iterated document type or pointers to such a type. // The result of compareFunc must be a bool indicating // if the first argument is less than the second. SortFunc(compareFunc interface{}) model.Iterator // FilterX must be the first query on a Collection IsFilter() bool Filter(selector string, value interface{}) Query FilterWhere(javascript string) Query // Filter via a Go function. Note that all documents have to be loaded // in memory in order for Go code to be able to filter it. FilterFunc(passFilter model.FilterFunc) model.Iterator FilterRef(selector string, refs ...Ref) Query FilterID(ids ...bson.ObjectId) Query FilterEqualCaseInsensitive(selector string, str string) Query FilterNotEqual(selector string, value interface{}) Query FilterLess(selector string, value interface{}) Query FilterGreater(selector string, value interface{}) Query FilterLessEqual(selector string, value interface{}) Query FilterGreaterEqual(selector string, value interface{}) Query FilterModulo(selector string, divisor, result interface{}) Query FilterIn(selector string, values ...interface{}) Query FilterNotIn(selector string, values ...interface{}) Query FilterAllIn(selector string, values ...interface{}) Query FilterArraySize(selector string, size int) Query FilterStartsWith(selector string, str string) Query FilterStartsWithCaseInsensitive(selector string, str string) Query FilterEndsWith(selector string, str string) Query FilterEndsWithCaseInsensitive(selector string, str string) Query FilterContains(selector string, str string) Query FilterContainsCaseInsensitive(selector string, str string) Query FilterExists(selector string, exists bool) Query Or() Query // Statistics Count() (n int, err error) // Distinct() int Explain() string // Read OneDocument(resultRef interface{}) error TryOneDocument(resultRef interface{}) (found bool, err error) OneSubDocument(selector string, resultRef interface{}) error TryOneSubDocument(selector string, resultRef interface{}) (found bool, err error) Iterator() model.Iterator OneDocumentID() (id bson.ObjectId, err error) TryOneDocumentID() (id bson.ObjectId, found bool, err error) DocumentIDs() (ids []bson.ObjectId, err error) Refs() (refs []Ref, err error) // Write UpdateOne(selector string, value interface{}) error UpdateAll(selector string, value interface{}) (numUpdated int, err error) // UpdateSubDocument updates a sub-part of queried documents. // selector can be an empty string if subDocument is on // the root level of the queried documents. UpdateSubDocument(selector string, subDocument interface{}) error // RemoveAll ignores Skip() and Limit() RemoveAll() (numRemoved int, err error) // contains filtered or unexported methods }
Query is the interface with all query methods for mongo.
type QueryError ¶
type QueryError struct { Err error // contains filtered or unexported fields }
QueryError implements Query, but all it does is hold and return an error generated by another query.
func (*QueryError) Collection ¶
func (self *QueryError) Collection() *Collection
func (*QueryError) Count ¶
func (self *QueryError) Count() (n int, err error)
func (*QueryError) DocumentIDs ¶
func (self *QueryError) DocumentIDs() (ids []bson.ObjectId, err error)
func (*QueryError) Explain ¶
func (self *QueryError) Explain() string
func (*QueryError) Filter ¶
func (self *QueryError) Filter(selector string, value interface{}) Query
func (*QueryError) FilterAllIn ¶
func (self *QueryError) FilterAllIn(selector string, values ...interface{}) Query
func (*QueryError) FilterArraySize ¶
func (self *QueryError) FilterArraySize(selector string, size int) Query
func (*QueryError) FilterContains ¶
func (self *QueryError) FilterContains(selector string, str string) Query
func (*QueryError) FilterContainsCaseInsensitive ¶
func (self *QueryError) FilterContainsCaseInsensitive(selector string, str string) Query
func (*QueryError) FilterEndsWith ¶
func (self *QueryError) FilterEndsWith(selector string, str string) Query
func (*QueryError) FilterEndsWithCaseInsensitive ¶
func (self *QueryError) FilterEndsWithCaseInsensitive(selector string, str string) Query
func (*QueryError) FilterEqualCaseInsensitive ¶
func (self *QueryError) FilterEqualCaseInsensitive(selector string, str string) Query
func (*QueryError) FilterExists ¶
func (self *QueryError) FilterExists(selector string, exists bool) Query
func (*QueryError) FilterFunc ¶
func (self *QueryError) FilterFunc(passFilter model.FilterFunc) model.Iterator
func (*QueryError) FilterGreater ¶
func (self *QueryError) FilterGreater(selector string, value interface{}) Query
func (*QueryError) FilterGreaterEqual ¶
func (self *QueryError) FilterGreaterEqual(selector string, value interface{}) Query
func (*QueryError) FilterIn ¶
func (self *QueryError) FilterIn(selector string, values ...interface{}) Query
func (*QueryError) FilterLess ¶
func (self *QueryError) FilterLess(selector string, value interface{}) Query
func (*QueryError) FilterLessEqual ¶
func (self *QueryError) FilterLessEqual(selector string, value interface{}) Query
func (*QueryError) FilterModulo ¶
func (self *QueryError) FilterModulo(selector string, divisor, result interface{}) Query
func (*QueryError) FilterNotEqual ¶
func (self *QueryError) FilterNotEqual(selector string, value interface{}) Query
func (*QueryError) FilterNotIn ¶
func (self *QueryError) FilterNotIn(selector string, values ...interface{}) Query
func (*QueryError) FilterStartsWith ¶
func (self *QueryError) FilterStartsWith(selector string, str string) Query
func (*QueryError) FilterStartsWithCaseInsensitive ¶
func (self *QueryError) FilterStartsWithCaseInsensitive(selector string, str string) Query
func (*QueryError) FilterWhere ¶
func (self *QueryError) FilterWhere(javascript string) Query
func (*QueryError) HasDocumentWithID ¶
func (self *QueryError) HasDocumentWithID(id bson.ObjectId) (bool, error)
func (*QueryError) IsFilter ¶
func (self *QueryError) IsFilter() bool
func (*QueryError) Iterator ¶
func (self *QueryError) Iterator() model.Iterator
func (*QueryError) Limit ¶
func (self *QueryError) Limit(int) Query
func (*QueryError) OneDocument ¶
func (self *QueryError) OneDocument(resultRef interface{}) error
func (*QueryError) OneDocumentID ¶
func (self *QueryError) OneDocumentID() (id bson.ObjectId, err error)
func (*QueryError) OneSubDocument ¶
func (self *QueryError) OneSubDocument(selector string, resultRef interface{}) error
func (*QueryError) Or ¶
func (self *QueryError) Or() Query
func (*QueryError) ParentQuery ¶
func (self *QueryError) ParentQuery() Query
func (*QueryError) Refs ¶
func (self *QueryError) Refs() (refs []Ref, err error)
func (*QueryError) RemoveAll ¶
func (self *QueryError) RemoveAll() (numRemoved int, err error)
func (*QueryError) Selector ¶
func (self *QueryError) Selector() string
func (*QueryError) Skip ¶
func (self *QueryError) Skip(int) Query
func (*QueryError) Sort ¶
func (self *QueryError) Sort(selectors ...string) Query
func (*QueryError) SortFunc ¶
func (self *QueryError) SortFunc(compareFunc interface{}) model.Iterator
func (*QueryError) SubDocument ¶
func (self *QueryError) SubDocument(selector string) Query
func (*QueryError) TryOneDocument ¶
func (self *QueryError) TryOneDocument(resultRef interface{}) (found bool, err error)
func (*QueryError) TryOneDocumentID ¶
func (self *QueryError) TryOneDocumentID() (id bson.ObjectId, found bool, err error)
func (*QueryError) TryOneSubDocument ¶
func (self *QueryError) TryOneSubDocument(selector string, resultRef interface{}) (found bool, err error)
func (*QueryError) UpdateAll ¶
func (self *QueryError) UpdateAll(selector string, value interface{}) (numUpdated int, err error)
func (*QueryError) UpdateOne ¶
func (self *QueryError) UpdateOne(selector string, value interface{}) error
func (*QueryError) UpdateSubDocument ¶
func (self *QueryError) UpdateSubDocument(selector string, subDocument interface{}) error
type Ref ¶
Ref holds a mongo.ID and the name of the collection of the referenced document. Only the ID will be saved in MongoDB, the collection name is for validation and convenience functions only.
func (*Ref) Collection ¶
func (self *Ref) Collection() *Collection
func (*Ref) DocumentLabel ¶
func (*Ref) SetStringID ¶
type SortableRefs ¶
func (*SortableRefs) Len ¶
func (self *SortableRefs) Len() int
func (*SortableRefs) Less ¶
func (self *SortableRefs) Less(i, j int) bool
func (*SortableRefs) Swap ¶
func (self *SortableRefs) Swap(i, j int)
Source Files ¶
- collection.go
- config.go
- dereferenceiterator.go
- doc.go
- document.go
- documentbase.go
- functions.go
- mongoiterator.go
- query.go
- query_base.go
- query_filterallin.go
- query_filterarraysize.go
- query_filtercontains.go
- query_filterendswith.go
- query_filterequal.go
- query_filterequalcaseinsensitive.go
- query_filterexists.go
- query_filtergreater.go
- query_filtergreaterequal.go
- query_filterin.go
- query_filterless.go
- query_filterlessequal.go
- query_filtermodulo.go
- query_filternotequal.go
- query_filternotin.go
- query_filterquery.go
- query_filterref.go
- query_filterstartswith.go
- query_limit.go
- query_or.go
- query_skip.go
- query_sort.go
- query_subdocument.go
- queryerror.go
- ref.go
- subdocument.go
- subdocumentbase.go