postgres

package
v2.24.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 11 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDriver

func NewDriver(config dbmate.DriverConfig) dbmate.Driver

NewDriver initializes the driver

Types

type Driver

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

Driver provides top level database functions

func (*Driver) CreateDatabase

func (drv *Driver) CreateDatabase() error

CreateDatabase creates the specified database

func (*Driver) CreateMigrationsTable

func (drv *Driver) CreateMigrationsTable(db *sql.DB) error

CreateMigrationsTable creates the schema_migrations table

func (*Driver) DatabaseExists

func (drv *Driver) DatabaseExists() (bool, error)

DatabaseExists determines whether the database exists

func (*Driver) DeleteMigration

func (drv *Driver) DeleteMigration(db dbutil.Transaction, version string) error

DeleteMigration removes a migration record

func (*Driver) DropDatabase

func (drv *Driver) DropDatabase() error

DropDatabase drops the specified database (if it exists)

func (*Driver) DumpSchema

func (drv *Driver) DumpSchema(db *sql.DB) ([]byte, error)

DumpSchema returns the current database schema

func (*Driver) InsertMigration

func (drv *Driver) InsertMigration(db dbutil.Transaction, version string) error

InsertMigration adds a new migration record

func (*Driver) MigrationsTableExists

func (drv *Driver) MigrationsTableExists(db *sql.DB) (bool, error)

MigrationsTableExists checks if the schema_migrations table exists

func (*Driver) Open

func (drv *Driver) Open() (*sql.DB, error)

Open creates a new database connection

func (*Driver) Ping

func (drv *Driver) Ping() error

Ping verifies a connection to the database server. It does not verify whether the specified database exists.

func (*Driver) QueryError added in v2.8.0

func (drv *Driver) QueryError(query string, err error) error

Return a normalized version of the driver-specific error type.

func (*Driver) SelectMigrations

func (drv *Driver) SelectMigrations(db *sql.DB, limit int) (map[string]bool, error)

SelectMigrations returns a list of applied migrations with an optional limit (in descending order)

Jump to

Keyboard shortcuts

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