mongo

package
v0.0.0-...-a939f45 Latest Latest
Warning

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

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

Documentation

Overview

Package mongo provides a simple wrapper around 3rd party mongo client.

Index

Constants

View Source
const (
	// User is the username to use for authentication
	User = "root"
	// Pass is the password to use for authentication
	Pass = "password"
)

Variables

This section is empty.

Functions

func RunServer

func RunServer(t testing.TB, serverAddress, serverPort string) error

RunServer runs a mongo server in a docker container

Types

type Client

type Client struct {
	C *mongo.Client
}

Client is a wrapper around the mongo client

func NewClient

func NewClient(opts Options) (*Client, error)

NewClient creates a new mongo client

func (*Client) DeleteDatabases

func (c *Client) DeleteDatabases() error

DeleteDatabases deletes all databases except the default ones

func (*Client) Stop

func (c *Client) Stop() error

Stop stops the mongo client

type Options

type Options struct {
	ClientDialer     *net.Dialer
	ServerAddress    string
	Username         string
	Password         string
	ConnectionTimout time.Duration
}

Options is a struct to hold the options for the mongo client

Jump to

Keyboard shortcuts

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