goo_mongo

package
v1.1.63 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MongoDSN = "mongodb://root:ab15eb8e12ea@122.228.113.230:27017"

Functions

func Init

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

Types

type Client

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

func Default

func Default() *Client

func GetClient

func GetClient(names ...string) *Client

func New

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

func (*Client) DB

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

func (*Client) WithContext

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

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"`
	Database string `yaml:"database" json:"database"`
	AutoPing bool   `yaml:"auto_ping" json:"autoPing"`
}

Jump to

Keyboard shortcuts

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