postgres

package
v0.0.0-...-837eb61 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres

type Postgres struct {
	DbMap *gorp.DbMap

	URI          string
	SchemaPath   string
	MaxIdleConns int
	MaxOpenConns int
	// contains filtered or unexported fields
}

func Start

func Start(c *config.Notifications) (*Postgres, error)

func (*Postgres) Clear

func (db *Postgres) Clear() error

Clear deletes everything in the database. It's here to support integration testing of migrations. Using it outside of testing will probably cause data loss.

func (*Postgres) Connect

func (db *Postgres) Connect() error

func (*Postgres) DestructiveMigrateForTests

func (db *Postgres) DestructiveMigrateForTests() error

DestructiveMigrateForTests clears the database then forcibly runs the migrations twice. This is important to test because our db tooling will retry schema migrations in face of connection errors, etc.; the retry can only succeed if the schem migrations are written in idempotent style.

func (*Postgres) Exec

func (db *Postgres) Exec(query string, args ...interface{}) (sql.Result, error)

func (*Postgres) Migrate

func (db *Postgres) Migrate() error

func (*Postgres) Ping

func (db *Postgres) Ping() error

ping will verify if the database mapped with gorp is available

Jump to

Keyboard shortcuts

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