db

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	Host          string
	Port          string
	Database      string
	Username      string
	SslMode       string
	ChangelogName string
	Interactive   bool
	// contains filtered or unexported fields
}

Session represents a user session to a specific PostgreSQL database

func NewSession

func NewSession() *Session

NewSession creates a new database session object

func (*Session) Apply

func (s *Session) Apply(m mig.File) error

func (*Session) Connect

func (s *Session) Connect() error

Connect creates a new connection to the database and makes sure it is responding by pinging it.

func (*Session) Disconnect

func (s *Session) Disconnect() error

Disconnect closes the database connection

func (*Session) EnsureChangelogExists

func (s *Session) EnsureChangelogExists() error

EnsureChangelogExists creates the changelog table if it does not exist

func (*Session) PendingMigrations

func (s *Session) PendingMigrations(dir *mig.Dir) ([]mig.File, error)

PendingMigrations returns a list of migration files that have not been applied yet, according to the changelog

Jump to

Keyboard shortcuts

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