document

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(collection string, db *mgo.Database) (int, error)

Count : returns the count of documents from a collection

func CountBySelector

func CountBySelector(collection string, selector interface{}, db *mgo.Database) (int, error)

CountBySelector : returns the count of documents from a collection

func DeleteDocument

func DeleteDocument(documentID bson.ObjectId, collection string, db *mgo.Database) error

DeleteDocument : deletes a document from a collection.

func DeleteDocumentsBySelector

func DeleteDocumentsBySelector(collection string, selector interface{}, db *mgo.Database) (int, error)

DeleteDocumentsBySelector : deletes documents into a collection.

func GetDocument

func GetDocument(document Document, collection string, db *mgo.Database) error

GetDocument : returns a document from a collection

func GetDocumentByID

func GetDocumentByID(document Document, collection string, id string, db *mgo.Database) error

GetDocumentByID : returns a document from a collection.

func GetDocumentBySelector

func GetDocumentBySelector(document Document, collection string, selector interface{}, db *mgo.Database) error

GetDocumentBySelector : returns a document from a collection

func GetDocumentBySelectorAndSort

func GetDocumentBySelectorAndSort(document Document, collection string, selector interface{}, sort []string, db *mgo.Database) error

GetDocumentBySelectorAndSort : returns a document from a collection

func GetDocumentBySort

func GetDocumentBySort(document Document, collection string, sort []string, db *mgo.Database) error

GetDocumentBySort : returns a document from a collection

func GetDocuments

func GetDocuments(result interface{}, collection string, db *mgo.Database) error

GetDocuments : returns the documents from a collection

func GetDocumentsBySelector

func GetDocumentsBySelector(result interface{}, collection string, selector interface{}, db *mgo.Database) error

GetDocumentsBySelector : returns the documents from a collection

func GetDocumentsBySelectorAndSort

func GetDocumentsBySelectorAndSort(result interface{}, collection string, selector interface{}, sort []string, db *mgo.Database) error

GetDocumentsBySelectorAndSort : returns the documents from a collection

func GetDocumentsBySelectorAndSortWithFieldsOffsetAndLimit added in v0.1.1

func GetDocumentsBySelectorAndSortWithFieldsOffsetAndLimit(result interface{}, collection string, selector interface{}, fields bson.M, sort []string, offset, limit int, db *mgo.Database) error

GetDocumentsBySelectorAndSortWithFieldsOffsetAndLimit : returns the documents from a collection

func GetDocumentsBySelectorAndSortWithOffsetAndLimit

func GetDocumentsBySelectorAndSortWithOffsetAndLimit(result interface{}, collection string, selector interface{}, sort []string, offset, limit int, db *mgo.Database) error

GetDocumentsBySelectorAndSortWithOffsetAndLimit : returns the documents from a collection

func GetDocumentsBySelectorWithFields added in v0.1.1

func GetDocumentsBySelectorWithFields(result interface{}, collection string, selector interface{}, fields bson.M, db *mgo.Database) error

GetDocumentsBySelectorWithFields : returns the documents from a collection

func GetDocumentsBySelectorWithOffsetAndLimit

func GetDocumentsBySelectorWithOffsetAndLimit(result interface{}, collection string, selector interface{}, offset, limit int, db *mgo.Database) error

GetDocumentsBySelectorWithOffsetAndLimit : returns the documents from a collection

func GetDocumentsBySort

func GetDocumentsBySort(result interface{}, collection string, sort []string, db *mgo.Database) error

GetDocumentsBySort : returns the documents from a collection

func GetDocumentsBySortWithOffsetAndLimit

func GetDocumentsBySortWithOffsetAndLimit(result interface{}, collection string, sort []string, offset, limit int, db *mgo.Database) error

GetDocumentsBySortWithOffsetAndLimit : returns the documents from a collection

func GetDocumentsWithOffsetAndLimit

func GetDocumentsWithOffsetAndLimit(result interface{}, collection string, offset, limit int, db *mgo.Database) error

GetDocumentsWithOffsetAndLimit : returns the documents from a collection

func PipeAll

func PipeAll(result interface{}, collection string, pipeline interface{}, db *mgo.Database) error

PipeAll : returns all the results of a pipeline.

func PipeOne

func PipeOne(result interface{}, collection string, pipeline interface{}, db *mgo.Database) error

PipeOne : returns the first result of a pipeline.

func SaveDocument

func SaveDocument(document Document, collection string, db *mgo.Database) (string, error)

SaveDocument : inserts a document into a collection.

func UpdateDocument

func UpdateDocument(documentID bson.ObjectId, collection string, update interface{}, db *mgo.Database) error

UpdateDocument : updates a document into a collection.

func UpdateDocumentsBySelector

func UpdateDocumentsBySelector(collection string, selector interface{}, update interface{}, db *mgo.Database) (int, error)

UpdateDocumentsBySelector : updates documents into a collection.

func UpsertDocumentBySelector

func UpsertDocumentBySelector(collection string, selector interface{}, update interface{}, db *mgo.Database) (int, error)

UpsertDocumentBySelector : updates documents into a collection.

Types

type Document

type Document interface {
	IsSaved() bool
	Save(db *mgo.Database) (string, error)
	Update(update interface{}, db *mgo.Database) error
	Delete(db *mgo.Database) error
	GetByID(id string, db *mgo.Database) error
	SetID(id string)
	GetID() string
}

Document : interface for a MongoDB document.

Jump to

Keyboard shortcuts

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