mongo

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collection

func Collection(client *mongo.Client, cname string) (*mongo.Collection, error)

Collection 获取集合

func CollectionMulti

func CollectionMulti(client *mongo.Client, cname string) (*mongo.Collection, error)

CollectionMulti 支持多数据库直接获取collection

func Init

func Init(conf *Config)

func New

func New() (*mongo.Client, error)

New 获取mongo客户端 // "mongodb://user:password@localhost:27017"

func Ping

func Ping() error

Types

type Config

type Config struct {
	Uri      string
	Username string
	Password string
	Database string
	Timeout  int
}

Jump to

Keyboard shortcuts

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