mongo

package
v0.0.0-...-6b7ec55 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	InnerClient *mongo.Client
	Config      *Config
}

func NewClient

func NewClient(ctx context.Context, conf *Config) (*Client, error)

func (*Client) Collection

func (c *Client) Collection(coll string, opts ...*options.CollectionOptions) *mongo.Collection

func (*Client) Database

func (c *Client) Database(opts ...*options.DatabaseOptions) *mongo.Database

type Config

type Config struct {
	Options  *options.ClientOptions
	Host     string
	Username string
	Password string
	Database string
}

func NewConfig

func NewConfig(host, username, password, database string, opts ...Option) (*Config, error)

func (*Config) Srv

func (c *Config) Srv() string

Srv genreates Mongo URI using the config passed in. format: mongodb+srv://[username:password@]host[/[defaultauthdb][?options]]

type Option

type Option func(c *Config) error

func WithOptions

func WithOptions(opts *options.ClientOptions) Option

Jump to

Keyboard shortcuts

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