postgres

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DriverName = "postgres"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PostgresMigrationsEnabled bool   `envconfig:"POSTGRES_MIGRATIONS_ENABLED" default:"false"`
	PostgresHost              string `envconfig:"POSTGRES_HOST"`
	PostgresPort              string `envconfig:"POSTGRES_PORT"`
	PostgresUsername          string `envconfig:"POSTGRES_LOGIN"`
	PostgresPassword          string `envconfig:"POSTGRES_PASSWORD"`
	PostgresDatabase          string `envconfig:"POSTGRES_DATABASE"`
	PostgresMigrationsTable   string `envconfig:"POSTGRES_MIGRATIONS_TABLE" default:"migration_versions"`
}

func Load

func Load() (*Config, error)

func (*Config) GetPostgresDatabase

func (c *Config) GetPostgresDatabase() string

func (*Config) GetPostgresHost

func (c *Config) GetPostgresHost() string

func (*Config) GetPostgresMigrationsTable

func (c *Config) GetPostgresMigrationsTable() string

func (*Config) GetPostgresPassword

func (c *Config) GetPostgresPassword() string

func (*Config) GetPostgresPort

func (c *Config) GetPostgresPort() string

func (*Config) GetPostgresUsername

func (c *Config) GetPostgresUsername() string

func (*Config) IsPostgresMigrationsEnabled

func (c *Config) IsPostgresMigrationsEnabled() bool

type Configurator

type Configurator interface {
	IsPostgresMigrationsEnabled() bool
	GetPostgresUsername() string
	GetPostgresPassword() string
	GetPostgresDatabase() string
	GetPostgresHost() string
	GetPostgresPort() string
	GetPostgresMigrationsTable() string
}

type Postgres

type Postgres struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, cfg Configurator, fs embed.FS) (*Postgres, error)

func (*Postgres) Down

func (m *Postgres) Down() error

func (*Postgres) Name

func (m *Postgres) Name() string

func (*Postgres) Up

func (m *Postgres) Up() error

Jump to

Keyboard shortcuts

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