v1.0.5 Latest Latest

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

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




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


This section is empty.


func PostgresConnectionString

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

func PostgresURI

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


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


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@
	// 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 {
	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