Documentation
¶
Overview ¶
Package pgx implements the Driver interface.
Index ¶
- func Conn(c *pgx.Conn) driver.CopyConn
- func New(tableName string) driver.DumpDriver
- func WithTransaction(tx driver.Tx, fn func() error) (err error)
- type MigratableDatabase
- type Row
- type Rows
- type SchemaMigrator
- func (m *SchemaMigrator) Drop() error
- func (m *SchemaMigrator) Dump(dw file.DumpWriter) (err error)
- func (m *SchemaMigrator) FinishRestore(migrator migrate.Migrator, schemas []string) error
- func (m *SchemaMigrator) InitCopy(schemaSuffix string, d driver.DumpDriver, newPool func(string) *pgx.ConnPool, ...) SchemaMigrator
- func (m *SchemaMigrator) Migrate() (schema string, fromVersion, toVersion file.Version, err error)
- func (m *SchemaMigrator) Path() string
- func (m *SchemaMigrator) Pool() *pgx.ConnPool
- func (m *SchemaMigrator) Restore(dr file.DumpReader) error
- func (m *SchemaMigrator) Revert() error
- func (m *SchemaMigrator) Schema() string
- func (m *SchemaMigrator) StartRestore() (migrator migrate.Migrator, schemas []string)
- func (m *SchemaMigrator) StartRevert() (migrator migrate.Migrator, schemas []string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MigratableDatabase ¶
type MigratableDatabase interface {
Pool() *pgx.ConnPool
Schema() string
Path() string
Migrate() (string, error)
Dump(file.DumpWriter) error
Restore(file.DumpReader) error
Revert() error
}
MigratableDatabase interface
type Row ¶
Row wraps *pgx.Row which is a convenience wrapper over *pgx.Rows
type SchemaMigrator ¶
SchemaMigrator struct
func (*SchemaMigrator) Drop ¶
func (m *SchemaMigrator) Drop() error
Drop rotates the schema to _bak and creates a new schema
func (*SchemaMigrator) Dump ¶
func (m *SchemaMigrator) Dump(dw file.DumpWriter) (err error)
Dump write the database to the DumpWriter
func (*SchemaMigrator) FinishRestore ¶
func (m *SchemaMigrator) FinishRestore(migrator migrate.Migrator, schemas []string) error
FinishRestore finishes the restore by rotating the schemas
func (*SchemaMigrator) InitCopy ¶
func (m *SchemaMigrator) InitCopy(schemaSuffix string, d driver.DumpDriver, newPool func(string) *pgx.ConnPool, ensureSchema bool) SchemaMigrator
InitCopy makes a copy and initializes it
func (*SchemaMigrator) Migrate ¶
func (m *SchemaMigrator) Migrate() (schema string, fromVersion, toVersion file.Version, err error)
Migrate migrate between schema versions
func (*SchemaMigrator) Pool ¶
func (m *SchemaMigrator) Pool() *pgx.ConnPool
Pool returns connection pool
func (*SchemaMigrator) Restore ¶
func (m *SchemaMigrator) Restore(dr file.DumpReader) error
Restore restores the database from the passed in DumpReader
func (*SchemaMigrator) Revert ¶
func (m *SchemaMigrator) Revert() error
Revert reverts the database to the previous version
func (*SchemaMigrator) Schema ¶
func (m *SchemaMigrator) Schema() string
Schema returns the base schema
func (*SchemaMigrator) StartRestore ¶
func (m *SchemaMigrator) StartRestore() (migrator migrate.Migrator, schemas []string)
StartRestore creates a migrator and schemas used during restore
func (*SchemaMigrator) StartRevert ¶
func (m *SchemaMigrator) StartRevert() (migrator migrate.Migrator, schemas []string)
StartRevert creates a migrator and schemas used during revert