mgdb

package
v0.0.0-...-d6bd8d2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2017 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoInited error = errors.New("Mongo is not initialized!")
	ErrNoConfig       = errors.New("Mongo is not register!")
	ErrNotFound       = mgo.ErrNotFound
	ErrCursor         = mgo.ErrCursor
	ErrExist          = errors.New("exist")
)

Functions

This section is empty.

Types

type Collection

type Collection struct {
	mgo.Collection
}

type Config

type Config struct {
	Host         string
	Port         string
	Username     string
	Password     string
	DBName       string
	MaxOpenConns int
}

func NewConfig

func NewConfig(host, port, username, password, dbname string) *Config

func NewFullConfig

func NewFullConfig(host, port, username, password, dbname string, open int) *Config

func NewSimpleConfig

func NewSimpleConfig(username, password, dbname string) *Config

type DB

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

func NewDB

func NewDB(c *Config) *DB

func NewDataBase

func NewDataBase(c *Config) (*DB, error)

func (*DB) C

func (s *DB) C(collection string, f func(*Collection) error) error

Jump to

Keyboard shortcuts

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