mongo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = Configuration{
	Dbs: make(map[string]DbConfig),
}

Functions

func Database

func Database(dbName string) *mgo.Database

func DatabaseWithSubName

func DatabaseWithSubName(dbName, subName string) *mgo.Database

func Ping

func Ping()

func ResetAllSession

func ResetAllSession()

不严格的多线程保护

func SetAutoPing

func SetAutoPing(interv time.Duration)

Types

type Collection

type Collection struct {
	*mgo.Collection
	Ref int32
	// contains filtered or unexported fields
}

func DatabaseC

func DatabaseC(dbName, collectionName string) *Collection

func DatabaseWithSubNameC

func DatabaseWithSubNameC(dbName, subName, collectionName string) *Collection

func (*Collection) Hold

func (c *Collection) Hold()

func (*Collection) IsValid

func (c *Collection) IsValid() bool

func (*Collection) Unhold

func (c *Collection) Unhold()

type Configuration

type Configuration struct {
	Dbs map[string]DbConfig
}

func (*Configuration) Close

func (c *Configuration) Close() error

func (*Configuration) Init

func (c *Configuration) Init() error

func (*Configuration) Name

func (c *Configuration) Name() string

type DbConfig

type DbConfig struct {
	Host     string
	Database string
	User     string
	Password string
	Safe     mgo.Safe
}

Jump to

Keyboard shortcuts

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