dsn

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DSN

type DSN struct {
	// contains filtered or unexported fields
}

DSN represents a parsed datasource. It contains fields for the individual connection components.

func DsnFromString

func DsnFromString(in string) (DSN, error)

dsnFromString parses a connection string into a dsn. It will attempt to parse the string as a URL and as a set of key=value pairs. If both attempts fail, dsnFromString will return an error.

func (DSN) GetConnectionString

func (d DSN) GetConnectionString() string

GetConnectionString returns the URL to pass to the driver for database connections. This value should not be logged.

func (*DSN) SetUserAndOptions

func (d *DSN) SetUserAndOptions(user, pass string, options map[string]string)

func (DSN) String

func (d DSN) String() string

String makes a dsn safe to print by excluding any passwords. This allows dsn to be used in strings and log messages without needing to call a redaction function first.

Jump to

Keyboard shortcuts

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