mongo

package module
v0.1.0 Latest Latest
Warning

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

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

README

mongo

Go Reference

TODO


Copyright (c) 2022 Archivage Numérique

Documentation

Overview

Package mongo TODO

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*mongo.Client
}

func Connect

func Connect(cfg *Config) (*Client, error)

func (*Client) Disconnect

func (c *Client) Disconnect() error

type Config

type Config struct {
	Servers        map[string]int    `dm:"servers"`
	Username       string            `dm:"username"`
	Password       string            `dm:"password"`
	Options        map[string]string `dm:"options"`
	ConnectTimeout time.Duration     `dm:"connect_timeout"`
}

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

Jump to

Keyboard shortcuts

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