db

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sqlx.DB
	*PGUrl
}

func (*DB) EnsureHasSchema

func (db *DB) EnsureHasSchema() error

func (*DB) MustHaveSchema

func (db *DB) MustHaveSchema()

func (*DB) WithInstance

func (db *DB) WithInstance(config *postgres.Config) (database.Driver, error)

type Migrations

type Migrations struct {
	*DB
	*PGUrl

	MigrationsTable string
}

func (*Migrations) Apply

func (m *Migrations) Apply(migrationsDir fs.FS) error

func (*Migrations) ListAvailable

func (m *Migrations) ListAvailable(migrationsDir fs.FS) (*bindata.AssetSource, error)

func (*Migrations) Revert

func (m *Migrations) Revert(migrationsDir fs.FS, toVersion uint) error

func (*Migrations) State

func (m *Migrations) State(migrationsDir fs.FS) (uint, bool, error)

type PGUrl

type PGUrl struct {
	*url.URL
}

func ParseConnectionStr

func ParseConnectionStr(connStr string) (*PGUrl, error)

func (*PGUrl) Connect

func (pgUrl *PGUrl) Connect() (*DB, error)

func (*PGUrl) HasPassword

func (pgUrl *PGUrl) HasPassword() bool

func (*PGUrl) SchemaSearchPath

func (pgUrl *PGUrl) SchemaSearchPath() string

SchemaSearchPath extracts the schema search path component from a PostgreSQL connection URL; if no search path is specified, the empty string is returned.

Jump to

Keyboard shortcuts

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