pginit

package module
v0.0.0-...-850836c Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

pginit

Golang package that will create a database (if the database does not exist), create a user with a given password (if the user does not exists), and consequently grants all permissions to the user on that database.

Usage

  1. Ulogger needs to be setup. It needs to be created and passed as
pginit.Init(appName, orgName, production) // appName and orgName are strings. production is bool.
  1. Create the database
pginit.CreateDB(dbName)
  1. Create the user
pginit.CreateUser("userA", "passwd", dbName)
  1. Check if PostgreSQL server is live
dbStatus := CheckIfDBIsLive() // returns a bool mentioning if the DB server is live

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfDBIsLive

func CheckIfDBIsLive() bool

CheckIfDBIsLive returns a bool stating if the postgres server is live

func CreateDB

func CreateDB(dbName string)

CreateDB creates the database, if it doesn't exist

func CreateUser

func CreateUser(username string, password string, dbName string)

CreateUser creates the user, if it doesn't exist

func Init

func Init(appName string, orgName string, production bool)

Init needs to be called to set up the logger object

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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