mongo

package
v0.0.0-...-8d9db00 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2017 License: MIT Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateJsonWith

func UpdateJsonWith(obj interface{}) (map[string]interface{}, error)

UpdateJsonWith 制作update内容

Types

type Config

type Config struct {
	Url      string `json:"url" env:"MONGO_URL"`
	Database string `json:"database" env:"MONGO_DATABASE"`
}

type Mongo

type Mongo struct {
	Config     *Config
	Connection *mgo.Session
}

func New

func New() *Mongo

func (*Mongo) Close

func (m *Mongo) Close() error

func (*Mongo) Connect

func (m *Mongo) Connect() error

func (*Mongo) GetCollection

func (m *Mongo) GetCollection(name string) (*mgo.Collection, error)

func (*Mongo) GetConnection

func (m *Mongo) GetConnection() interface{}

func (*Mongo) NewConfig

func (m *Mongo) NewConfig() interface{}

func (*Mongo) ValidateBefore

func (m *Mongo) ValidateBefore() error

Jump to

Keyboard shortcuts

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