cockroachdb

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package cockroachdb provides a CockroachDB driver for Queen migrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuoteIdentifier

func QuoteIdentifier(name string) string

QuoteIdentifier quotes a SQL identifier.

Types

type Driver

type Driver struct {
	base.Driver
	// contains filtered or unexported fields
}

Driver implements the queen.Driver interface for CockroachDB.

func New

func New(db *sql.DB) (*Driver, error)

New creates a new CockroachDB driver.

func NewWithTableName

func NewWithTableName(db *sql.DB, tableName string) (*Driver, error)

NewWithTableName creates a new CockroachDB driver with a custom table name.

func (*Driver) Exec

func (d *Driver) Exec(ctx context.Context, isolationLevel sql.IsolationLevel, fn func(*sql.Tx) error) error

Exec executes fn in a transaction and retries CockroachDB serialization failures. Callbacks can run more than once and must therefore be retry-safe.

func (*Driver) Init

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

Init creates the migrations tracking table and lock table if they don't exist.

func (*Driver) Lock

func (d *Driver) Lock(ctx context.Context, timeout time.Duration) error

Lock uses a table row with expiry as the migration guard.

func (*Driver) RecordTx

func (d *Driver) RecordTx(ctx context.Context, tx *sql.Tx, m *queen.Migration, meta *queen.MigrationMetadata) error

RecordTx records a migration in the transaction used for its body.

func (*Driver) RemoveTx

func (d *Driver) RemoveTx(ctx context.Context, tx *sql.Tx, version string) error

RemoveTx removes a migration record in the transaction used for rollback.

func (*Driver) Unlock

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

Unlock releases the migration lock.

Jump to

Keyboard shortcuts

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