Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(db Database, admin AdminCredentials) error
Create executes queries to create database and user
func Delete ¶
func Delete(db Database, admin AdminCredentials) error
Delete executes queries to delete database and user
Types ¶
type AdminCredentials ¶
AdminCredentials contains admin username and password of database server
type Credentials ¶
type Credentials struct {
Name string
Username string
Password string
TemplatedSecrets map[string]string
}
Credentials contains credentials to connect database
type Database ¶
type Database interface {
CheckStatus() error
GetCredentials() Credentials
ParseAdminCredentials(data map[string][]byte) (AdminCredentials, error)
GetDatabaseAddress() DatabaseAddress
// contains filtered or unexported methods
}
Database is interface for CRUD operate of different types of databases
type DatabaseAddress ¶ added in v1.6.1
DatabaseAddress contains host and port of a database instance
type Mysql ¶
type Mysql struct {
Backend string
Host string
Port uint16
Database string
User string
Password string
SSLEnabled bool
SkipCAVerify bool
}
Mysql is a database interface, abstraced object represents a database on mysql instance can be used to execute query to mysql database
func (Mysql) CheckStatus ¶
CheckStatus checks status of mysql database if the connection to database works
func (Mysql) GetCredentials ¶
func (m Mysql) GetCredentials() Credentials
GetCredentials returns credentials of the mysql database
func (Mysql) GetDatabaseAddress ¶ added in v1.6.1
func (m Mysql) GetDatabaseAddress() DatabaseAddress
func (Mysql) ParseAdminCredentials ¶ added in v0.3.0
func (m Mysql) ParseAdminCredentials(data map[string][]byte) (AdminCredentials, error)
ParseAdminCredentials parse admin username and password of mysql database from secret data If "user" key is not defined, take "root" as admin user by default
type Postgres ¶
type Postgres struct {
Backend string
Host string
Port uint16
Database string
User string
Password string
Monitoring bool
Extensions []string
SSLEnabled bool
SkipCAVerify bool
DropPublicSchema bool
Schemas []string
}
Postgres is a database interface, abstraced object represents a database on postgres instance can be used to execute query to postgres database
func (Postgres) CheckStatus ¶
CheckStatus checks status of postgres database if the connection to database works
func (Postgres) GetCredentials ¶
func (p Postgres) GetCredentials() Credentials
GetCredentials returns credentials of the postgres database
func (Postgres) GetDatabaseAddress ¶ added in v1.6.1
func (p Postgres) GetDatabaseAddress() DatabaseAddress
func (Postgres) ParseAdminCredentials ¶ added in v0.3.0
func (p Postgres) ParseAdminCredentials(data map[string][]byte) (AdminCredentials, error)
ParseAdminCredentials parse admin username and password of postgres database from secret data If "user" key is not defined, take "postgres" as admin user by default