Documentation
¶
Index ¶
- Constants
- func New(cfg Config) (*client, error)
- func PostgresConnectionString(host, port, user, password, dbname, sslmode string) string
- func PostgresURI(host, port, user, password, dbname, sslmode string) string
- type Clienter
- type Config
- type Creater
- type CredentialsProviderFunc
- type DBClient
- type DBCloser
- type Exister
- type Remover
- type Updater
Constants ¶
View Source
const ( PostgresType = "postgres" RDSReplicationRole = "rds_replication" GCPReplicationRole = "alloydbreplica" RDSSuperUserRole = "rds_superuser" )
Variables ¶
This section is empty.
Functions ¶
func PostgresURI ¶
PostgresURI returns a URI for a postgres connection
Types ¶
type Clienter ¶ added in v1.0.6
type Clienter interface {
Creater
Updater
Remover
Exister
DBCloser
GetDB() *sql.DB
Ping() error
SanitizeDSN() string
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
GetUserRoles(username string) ([]string, error)
}
type Config ¶
type Config struct {
// Cloud is `aws` or `gcp`
Cloud string
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 Creater ¶ added in v1.0.6
type Creater interface {
CreateDatabase(dbName string) (bool, error)
//Creates a user in the the database
CreateUser(username, role, userPassword string) (bool, error)
//Creates a role in the specified DB and SCHEMA - with access to this specific SCHEMA only
CreateRole(dbName, rolename, schema string) (bool, error)
CreateAdminRole(dbName, rolename, schema string) (bool, error)
CreateRegularRole(dbName, rolename, schema string) (bool, error)
CreateReadOnlyRole(dbName, rolename, schema string) (bool, error)
CreateDefaultExtensions(dbName string) error
CreateSpecialExtensions(dbName string, role string) error
CreateSchema(schemaName string) (bool, error)
}
type CredentialsProviderFunc ¶
type CredentialsProviderFunc aws.CredentialsProviderFunc
Click to show internal directories.
Click to hide internal directories.