mongo

package module
v0.0.0-...-72813be Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: MIT Imports: 5 Imported by: 0

README

mongo

A FAIRE.

Go Report Card Go Reference

Licence

MIT.


Copyright (c) 2021-2022 losyme

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(c *Config) (*mongo.Client, error)

func Disconnect

func Disconnect(client *mongo.Client) error

Types

type Config

type Config struct {
	Servers        map[string]int
	Username       string
	Password       string
	Options        map[string]string
	ConnectTimeout time.Duration
}

func NewConfig

func NewConfig(options ...Option) *Config

func (*Config) URI

func (c *Config) URI() (string, error)

type Option

type Option func(*Config)

func WithAuth

func WithAuth(username, password string) Option

func WithConnectTimeout

func WithConnectTimeout(timeout time.Duration) Option

func WithOption

func WithOption(name, value string) Option

func WithServer

func WithServer(host string, port int) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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