typpostgres

package
v0.8.28 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDockerImage = "postgres"
	DefaultDockerName  = "postgres"

	DefaultConfigName = "PG"

	DefaultDBName   = "sample"
	DefaultUser     = "postgres"
	DefaultPassword = "pgpass"
	DefaultHost     = "localhost"
	DefaultPort     = 5432

	DefaultMigrationSrc = "scripts/db/migration"
	DefaultSeedSrc      = "scripts/db/seed"
)

Variables

This section is empty.

Functions

func Configuration added in v0.8.25

func Configuration(s *Setting) *typgo.Configuration

Configuration of postgres

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 from postgres server

func DockerRecipeV3 added in v0.8.25

func DockerRecipeV3(s *Setting) *typdocker.Recipe

DockerRecipeV3 of postgres

func GetConfigName added in v0.8.28

func GetConfigName(s *Setting) string

GetConfigName from setting

func GetDBName added in v0.8.28

func GetDBName(s *Setting) string

GetDBName from setting

func GetDockerImage added in v0.8.28

func GetDockerImage(s *Setting) string

GetDockerImage from setting

func GetDockerName added in v0.8.28

func GetDockerName(s *Setting) string

GetDockerName from setting

func GetHost added in v0.8.28

func GetHost(s *Setting) string

GetHost from setting

func GetMigrationSrc added in v0.8.28

func GetMigrationSrc(s *Setting) string

GetMigrationSrc from setting if available or the default value

func GetPassword added in v0.8.28

func GetPassword(s *Setting) string

GetPassword from setting

func GetPort added in v0.8.28

func GetPort(s *Setting) int

GetPort from setting

func GetSeedSrc added in v0.8.28

func GetSeedSrc(s *Setting) string

GetSeedSrc from setting if available or the default value

func GetUser added in v0.8.28

func GetUser(s *Setting) string

GetUser from setting

func Utility added in v0.8.25

func Utility(s *Setting) typgo.Utility

Utility of postgres

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

func (*Config) Admin added in v0.8.28

func (c *Config) Admin() *Config

Admin configuration

func (*Config) ConnStr added in v0.8.28

func (c *Config) ConnStr() string

ConnStr return connection string

type Setting added in v0.8.28

type Setting struct {
	CtorName string

	DockerName  string
	DockerImage string

	ConfigName string

	DBName   string
	User     string
	Password string
	Host     string
	Port     int

	MigrationSrc string
	SeedSrc      string
}

Setting for postgres

Jump to

Keyboard shortcuts

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