postgres

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package postgres provides the PostgreSQL dialect for dbmigrate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(dsn string) (*sql.DB, error)

Open returns an *sql.DB for the given Postgres DSN using pgx.

func QuoteIdentifier

func QuoteIdentifier(s string) string

QuoteIdentifier quotes a Postgres identifier defensively.

Types

type PostgresDialect

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

PostgresDialect implements dbmigrate.Dialect for PostgreSQL.

func Dialect

func Dialect() *PostgresDialect

Dialect returns the PostgreSQL dialect for dbmigrate.

func (*PostgresDialect) DropTableSQL

func (p *PostgresDialect) DropTableSQL(schema, table string) string

DropTableSQL returns SQL to drop a table in a schema with CASCADE.

func (*PostgresDialect) EnsureTableSQL

func (p *PostgresDialect) EnsureTableSQL(tableName string) string

EnsureTableSQL returns the CREATE TABLE statement for the tracking table.

func (*PostgresDialect) ListTablesSQL

func (p *PostgresDialect) ListTablesSQL() string

ListTablesSQL returns the query used by Fresh to list user tables.

func (*PostgresDialect) Lock

func (p *PostgresDialect) Lock(ctx context.Context, db *sql.DB) (func() error, error)

Lock uses pg_advisory_lock on a dedicated connection.

func (*PostgresDialect) Name

func (p *PostgresDialect) Name() string

Name returns the dialect name.

func (*PostgresDialect) QuoteIdentifier

func (d *PostgresDialect) QuoteIdentifier(s string) string

QuoteIdentifier quotes an identifier with double quotes.

func (*PostgresDialect) TimestampDefault

func (p *PostgresDialect) TimestampDefault() string

TimestampDefault returns the Postgres current-timestamp expression.

Jump to

Keyboard shortcuts

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