dbclient

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostgresType       = "postgres"
	RDSReplicationRole = "rds_replication"
	RDSSuperUserRole   = "rds_superuser"
)

Variables

This section is empty.

Functions

func PostgresConnectionString

func PostgresConnectionString(host, port, user, password, dbname, sslmode string) string

func PostgresURI

func PostgresURI(host, port, user, password, dbname, sslmode string) string

Types

type Client

type Client interface {
	CreateDatabase(dbName string) (bool, error)
	CreateUser(username, role, userPassword string) (bool, error)
	CreateGroup(dbName, username string) (bool, error)
	CreateDefaultExtentions(dbName string) error
	CreateSpecialExtentions(dbName string, role string) error
	RenameUser(oldUsername string, newUsername string) error
	UpdateUser(oldUsername, newUsername, rolename, password string) error
	UpdatePassword(username string, userPassword string) error
	ManageReplicationRole(username string, enableReplicationRole bool) error
	ManageSuperUserRole(username string, enableSuperUser bool) error
	ManageCreateRole(username string, enableCreateRole bool) error
	ManageSystemFunctions(dbName string, functions map[string]string) error

	DBCloser
}

func New

func New(cfg Config) (Client, error)

type Config

type Config struct {
	Log    logr.Logger
	DBType string // type of DB, only postgres
	// connection string to connect to DB ie. postgres://username:password@1.2.3.4:5432/mydb?sslmode=verify-full
	// FQDN to connect to database including username and password if not using an IAM enabled user
	DSN string
	// UseIAM bool
	UseIAM bool // attempt to connect with IAM user provided in DSN
}

type CredentialsProviderFunc

type CredentialsProviderFunc aws.CredentialsProviderFunc

type DBClient

type DBClient interface {
	Client
	CreateDataBase(name string) (bool, error)
}

DBClient is retired interface, use Client

func DBClientFactory

func DBClientFactory(log logr.Logger, dbType, host, port, user, password, sslmode string) (DBClient, error)

DBClientFactory, deprecated don't use Unable to pass database name here, so database name is always "postgres"

type DBCloser

type DBCloser interface {
	Close() error
}

Jump to

Keyboard shortcuts

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