mongo

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginsRoot = root + ".plugins"
)

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

Types

type ClientOptionsPlugin

type ClientOptionsPlugin func(context.Context, *options.ClientOptions) error

ClientOptionsPlugin defines a mongo client options plugin signature.

type ClientPlugin

type ClientPlugin func(context.Context, *mongo.Client) error

ClientPlugin defines a mongo client plugin signature.

type Conn

type Conn struct {
	ClientOptions *options.ClientOptions
	Client        *mongo.Client
	Database      *mongo.Database
	Options       *Options
	Plugins       []Plugin
}

Conn represents a mongo connection.

func NewConn

func NewConn(ctx context.Context, plugins ...Plugin) (*Conn, error)

NewConn returns a new connection with default options.

func NewConnWithConfigPath

func NewConnWithConfigPath(ctx context.Context, path string, plugins ...Plugin) (*Conn, error)

NewConnWithConfigPath returns a new connection with options from config path.

func NewConnWithOptions

func NewConnWithOptions(ctx context.Context, o *Options, plugins ...Plugin) (conn *Conn, err error)

NewConnWithOptions returns a new connection with options from config path.

type Options

type Options struct {
	Uri  string
	Auth *options.Credential
}

Options represents mongo client options.

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns options from config file or environment vars.

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

NewOptionsWithPath unmarshals a given key path into options and returns it.

type Plugin

Plugin defines a function to process plugin.

Directories

Path Synopsis
examples
plugins

Jump to

Keyboard shortcuts

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