Documentation
¶
Overview ¶
Package postgres provides the PostgreSQL dialect for dbmigrate.
Index ¶
- func Open(dsn string) (*sql.DB, error)
- func QuoteIdentifier(s string) string
- type PostgresDialect
- func (p *PostgresDialect) DropTableSQL(schema, table string) string
- func (p *PostgresDialect) EnsureTableSQL(tableName string) string
- func (p *PostgresDialect) ListTablesSQL() string
- func (p *PostgresDialect) Lock(ctx context.Context, db *sql.DB) (func() error, error)
- func (p *PostgresDialect) Name() string
- func (d *PostgresDialect) QuoteIdentifier(s string) string
- func (p *PostgresDialect) TimestampDefault() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QuoteIdentifier ¶
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) 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.
Click to show internal directories.
Click to hide internal directories.