mongoutil

package
v2.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthFromURI

func AuthFromURI(uri string) (*options.Credential, error)

AuthFromURI will create a Credentials object given the provided URI.

func HostsFromURI

func HostsFromURI(uri string) ([]string, error)

HostsFromURI will parse the hosts in the URI and return them as a slice of strings.

func NewOptions

func NewOptions[T any](opts ...options.Lister[T]) (*T, error)

NewOptions will functionally merge a slice of mongo.Options in a "last-one-wins" manner, where nil options are ignored.

Types

type OptionsLister

type OptionsLister[T any] struct {
	Options  *T             // Arguments to set on the option type
	Callback func(*T) error // A callback for further modification
}

OptionsLister implements an options.SetterLister object for an arbitrary options type.

func NewOptionsLister

func NewOptionsLister[T any](args *T, callback func(*T) error) *OptionsLister[T]

NewOptionsLister will construct a SetterLister from the provided Options object.

func (*OptionsLister[T]) List

func (opts *OptionsLister[T]) List() []func(*T) error

List will re-assign the entire argument option to the Args field defined on opts. If a callback exists, that function will be executed to further modify the arguments.

Jump to

Keyboard shortcuts

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