Documentation
¶
Index ¶
- Constants
- func CreateDatabase(db *sql.DB, databaseName string) error
- func CreateUser(db *sql.DB, username, password string) error
- func DatabaseExists(db *sql.DB, databaseName string) (bool, error)
- func DecodeBase64(str string) []byte
- func Decrypt(itemPath, secretPath string) string
- func EncodeBase64(data []byte) string
- func Encrypt(itemPath, secretPath string) (string, error)
- func EnsureDockerWorking() error
- func GrantFullPrivileges(db *sql.DB, username, databaseName, schema string) error
- func IsContainerExist(name string) bool
- func PgConnection(conn *PostgresConnection) (*sql.DB, error)
- func RandomBytes(size int) []byte
- func RemoveContainer(name string) error
- func RunContainer(name string, args []string, imageName string) error
- func TryPgConnection(conn *PostgresConnection, attempt int) error
- func UserExists(db *sql.DB, username string) (bool, error)
- type PostgresConnection
Constants ¶
const VersionNumber = "1.1.2"
VersionNumber of the app
Variables ¶
This section is empty.
Functions ¶
func CreateDatabase ¶
CreateDatabase creates a database
func CreateUser ¶
CreateUser creates a user
func DatabaseExists ¶
DatabaseExists checks if a database exists
func DecodeBase64 ¶
DecodeBase64 decodes base64 string to bytes
func EncodeBase64 ¶
EncodeBase64 encodes bytes to base64 string
func EnsureDockerWorking ¶
func EnsureDockerWorking() error
EnsureDockerWorking ensures docker is avaiable and function properly. Return error if not.
func GrantFullPrivileges ¶
GrantFullPrivileges grants full previledges for a user to a database schema
func IsContainerExist ¶
IsContainerExist checks whether a container with the `name` already exists
func PgConnection ¶
func PgConnection(conn *PostgresConnection) (*sql.DB, error)
PgConnection connects to a postgres DB
func RemoveContainer ¶
RemoveContainer removes a container with the `name`. Returns error if any step fails.
func RunContainer ¶
RunContainer runs a container with the `name`, `args`, and `imageName`. `imageName` can contains tag. Returns error if any step fails.
func TryPgConnection ¶
func TryPgConnection(conn *PostgresConnection, attempt int) error
TryPgConnection tests connection to a postgres database