databasesfx

package
v3.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(fs fs.FS, cfg PostgresConfig, migrations string) (*migrate.Migrate, error)

func PostgresMigrationsModule

func PostgresMigrationsModule(mig fs.FS, cfg PostgresConfig, migrations string) fx.Option

func PostgresModule

func PostgresModule(cfg PostgresConfig) fx.Option

Types

type PostgresConfig

type PostgresConfig struct {
	ApplicationName       string        `required:"true" mapstructure:"application_name" yaml:"application_name" json:"application_name"`
	Timezone              string        `required:"true" default:"UTC" mapstructure:"timezone" yaml:"timezone" json:"timezone"`
	DBName                string        `required:"true" mapstructure:"dbname" yaml:"dbname" json:"dbname"`
	Schema                string        `required:"true" default:"public" mapstructure:"schema" yaml:"schema" json:"schema"`
	Host                  string        `required:"true" default:"localhost" mapstructure:"host" yaml:"host" json:"host"`
	SslMode               string        `required:"true" default:"disable" mapstructure:"ssl_mode" yaml:"ssl_mode" json:"ssl_mode"`
	Password              string        `required:"true" yaml:"password" mapstructure:"password" json:"password"`
	Username              string        `required:"true" yaml:"username" mapstructure:"username" json:"username"`
	MaxIdleConnection     int           `required:"true" mapstructure:"max_idle_connections" yaml:"max_idle_connections" json:"max_idle_connections"`
	ConnectionTimeout     time.Duration `required:"true" default:"5s"  mapstructure:"connection_timeout" yaml:"connection_timeout" json:"connection_timeout"`
	MaxOpenConnections    int           `required:"true" mapstructure:"max_open_connections" yaml:"max_open_connections" json:"max_open_connections"`
	MaxConnectionLifetime time.Duration `required:"true" mapstructure:"max_connection_lifetime" yaml:"max_connection_lifetime" json:"max_connection_lifetime"`
	MaxConnectionIdleTime time.Duration `required:"true" mapstructure:"max_connection_idle_time" yaml:"max_connection_idle_time" json:"max_connection_idle_time"`
	Port                  uint16        `required:"true" default:"5432" mapstructure:"port" yaml:"port" json:"port"`
}

func (*PostgresConfig) ConnectionString

func (p *PostgresConfig) ConnectionString() string

func (*PostgresConfig) MigrationConnectionString

func (p *PostgresConfig) MigrationConnectionString() string

Jump to

Keyboard shortcuts

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