db

package
v0.0.0-...-3502bef Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectMongoDB

func ConnectMongoDB(url string, dbName string) error

ConnectMongoDB 连接MongoDB

func ConnectMongoDBWithPasswd

func ConnectMongoDBWithPasswd(url string, dbName string, user string, passwd string, timeout time.Duration) error

ConnectMongoDB 连接MongoDB

func GetNextSeq

func GetNextSeq(collection string, key string, num int) int

GetNextSeq 获取自增id

func QueryWithCollection

func QueryWithCollection(collection string, s func(*mgo.Collection) error) error

QueryWithCollection 获取collection对象

func SetNextSeqBaseNum

func SetNextSeqBaseNum(collection string, key string, base int) int

Types

type MongoDataInterface

type MongoDataInterface interface {
	GenObjectID() bson.ObjectId
	GetObjectID() bson.ObjectId
}

MongoDataInterface 存储的MongoData

type MongodbConfig

type MongodbConfig struct {
	URL    string
	DBName string
}

MongodbConfig DB配置

Jump to

Keyboard shortcuts

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