db

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Hosts    []string
	UserName string
	Password string
	Database string
	Timeout  time.Duration // second
}

type Mdb

type Mdb struct {
	*Config
	*mgo.Session
}

func NewMdb

func NewMdb(c *Config) (*Mdb, error)

func (*Mdb) FindId

func (self *Mdb) FindId(collection string, id interface{}, result interface{}) error

func (*Mdb) FindOne

func (self *Mdb) FindOne(collection string, query interface{}, result interface{}) error

func (*Mdb) Insert

func (self *Mdb) Insert(collection string, data ...interface{}) error

func (*Mdb) Upsert

func (self *Mdb) Upsert(collection string, selector interface{}, change interface{}) error

func (*Mdb) WithC

func (m *Mdb) WithC(collection string, job func(*mgo.Collection) error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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