Help us shape the future of Go! Take the 2026 Go Developer Survey

review

package
v1.0.6 Latest Latest
Warning

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

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

Documentation

Overview

Package review plans and applies hash-bound, transactional schema migrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(request Request) error

Validate checks the reviewed hash, scope, acknowledgements and execution options without opening a database.

Types

type Artifact

type Artifact struct {
	Version  int      `json:"version"`
	Baseline Snapshot `json:"baseline"`
	Desired  Snapshot `json:"desired"`
	Steps    []Step   `json:"steps"`
	Advisory []string `json:"advisory,omitempty"`
	Hash     string   `json:"hash"`
}

func Build

func Build(ctx context.Context, db *sql.DB, opts Options) (_ Artifact, returnErr error)

func (Artifact) Acknowledgements

func (a Artifact) Acknowledgements() []string

type Options

type Options struct {
	Dialect         string
	Schema          string
	DesiredHCL      string
	Advisory        []string
	PreserveOmitted bool
}

type Outcome

type Outcome string
const (
	Applied        Outcome = "applied"
	AlreadyApplied Outcome = "already-applied"
	Failed         Outcome = "failed"
	CommitUnknown  Outcome = "commit-unknown"
)

type Request

type Request struct {
	Artifact         Artifact
	Hash             string
	Acknowledgements []string
	LockTimeout      time.Duration
}

type Result

type Result struct {
	Hash    string  `json:"hash"`
	Outcome Outcome `json:"outcome"`
	Steps   int     `json:"steps"`
}

func Apply

func Apply(ctx context.Context, db *sql.DB, request Request) (_ Result, returnErr error)

type Snapshot

type Snapshot struct {
	Dialect string `json:"dialect"`
	Schema  string `json:"schema"`
	HCL     string `json:"hcl"`
}

func Inspect

func Inspect(ctx context.Context, db *sql.DB, dialect, schemaName string) (_ Snapshot, returnErr error)

type Step

type Step struct {
	ID          string `json:"id"`
	SQL         string `json:"sql"`
	Comment     string `json:"comment,omitempty"`
	Destructive bool   `json:"destructive,omitempty"`
}

Jump to

Keyboard shortcuts

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