mgo

package
v0.0.0-...-0cfe181 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_MGO_TIMEOUT = 15
	DEFAULT_MGO_ADDR    = "127.0.0.1:27017"
)

Variables

View Source
var (
	ErrNotFound = mgo.ErrNotFound
)

Functions

func Connect

func Connect(dataBase, collection string) (*mgo.Session, *mgo.Collection)

func Count

func Count(db, collection string, query interface{}) (int, error)

func DeepCopy

func DeepCopy(val interface{}, newVal interface{})

func FindAll

func FindAll(db, collection string, selector, result interface{}) error

func FindIter

func FindIter(db, collection string, selector interface{}) (*mgo.Iter, *mgo.Session)

func FindOne

func FindOne(db, collection string, selector, result interface{}) error

func Index

func Index(db, collection string, keys []string) error

func Insert

func Insert(db, collection string, docs interface{}) error

func IsEmpty

func IsEmpty(db, collection string) bool

func KeyIsExist

func KeyIsExist(db, collection, key, value string) bool

func NextVal

func NextVal(db, countername string) int32

func Remove

func Remove(db, collection string, selector interface{}) error

func Update

func Update(db, collection string, selector, update interface{}) error

func Upsert

func Upsert(db, collection string, selector, update interface{}) error

Types

type Counter

type Counter struct {
	Name    string
	NextVal int64
}

type M

type M bson.M

Jump to

Keyboard shortcuts

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