sqlserver

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: 15 Imported by: 0

Documentation

Overview

Package sqlserver observes and executes dependency-aware scripts on SQL Server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Batches

func Batches(name, content string) ([]string, error)

Batches splits plain T-SQL at GO and rejects unsupported sqlcmd directives.

Types

type Adoption

type Adoption struct {
	Preview  Preview            `json:"preview"`
	Evidence []AdoptionEvidence `json:"evidence"`
	Hash     string             `json:"hash"`
}

func AdoptionPlan

func AdoptionPlan(preview Preview, evidence []AdoptionEvidence) (Adoption, error)

type AdoptionEvidence

type AdoptionEvidence struct {
	ID         string `json:"id"`
	SourceHash string `json:"sourceHash"`
	Provenance string `json:"provenance"`
	Query      string `json:"query"`
	Expected   string `json:"expected"`
}

type AdoptionOptions

type AdoptionOptions struct {
	Adoption Adoption
	Verify   func(context.Context, Connection) error
}

type ApplyOptions

type ApplyOptions struct {
	Preview                     Preview
	AcknowledgeNonTransactional bool
}

type Connection

type Connection interface {
	// contains filtered or unexported methods
}

Connection is the owned SQL session available during a deployment barrier.

type ContinuationError

type ContinuationError struct{ Preview Preview }

func (*ContinuationError) Error

func (e *ContinuationError) Error() string

type ExecutionError

type ExecutionError struct {
	Outcome string
	Err     error
}

func (*ExecutionError) Error

func (e *ExecutionError) Error() string

func (*ExecutionError) Unwrap

func (e *ExecutionError) Unwrap() error

type Function

type Function struct {
	Name          string   `json:"name"`
	Type          string   `json:"type"`
	Nullable      bool     `json:"nullable"`
	Prerequisites []string `json:"prerequisites,omitempty"`
}

type Options

type Options struct {
	DB        *sql.DB
	Scope     string
	Scripts   []scripts.Script
	Functions []Function
	// contains filtered or unexported fields
}

type Preview

type Preview struct {
	Plan       scripts.Plan `json:"plan"`
	Database   string       `json:"database"`
	BundleHash string       `json:"bundleHash"`
}

func Inspect

func Inspect(ctx context.Context, opts Options, phase scripts.Phase) (Preview, error)

Inspect reads current inputs and records without creating metadata or running scripts.

type Result

type Result struct {
	Outcome      string   `json:"outcome"`
	Applied      []string `json:"applied"`
	Continuation *Preview `json:"continuation,omitempty"`
}

type Session

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

func Open

func Open(ctx context.Context, opts Options) (*Session, error)

func (*Session) Adopt

func (s *Session) Adopt(ctx context.Context, opts AdoptionOptions) (err error)

Adopt records independently verified current state without executing script bodies.

func (*Session) Apply

func (s *Session) Apply(ctx context.Context, opts ApplyOptions) (Result, error)

func (*Session) Barrier

func (s *Session) Barrier(ctx context.Context, run func(context.Context, Connection) error) error

Barrier runs a caller's reviewed schema operation while retaining the bundle lock. Subsequent inspections start with fresh observations.

func (*Session) Close

func (s *Session) Close() error

func (*Session) Inspect

func (s *Session) Inspect(ctx context.Context, phase scripts.Phase) (Preview, error)

Jump to

Keyboard shortcuts

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