mongo

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DSNOption

type DSNOption func(*MongoDBDSN)

DSNOption defines a function that configures a MongoDBDSN.

func WithAddr

func WithAddr(addr string) DSNOption

WithAddr sets the address for the DSN.

func WithDBName

func WithDBName(dbname string) DSNOption

WithDBName sets the database name for the DSN.

func WithPassword

func WithPassword(password string) DSNOption

WithPassword sets the password for the DSN.

func WithPort

func WithPort(port int) DSNOption

WithPort sets the port for the DSN.

func WithUsername

func WithUsername(username string) DSNOption

WithUsername sets the username for the DSN.

type MongoDBDSN

type MongoDBDSN struct {
	Addr     string `json:"addr"`
	Port     int    `json:"port"`
	Username string `json:"username"`
	Password string `json:"password"`
	DBName   string `json:"dbname"`
}

func NewDSN

func NewDSN(opts ...DSNOption) *MongoDBDSN

NewDSN creates a new MongoDBDSN with the given options.

func (MongoDBDSN) DSN

func (m MongoDBDSN) DSN() string

func (*MongoDBDSN) Info

func (m *MongoDBDSN) Info() string

Info implements database.DataSourceNamer.

func (MongoDBDSN) Type

func (m MongoDBDSN) Type() database.Type

Type implements database.DataSourceNamer.

Jump to

Keyboard shortcuts

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