sqlstorage

package
v0.0.0-...-83193db Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

func Connect

func Connect(ctx context.Context, dsn string) (*Store, error)

func NewWithMock

func NewWithMock(db *sqlx.DB, lockID int64) *Store

NewWithMock is only for tests; allows injection of custom DB.

func (*Store) AppliedVersions

func (s *Store) AppliedVersions(ctx context.Context) (map[int64]bool, error)

Return map[version]isApplied.

func (*Store) Close

func (s *Store) Close() error

func (*Store) MarkApplied

func (s *Store) MarkApplied(ctx context.Context, tx *sqlx.Tx, version int64, name string) error

Add migration record.

func (*Store) MarkRolledBack

func (s *Store) MarkRolledBack(ctx context.Context, tx *sqlx.Tx, version int64) error

Remove migration record.

func (*Store) WithExclusive

func (s *Store) WithExclusive(ctx context.Context, fn func(*sqlx.Tx) error) error

Take advisory-lock, start transaction, call fn and commit.

Jump to

Keyboard shortcuts

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