mongodb

package
v0.0.0-...-dc66ec4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Strong    = 1
	Monotonic = 2
)

Variables

View Source
var (
	MONGODB_SESSION_NIL_ERR = errors.New("MongoDBMgr session nil.")
	MONGODB_NOTFOUND_ERR    = errors.New("not found!")
	MONGODB_DBFINDALL_ERR   = errors.New("MongoDBMgr found error")
)

Functions

This section is empty.

Types

type M

type M = bson.M

type MongoDBInfo

type MongoDBInfo struct {
	DbHost string
	DbPort int
	DbName string
	DbUser string
	DbPass string
}

func NewMongoDBInfo

func NewMongoDBInfo(host string, port int, name, user, pass string) *MongoDBInfo

func (*MongoDBInfo) String

func (mi *MongoDBInfo) String() string

type MongoDBMgr

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

func NewMongoDBMgr

func NewMongoDBMgr(dbcfg *MongoDBInfo, timeout time.Duration) *MongoDBMgr

func (*MongoDBMgr) Close

func (mgr *MongoDBMgr) Close()

func (*MongoDBMgr) DBQuery

func (mgr *MongoDBMgr) DBQuery(collection string, cond interface{}, result *[]map[string]interface{}) error

func (*MongoDBMgr) DBQueryOneResult

func (mgr *MongoDBMgr) DBQueryOneResult(collection string, cond interface{}, result map[string]interface{}) error

func (*MongoDBMgr) GetDbSession

func (mgr *MongoDBMgr) GetDbSession() *mgo.Session

func (*MongoDBMgr) Insert

func (mgr *MongoDBMgr) Insert(collection string, doc interface{}) error

func (*MongoDBMgr) Ping

func (mgr *MongoDBMgr) Ping() error

func (*MongoDBMgr) RefreshSession

func (mgr *MongoDBMgr) RefreshSession()

func (*MongoDBMgr) RemoveAll

func (mgr *MongoDBMgr) RemoveAll(collection string, cond interface{}) error

func (*MongoDBMgr) RemoveOne

func (mgr *MongoDBMgr) RemoveOne(collection string, condName string, condValue int64) error

func (*MongoDBMgr) RemoveOneByCond

func (mgr *MongoDBMgr) RemoveOneByCond(collection string, cond interface{}) error

func (*MongoDBMgr) SetMode

func (mgr *MongoDBMgr) SetMode(mode int, refresh bool)

func (*MongoDBMgr) Start

func (mgr *MongoDBMgr) Start() error

func (*MongoDBMgr) Update

func (mgr *MongoDBMgr) Update(collection string, cond interface{}, change interface{}) error

func (*MongoDBMgr) UpdateInsert

func (mgr *MongoDBMgr) UpdateInsert(collection string, cond interface{}, doc interface{}) error

Jump to

Keyboard shortcuts

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