typpostgres

package
v0.8.27 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultConfigName is default lookup key for postgres configuration
	DefaultConfigName = "PG"

	// DefaultDBName is default value for dbName
	DefaultDBName = "sample"

	// DefaultUser is default value for user
	DefaultUser = "postgres"

	// DefaultPassword is default value for password
	DefaultPassword = "pgpass"

	// DefaultHost is default value for host
	DefaultHost = "localhost"

	// DefaultPort is default value for port
	DefaultPort = 5432

	// DefaultConfig for postgres
	DefaultConfig = &Config{
		DBName:   DefaultDBName,
		User:     DefaultUser,
		Password: DefaultPassword,
		Host:     DefaultHost,
		Port:     DefaultPort,
	}
)
View Source
var (
	// DefaultDockerImage is default docker image for postgres
	DefaultDockerImage = "postgres"

	// DefaultDockerName is default docker name for postgres
	DefaultDockerName = "postgres"
)
View Source
var (
	// DefaultMigrationSource is default migration source for postgres
	DefaultMigrationSource = "scripts/db/migration"

	// DefaultSeedSource is default seed source for postgres
	DefaultSeedSource = "scripts/db/seed"
)

Functions

func Commands added in v0.8.25

func Commands(c *typbuildtool.Context) []*cli.Command

Commands of module

func Connect added in v0.8.25

func Connect(cfg *Config) (db *sql.DB, err error)

Connect to postgres server

func Disconnect added in v0.8.25

func Disconnect(db *sql.DB) (err error)

Disconnect to postgres server

func DockerRecipeV3 added in v0.8.25

func DockerRecipeV3() *typdocker.Recipe

DockerRecipeV3 return recipe for docker-compose v3

func Module

func Module() *typapp.Module

Module of postgres

func Ping added in v0.8.25

func Ping(db *sql.DB) (err error)

Ping to postgres server

func Utility added in v0.8.25

func Utility() typbuildtool.Utility

Utility return new instance of PostgresUtility

Types

type Config

type Config struct {
	DBName   string `required:"true"`
	User     string `required:"true" default:"postgres"`
	Password string `required:"true" default:"pgpass"`
	Host     string `default:"localhost"`
	Port     int    `default:"5432"`
}

Config is postgres configuration

Jump to

Keyboard shortcuts

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