astipatch

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 8 Imported by: 2

README

Patch manager written in GO.

Languages

SQL

Patches are described as an array of transactions in yaml. Each transaction can contain multiple queries and/or rollbacks.

A transaction must only describe:

-
  queries:
    - >      
      CREATE TABLE test (
        name VARCHAR(255) NOT NULL
      )
  rollbacks:
    - DROP TABLE test
-
  queries:
    - INSERT INTO test (name) VALUES ('test 1'), ('test2')
    - UPDATE test SET name = 'test 2' WHERE id = 2
  rollbacks:
    - DELETE FROM test WHERE id IN (1, 2)
-
  queries:
    - ALTER TABLE test ADD id int NOT NULL AUTO_INCREMENT PRIMARY KEY
  rollbacks:
    - ALTER TABLE test DROP COLUMN id

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Patcher

type Patcher interface {
	Init() error
	Load(path string) error
	Patch() error
	Rollback() error
}

func NewPatcherSQL

func NewPatcherSQL(db dbSQL, s Storer, l astikit.StdLogger) Patcher

type Storer

type Storer interface {
	DeleteLastBatch() error
	Delta(patches []string) ([]string, error)
	Init() error
	InsertBatch(patches []string) error
	LastBatch() ([]string, error)
}

func NewStorerSQL

func NewStorerSQL(db dbSQL) Storer

Jump to

Keyboard shortcuts

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