db

package
v0.0.0-...-56ba520 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOperaBeforeInit = errors.New("please set db.SetOnFinishInit when needed operating db in init()")

Functions

func GetCol

func GetCol(dbName, col string) (session *mgo.Session, collection *mgo.Collection)

func IsFinishInit

func IsFinishInit() bool

func IsMgoDup

func IsMgoDup(err error) bool

func IsMgoNotFound

func IsMgoNotFound(err error) bool

func NewCollection

func NewCollection(session *mgo.Session, dbName, name string) *mgo.Collection

func NewObjectId

func NewObjectId() bson.ObjectId

func NewSession

func NewSession() (session *mgo.Session)

func ObjectIds

func ObjectIds(ids []string) (ret []bson.ObjectId)

func SetOnFinishInit

func SetOnFinishInit(f func())

func Setup

func Setup(c *MongoConfig)

func ShareSession

func ShareSession() *mgo.Session

Types

type M

type M bson.M

func In

func In(ids []string) M

func InID

func InID(ids []string) (ret M)

func (M) Update

func (m M) Update(qs ...M) M

type MongoConfig

type MongoConfig struct {
	MongoDB string
	DBName  string
}

type SqlServer

type SqlServer struct {
	*sqlx.DB
}

func GetSqlServer

func GetSqlServer(dataSourceName string) *SqlServer

func (*SqlServer) Query

func (s *SqlServer) Query(dest interface{}, query string, args ...interface{}) error

Jump to

Keyboard shortcuts

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