dsn

package
v0.459.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MySQLDBName added in v0.459.0

func MySQLDBName(connector schema.DatabaseConnector) (string, error)

func MySQLDSN

func MySQLDSN(dbName string, options ...Option) string

MySQLDSN returns a MySQLDSN string for connecting to the a MySQL database.

func PostgresDSN

func PostgresDSN(dbName string, options ...Option) string

PostgresDSN returns a PostgresDSN string for connecting to a PG database.

func ResolveMySQLConfig added in v0.455.0

func ResolveMySQLConfig(ctx context.Context, connector schema.DatabaseConnector) (*mysqlauthproxy.Config, error)

func ResolvePostgresDSN

func ResolvePostgresDSN(ctx context.Context, connector schema.DatabaseConnector) (string, error)

func TempMySQLProxy added in v0.459.0

func TempMySQLProxy(ctx context.Context, connector schema.DatabaseConnector) (host string, port int, err error)

TempMySQLProxy creates a temporary MySQL proxy for the given connector. It returns the local address of the proxy and an error if the proxy fails to start. When connecting to the proxy, any db name can be used, and it will redirect to the given connector

The proxy will be automatically cleaned up when the context is cancelled.

Types

type Option

type Option func(*dsnOptions)

func Host

func Host(host string) Option

func Password added in v0.450.0

func Password(password string) Option

func Port

func Port(port int) Option

func Username added in v0.450.0

func Username(user string) Option

Jump to

Keyboard shortcuts

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