postgres

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package postgres provides a PostgreSQL-backed storage driver using ent ORM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct {
	*entdriver.EntDriver
	// contains filtered or unexported fields
}

Driver implements storage.Driver using PostgreSQL via the ent driver.

func NewDriver

func NewDriver(ctx context.Context, connStr string) (*Driver, error)

NewDriver creates a new PostgreSQL-backed storer. The connStr is a PostgreSQL connection string, e.g. "host=localhost port=5432 user=tapes password=tapes dbname=tapes sslmode=disable" or a connection URI like "postgres://tapes:tapes@localhost:5432/tapes?sslmode=disable".

NewDriver does not run schema migrations. Call Migrate() after construction to apply any pending migrations.

func (*Driver) Migrate

func (d *Driver) Migrate(ctx context.Context) error

Migrate applies any pending schema migrations using the versioned migration engine. It is safe to call concurrently from multiple processes — a Postgres advisory lock serializes concurrent migrators.

Jump to

Keyboard shortcuts

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