postgres

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package postgres provides the PostgreSQL dialect.

Importing it registers the dialect under "postgres", "postgresql" and "pgx":

import _ "github.com/gruberchris/rung/dialect/postgres"

It targets PostgreSQL 12 and later and uses github.com/jackc/pgx/v5 through database/sql.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialect

type Dialect struct{}

Dialect implements rung.Dialect for PostgreSQL.

func (Dialect) DropTablesStatement

func (Dialect) DropTablesStatement(quoted []string) string

DropTablesStatement drops every named table in one statement.

CASCADE means foreign keys and dependency ordering do not matter, so there is no need to compute a safe drop order.

func (Dialect) LedgerDDL

func (Dialect) LedgerDDL() string

LedgerDDL creates the migration ledger.

func (Dialect) LedgerExistsQuery

func (Dialect) LedgerExistsQuery() string

LedgerExistsQuery reports whether the ledger exists in the current schema.

func (Dialect) ListTablesQuery

func (Dialect) ListTablesQuery() string

ListTablesQuery lists the tables in the current schema, for rung/reset.

func (Dialect) MigrationsDir

func (Dialect) MigrationsDir() string

MigrationsDir returns "postgres".

func (Dialect) Name

func (Dialect) Name() string

Name returns the canonical driver name.

func (Dialect) OpenForMigrations

func (Dialect) OpenForMigrations(dsn string) (*sql.DB, error)

OpenForMigrations opens a handle using the simple query protocol.

That is a requirement, not a preference: migration files hold several statements, and pgx's default extended protocol permits exactly one per Exec. An application's own pool should keep the default.

func (Dialect) QuoteIdentifier

func (Dialect) QuoteIdentifier(name string) string

QuoteIdentifier quotes a SQL identifier.

Table names come from the catalogue rather than from user input, but they are interpolated into a statement that cannot be parameterised, so they are quoted rather than trusted.

func (Dialect) Rebind

func (Dialect) Rebind(query string) string

Rebind converts ? placeholders to $1, $2, ….

Jump to

Keyboard shortcuts

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