database

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLPinger

type MySQLPinger struct{}

MySQLPinger implements the DatabasePinger interface for the MySQL protocol.

func (*MySQLPinger) IsConnectionRefusedError

func (p *MySQLPinger) IsConnectionRefusedError(err error) bool

IsConnectionRefusedError checks whether the error is of type connection refused.

func (*MySQLPinger) IsInvalidDatabaseNameError

func (p *MySQLPinger) IsInvalidDatabaseNameError(err error) bool

IsInvalidDatabaseNameError checks whether the error is of type invalid database name. This can happen when the database doesn't exist or the user want not granted permission to access that database in MySQL.

func (*MySQLPinger) IsInvalidDatabaseUserError

func (p *MySQLPinger) IsInvalidDatabaseUserError(err error) bool

IsInvalidDatabaseUserError checks whether the error is of type invalid database user. This can happen when the user doesn't exist or the user was created with a cert subject CN that does not match the user name.

func (*MySQLPinger) Ping

func (p *MySQLPinger) Ping(ctx context.Context, params PingParams) error

Ping connects to the database and issues a basic select statement to validate the connection.

type PingParams

type PingParams struct {
	// Host is the hostname of the Database (does not include port).
	Host string
	// Port is the port where the Database is accepting connections.
	Port int
	// Username is the user to be used to login into the database.
	Username string
	// DatabaseName is an optional database name to be used to login into the database.
	DatabaseName string
}

PingParams contains the required fields necessary to test a Database Connection.

func (*PingParams) CheckAndSetDefaults

func (p *PingParams) CheckAndSetDefaults(protocol string) error

CheckAndSetDefaults validates and set the default values for the Ping.

type PostgresPinger

type PostgresPinger struct{}

PostgresPinger implements the DatabasePinger interface for the Postgres protocol

func (*PostgresPinger) IsConnectionRefusedError

func (p *PostgresPinger) IsConnectionRefusedError(err error) bool

IsConnectionRefusedError checks whether the error is of type connection refused.

func (*PostgresPinger) IsInvalidDatabaseNameError

func (p *PostgresPinger) IsInvalidDatabaseNameError(err error) bool

IsInvalidDatabaseNameError checks whether the error is of type invalid database name. This can happen when the database doesn't exist.

func (*PostgresPinger) IsInvalidDatabaseUserError

func (p *PostgresPinger) IsInvalidDatabaseUserError(err error) bool

IsInvalidDatabaseUserError checks whether the error is of type invalid database user. This can happen when the user doesn't exist.

func (*PostgresPinger) Ping

func (p *PostgresPinger) Ping(ctx context.Context, params PingParams) error

Ping connects to the database and issues a basic select statement to validate the connection.

type SQLServerPinger

type SQLServerPinger struct{}

SQLServerPinger implements the DatabasePinger interface for the SQL Server protocol.

func (*SQLServerPinger) IsConnectionRefusedError

func (p *SQLServerPinger) IsConnectionRefusedError(err error) bool

IsConnectionRefusedError returns whether the error is referring to a connection refused.

func (*SQLServerPinger) IsInvalidDatabaseNameError

func (p *SQLServerPinger) IsInvalidDatabaseNameError(err error) bool

IsInvalidDatabaseNameError returns whether the error is referring to an invalid (non-existent) database name.

func (*SQLServerPinger) IsInvalidDatabaseUserError

func (p *SQLServerPinger) IsInvalidDatabaseUserError(err error) bool

IsInvalidDatabaseUserError returns whether the error is referring to an invalid (non-existent) user.

func (*SQLServerPinger) Ping

func (p *SQLServerPinger) Ping(ctx context.Context, params PingParams) error

Ping tests the connection to the Database with a simple request.

Jump to

Keyboard shortcuts

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