lib

package
v0.0.0-...-37390f6 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2016 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

View Source
const VersionNumber = "1.1.2"

VersionNumber of the app

Variables

This section is empty.

Functions

func CreateDatabase

func CreateDatabase(db *sql.DB, databaseName string) error

CreateDatabase creates a database

func CreateUser

func CreateUser(db *sql.DB, username, password string) error

CreateUser creates a user

func DatabaseExists

func DatabaseExists(db *sql.DB, databaseName string) (bool, error)

DatabaseExists checks if a database exists

func DecodeBase64

func DecodeBase64(str string) []byte

DecodeBase64 decodes base64 string to bytes

func Decrypt

func Decrypt(itemPath, secretPath string) string

Decrypt a databag item file

func EncodeBase64

func EncodeBase64(data []byte) string

EncodeBase64 encodes bytes to base64 string

func Encrypt

func Encrypt(itemPath, secretPath string) (string, error)

Encrypt a databag item file

func EnsureDockerWorking

func EnsureDockerWorking() error

EnsureDockerWorking ensures docker is avaiable and function properly. Return error if not.

func GrantFullPrivileges

func GrantFullPrivileges(db *sql.DB, username, databaseName, schema string) error

GrantFullPrivileges grants full previledges for a user to a database schema

func IsContainerExist

func IsContainerExist(name string) bool

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 RandomBytes

func RandomBytes(size int) []byte

RandomBytes generates a random iv of size

func RemoveContainer

func RemoveContainer(name string) error

RemoveContainer removes a container with the `name`. Returns error if any step fails.

func RunContainer

func RunContainer(name string, args []string, imageName string) error

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

func UserExists

func UserExists(db *sql.DB, username string) (bool, error)

UserExists checks if a user exists

Types

type PostgresConnection

type PostgresConnection struct {
	Host     string
	Port     int
	Username string
	Password string
	Database string
	SslMode  string
}

PostgresConnection represents information about a postgres connection

Jump to

Keyboard shortcuts

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