package pgx

import "github.com/golang-migrate/migrate/v4/database/pgx"

Index

Constants

const (
	LockStrategyAdvisory = "advisory"
	LockStrategyTable    = "table"
)

Variables

var (
	DefaultMigrationsTable       = "schema_migrations"
	DefaultMultiStatementMaxSize = 10 * 1 << 20 // 10 MB
	DefaultLockTable             = "schema_lock"
	DefaultLockStrategy          = LockStrategyAdvisory
)
var (
	ErrNilConfig      = fmt.Errorf("no config")
	ErrNoDatabaseName = fmt.Errorf("no database name")
	ErrNoSchema       = fmt.Errorf("no schema")
	ErrDatabaseDirty  = fmt.Errorf("database is dirty")
)

Functions

func WithInstance

func WithInstance(instance *sql.DB, config *Config) (database.Driver, error)

Types

type Config

type Config struct {
	MigrationsTable string
	DatabaseName    string
	SchemaName      string
	LockTable       string
	LockStrategy    string

	StatementTimeout      time.Duration
	MigrationsTableQuoted bool
	MultiStatementEnabled bool
	MultiStatementMaxSize int
	// contains filtered or unexported fields
}

type Postgres

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

func (*Postgres) Close

func (p *Postgres) Close() error

func (*Postgres) Drop

func (p *Postgres) Drop() (err error)

func (*Postgres) Lock

func (p *Postgres) Lock() error

func (*Postgres) Open

func (p *Postgres) Open(url string) (database.Driver, error)

func (*Postgres) Run

func (p *Postgres) Run(migration io.Reader) error

func (*Postgres) SetVersion

func (p *Postgres) SetVersion(version int, dirty bool) error

func (*Postgres) Unlock

func (p *Postgres) Unlock() error

func (*Postgres) Version

func (p *Postgres) Version() (version int, dirty bool, err error)

Source Files

pgx.go

Directories

PathSynopsis
database/pgx/v5
Version
v4.17.1
Published
Apr 17, 2024
Platform
darwin/amd64
Imports
18 packages
Last checked
1 hour ago

Tools for package owners.