endrMongoPool

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: MIT Imports: 8 Imported by: 0

README

go-mongo-pool

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConfig

type DBConfig struct {
	Uri            string `default:"mongodb://localhost:27017"`
	ConnectTimeout int    `default:"10"`
	DBName         string `default:"wares_info"`
	//GoodsCollection string `default:"goods_catalog"`
	PoolSize int `default:"5"`
}

type MongoConnection

type MongoConnection struct {
	Errors chan error
	// contains filtered or unexported fields
}

func NewMongoConnection

func NewMongoConnection(dbConfig DBConfig) *MongoConnection

func (*MongoConnection) CloseMongoDB

func (conn *MongoConnection) CloseMongoDB() (err error)

func (*MongoConnection) DBAsync

func (conn *MongoConnection) DBAsync(wg *sync.WaitGroup, f func(db *mongo.Database, errChan chan error) error) (err error)

func (*MongoConnection) GetMongoDB

func (conn *MongoConnection) GetMongoDB() (*mongo.Database, error)

func (*MongoConnection) NewMongoDB

func (conn *MongoConnection) NewMongoDB() (*mongo.Database, error)

func (*MongoConnection) PutMongoDB

func (conn *MongoConnection) PutMongoDB(db *mongo.Database) error

Jump to

Keyboard shortcuts

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