mongo

package
v0.0.0-...-29f5810 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mongo provides basic API for documents management in a mongo database.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidID = errors.New("invalid ID")
)

Functions

func Delete

func Delete(col *mgo.Collection, idStr string) error

func GetID

func GetID(col *mgo.Collection, idStr string, dst interface{}) error

GetID fetches a document from a database into the provided interface.

func GetOne

func GetOne(col *mgo.Collection, query, dst interface{}) error

GetOne fetches an item from a database.

func Save

func Save(col *mgo.Collection, selector interface{}, item interface{}) error

func UpdateID

func UpdateID(col *mgo.Collection, idStr string, set interface{}, dst interface{}) error

UpdateID updates a database by the specified ID with the provided mgo.Change.

func UpdateOne

func UpdateOne(col *mgo.Collection, query, set, dst interface{}) error

UpdateOne updates a record found by a query.

Types

This section is empty.

Jump to

Keyboard shortcuts

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