package yugabytedb

import "github.com/golang-migrate/migrate/v4/database/yugabytedb"

Index

Constants

const (
	DefaultMaxRetryInterval    = time.Second * 15
	DefaultMaxRetryElapsedTime = time.Second * 30
	DefaultMaxRetries          = 10
	DefaultMigrationsTable     = "migrations"
	DefaultLockTable           = "migrations_locks"
)

Variables

var (
	ErrNilConfig          = errors.New("no config")
	ErrNoDatabaseName     = errors.New("no database name")
	ErrMaxRetriesExceeded = errors.New("max retries exceeded")
)

Functions

func WithInstance

func WithInstance(instance *sql.DB, config *Config) (database.Driver, error)

Types

type Config

type Config struct {
	MigrationsTable     string
	LockTable           string
	ForceLock           bool
	DatabaseName        string
	MaxRetryInterval    time.Duration
	MaxRetryElapsedTime time.Duration
	MaxRetries          int
}

type YugabyteDB

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

func (*YugabyteDB) Close

func (c *YugabyteDB) Close() error

func (*YugabyteDB) Drop

func (c *YugabyteDB) Drop() (err error)

func (*YugabyteDB) Lock

func (c *YugabyteDB) Lock() error

Locking is done manually with a separate lock table. Implementing advisory locks in YugabyteDB is being discussed See: https://github.com/yugabyte/yugabyte-db/issues/3642

func (*YugabyteDB) Open

func (c *YugabyteDB) Open(dbURL string) (database.Driver, error)

func (*YugabyteDB) Run

func (c *YugabyteDB) Run(migration io.Reader) error

func (*YugabyteDB) SetVersion

func (c *YugabyteDB) SetVersion(version int, dirty bool) error

func (*YugabyteDB) Unlock

func (c *YugabyteDB) Unlock() error

Locking is done manually with a separate lock table. Implementing advisory locks in YugabyteDB is being discussed See: https://github.com/yugabyte/yugabyte-db/issues/3642

func (*YugabyteDB) Version

func (c *YugabyteDB) Version() (version int, dirty bool, err error)

Source Files

yugabytedb.go

Version
v4.18.2 (latest)
Published
Jan 27, 2025
Platform
js/wasm
Imports
16 packages
Last checked
1 week ago

Tools for package owners.