workflow

package
v1.2.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, db *sql.DB, opts ApplyOptions) (any, error)

func BundleFiles

func BundleFiles(files []File) (fs.FS, error)

func Decode

func Decode(data []byte, value any) error

func Unwrap

func Unwrap(data []byte) (json.RawMessage, []string, error)

func Validate

func Validate(opts ApplyOptions) error

func Variables

func Variables(values []string) (map[string]cty.Value, error)

Types

type ApplyOptions

type ApplyOptions struct {
	Dialect     string
	Schema      string
	Artifact    json.RawMessage
	Hash        string
	Acks        []string
	LockTimeout time.Duration
	CSV         csvdata.Options
}

type File

type File struct {
	Path    string `json:"path"`
	Content string `json:"content"`
}

type Options

type Options struct {
	Dialect    string
	Schema     string
	Source     Source
	Bundle     fs.FS
	Variables  []string
	Routines   string
	AllowDrops bool
	CSV        csvdata.Options
}

type PlanResult

type PlanResult struct {
	Dialect    string            `json:"dialect"`
	Schema     string            `json:"schema"`
	Artifact   json.RawMessage   `json:"artifact"`
	Hash       string            `json:"hash"`
	Acks       []string          `json:"acks"`
	Steps      []Step            `json:"steps"`
	Changes    []native.Change   `json:"changes"`
	Warnings   []string          `json:"warnings"`
	Applicable bool              `json:"applicable"`
	SQL        string            `json:"sql"`
	CSVPlan    *csvdata.Artifact `json:"csvPlan,omitempty"`
	Original   json.RawMessage   `json:"-"`
}

func Plan

func Plan(ctx context.Context, db *sql.DB, opts Options) (PlanResult, error)

func Review

func Review(data []byte, dialect, schema string) (PlanResult, error)

type RunOptions

type RunOptions struct {
	Mode            string
	Target          dbtarget.OpenOptions
	Plan            Options
	Hash            string
	Acks            []string
	ArtifactContent json.RawMessage
	LockTimeout     string
}

type RunResult

type RunResult struct {
	Plan     *PlanResult `json:"plan,omitempty"`
	Mode     string      `json:"mode"`
	Hash     string      `json:"hash,omitempty"`
	Acks     []string    `json:"acks,omitempty"`
	Artifact any         `json:"artifact,omitempty"`
	Result   any         `json:"result,omitempty"`
}

func Execute

func Execute(ctx context.Context, opts RunOptions, record *history.Record, t *task.Task) (payload RunResult, returnErr error)

type Source

type Source struct {
	Kind    string `json:"kind"`
	Content string `json:"content,omitempty"`
	Files   []File `json:"files,omitempty"`
}

type Step

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

Jump to

Keyboard shortcuts

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