installers.db.postgresql #
postgresql
To get started
import freeflowuniverse.crystallib.installers.db.postgresql
mut installer:= postgresql.get()!
installer.start()!
example heroscript
!!postgresql.install
path: ''
passwd: 'asecret'
use psql
uses our hero configure output and jq command line trick
#export PGPASSWORD=`hero configure -c postgres -i default -s | jq -r '.passwd'`
psql -U 'root' -h localhost
to use in other installer
//e.g. in server configure function
import freeflowuniverse.crystallib.installers.db.postgresql
mut mydbinstaller:=postgresql.get()!
mydbinstaller.start()!
// now create the DB
mydbinstaller.db_create('gitea')!
Constants #
const version = '0.0.0'
fn get #
fn get(args_ ArgsGet) !&Postgresql
fn heroscript_default #
fn heroscript_default() !string
fn play #
fn play(args_ PlayArgs) !
fn switch #
fn switch(name string)
switch instance to be used for postgresql
struct ArgsGet #
@[params]
struct ArgsGet {
pub mut:
name string
}
///////FACTORY
struct InstallArgs #
@[params]
struct InstallArgs {
pub mut:
reset bool
}
struct PlayArgs #
@[params]
struct PlayArgs {
pub mut:
heroscript string // if filled in then plbook will be made out of it
plbook ?playbook.PlayBook
reset bool
}
struct Postgresql #
struct Postgresql {
pub mut:
name string = 'default'
path string
passwd string
container_id string
}
fn (Postgresql) check #
fn (mut server Postgresql) check() !
fn (Postgresql) db #
fn (mut server Postgresql) db() !pg.DB
fn (Postgresql) db_create #
fn (mut server Postgresql) db_create(name_ string) !
fn (Postgresql) db_delete #
fn (mut server Postgresql) db_delete(name_ string) !
fn (Postgresql) db_exists #
fn (mut server Postgresql) db_exists(name_ string) !bool
fn (Postgresql) destroy #
fn (mut self Postgresql) destroy() !
fn (Postgresql) install #
fn (mut self Postgresql) install(args InstallArgs) !
fn (Postgresql) install_start #
fn (mut self Postgresql) install_start(args InstallArgs) !
fn (Postgresql) path_config #
fn (mut server Postgresql) path_config() !pathlib.Path
fn (Postgresql) path_data #
fn (mut server Postgresql) path_data() !pathlib.Path
fn (Postgresql) path_export #
fn (mut server Postgresql) path_export() !pathlib.Path
fn (Postgresql) reload #
fn (mut self Postgresql) reload() !
load from disk and make sure is properly intialized
fn (Postgresql) restart #
fn (mut self Postgresql) restart() !
fn (Postgresql) running #
fn (mut self Postgresql) running() !bool
fn (Postgresql) start #
fn (mut self Postgresql) start() !
fn (Postgresql) stop #
fn (mut self Postgresql) stop() !