mongobuilder

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDBDriver

func BuildDBDriver(opts *Options) string

BuildDBDriver return a driver like "mongodb://user:pass@host:port/dbName"

Types

type DBConnect

type DBConnect struct {
	*mongo.Database
	Options *Options
}

func New

func New(opts ...Option) (*DBConnect, error)

New return a new mongo client.

type Option

type Option func(opts *Options)

func WithDBName

func WithDBName(dbName string) Option

func WithHost

func WithHost(host string) Option

func WithPass

func WithPass(pass string) Option

func WithPoolSize

func WithPoolSize(size uint64) Option

func WithPort

func WithPort(port int) Option

func WithUser

func WithUser(user string) Option

type Options

type Options struct {
	User     string
	Pass     string
	Host     string
	Port     int
	PoolSize uint64

	DBName string
}

Jump to

Keyboard shortcuts

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