gomongo

package
v1.2.17 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

golang mongodb

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(configs ...Config) (err error)

Types

type Config

type Config struct {
	Name           string `yaml:"Name" json:"name"`
	Addr           string `yaml:"Addr" json:"addr"`
	User           string `yaml:"User" json:"user"`
	Password       string `yaml:"Password" json:"password"`
	EnablePassword bool   `yaml:"EnablePassword" json:"enable_password"`
	Database       string `yaml:"Database" json:"database"`
	AutoPing       bool   `yaml:"AutoPing" json:"autoPing"`
}

type GoMongo

type GoMongo struct {
	*mongo.Client
	// contains filtered or unexported fields
}

func Default

func Default() *GoMongo

func GetClient

func GetClient(names ...string) *GoMongo

func New

func New(conf Config) (cli *GoMongo, err error)

func (*GoMongo) DB

func (cli *GoMongo) DB() *mongo.Database

func (*GoMongo) WithContext

func (cli *GoMongo) WithContext(ctx context.Context) *GoMongo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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