mongo

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler 提供MongoDB的数据库操作

func InitHandler

func InitHandler(url string) (*Handler, error)

InitHandler 初始化Handler url MongoDB连接路径

func (*Handler) C

func (h *Handler) C(cName string) *mgo.Collection

C 使用默认DB处理集合(使用当前会话)

func (*Handler) CHandle

func (h *Handler) CHandle(cName string, handle func(c *mgo.Collection))

CHandle 使用默认DB处理带有回调函数的集合,处理完成之后将关闭该会话(处理时将使用克隆的会话)

func (*Handler) CloneSession

func (h *Handler) CloneSession() *mgo.Session

CloneSession 克隆一个会话

func (*Handler) DB

func (h *Handler) DB(dbName, cName string) *mgo.Collection

DB 使用新的DB处理集合(使用当前会话)

func (*Handler) DBHandle

func (h *Handler) DBHandle(dbName, cName string, handle func(c *mgo.Collection))

DBHandle 使用新的DB处理带有回调函数的集合,处理完成之后将关闭该会话(处理时将使用克隆的会话)

func (*Handler) IncrID

func (h *Handler) IncrID(cName string) (id int64, err error)

IncrID 返回一个自增ID cName 需要生成自增ID的集合名称

func (*Handler) Session

func (h *Handler) Session() *mgo.Session

Session 获取当前会话

Jump to

Keyboard shortcuts

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