mongokit

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct{ *mongo.Client }

Conn wraps the connection to the MongoDB.

func New

func New(addr string, options ...Option) (*Conn, error)

New returns a pointer to a new instance of Conn struct. Receives variadic Option to configure the MongoDB connection settings.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Health added in v0.2.10

func (c *Conn) Health(ctx context.Context) error

Health implements the health.Checker interface for MongoDB connection.

type Option

type Option func(*mongooptions.ClientOptions)

Option configures the mongo options.ClientOptions.

func WithAppName

func WithAppName(name string) Option

WithAppName sets app name to the connection properties.

func WithConnectTimeout added in v0.2.14

func WithConnectTimeout(timeout time.Duration) Option

WithConnectTimeout specifies a timeout that is used for creating connections to the server. This can be set through ApplyURI with the "connectTimeoutMS" (e.g "connectTimeoutMS=30") option. If set to 0, no timeout will be used. The default is 30 seconds.

func WithDirectConnection added in v0.2.14

func WithDirectConnection(direct bool) Option

WithDirectConnection sets ability to make direct connection.

Jump to

Keyboard shortcuts

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