Documentation ¶
Index ¶
- func Connect(cfg Config) (*sqlx.DB, error)
- func MigrateDB(db *sqlx.DB, migrations migrate.MemoryMigrationSource) error
- func Setup(prefix string, migrations migrate.MemoryMigrationSource) (*sqlx.DB, error)
- func SetupDB(cfg Config, migrations migrate.MemoryMigrationSource) (*sqlx.DB, error)
- func SetupWithConfig(prefix string, migrations migrate.MemoryMigrationSource, defConfig Config) (*sqlx.DB, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MigrateDB ¶
func MigrateDB(db *sqlx.DB, migrations migrate.MemoryMigrationSource) error
MigrateDB applies any unapplied database migrations
func Setup ¶
Setup creates a connection to the PostgreSQL instance and applies any unapplied database migrations. A non-nil error is returned to indicate failure.
func SetupDB ¶
SetupDB creates a connection to the PostgreSQL instance and applies any unapplied database migrations. A non-nil error is returned to indicate failure.
func SetupWithConfig ¶
func SetupWithConfig(prefix string, migrations migrate.MemoryMigrationSource, defConfig Config) (*sqlx.DB, error)
SetupWithConfig creates a connection to the PostgreSQL instance and applies any unapplied database migrations. A non-nil error is returned to indicate failure.
Types ¶
type Config ¶
type Config struct { Host string `env:"TIMESCALE_HOST" envDefault:"localhost"` Port string `env:"TIMESCALE_PORT" envDefault:"5432"` User string `env:"TIMESCALE_USER" envDefault:"postgres"` Pass string `env:"TIMESCALE_PASSWORD" envDefault:"password"` Name string `env:"TIMESCALE_DB_NAME" envDefault:"postgres"` SSLMode string `env:"TIMESCALE_SSL_MODE" envDefault:"disable"` SSLCert string `env:"TIMESCALE_SSL_CERT" envDefault:""` SSLKey string `env:"TIMESCALE_SSL_KEY" envDefault:""` SSLRootCert string `env:"TIMESCALE_SSL_ROOT_CERT" envDefault:""` }
Config defines the options that are used when connecting to a TimescaleSQL instance
Click to show internal directories.
Click to hide internal directories.