dialect

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dialect is what the reviewed workflows need from the registered engine dialects besides planning: the desired schema a dialect reads from HCL, a schema snapshot, and the script a plan's statements make. Importing it registers the "sqlserver", "postgres" and "sqlite" dialects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DesiredFromHCL

func DesiredFromHCL(name, hcl string) (migrate.Schema, error)

DesiredFromHCL evaluates declared HCL to the desired schema of a dialect.

func Script

func Script(name string, statements []string) (string, error)

Script joins statements into one script of the dialect.

Types

type Snapshot

type Snapshot struct {
	Dialect string         `json:"dialect"`
	Schemas []string       `json:"schemas"`
	Schema  migrate.Schema `json:"schema"`
	// Refusals are the objects the dialect could not read faithfully; they are
	// not in Schema.
	Refusals []engine.Refusal `json:"refusals,omitempty"`
}

Snapshot is the complete schema of a database, as a dialect inspects it. It is what `inspect --snapshot` prints and what a "snapshot" migration source holds as the desired state.

func Inspect

func Inspect(ctx context.Context, q engine.Querier, name string, schemas []string) (Snapshot, error)

Inspect reads every object of schemas through the dialect's own inspector.

func (Snapshot) CheckWithin

func (s Snapshot) CheckWithin(schemas []string) error

CheckWithin refuses a snapshot holding an object outside schemas.

func (Snapshot) RefuseTouched

func (s Snapshot) RefuseTouched(changes []migrate.Change) error

RefuseTouched fails when a planned change acts on an object this snapshot could not read. A snapshot used as the desired state leaves a refused object out, so planning would drop the target's copy of it.

func (Snapshot) Summary

func (s Snapshot) Summary() map[string]int

Summary counts the snapshot's objects by kind; kinds with none are omitted, except tables.

Directories

Path Synopsis
Package atlasdriver is the shared engine.Dialect implementation for the dialects that plan with an upstream Atlas driver (Postgres and SQLite).
Package atlasdriver is the shared engine.Dialect implementation for the dialects that plan with an upstream Atlas driver (Postgres and SQLite).
Package postgres registers the "postgres" engine dialect, planned with the upstream Atlas PostgreSQL driver.
Package postgres registers the "postgres" engine dialect, planned with the upstream Atlas PostgreSQL driver.
Package sqlite registers the "sqlite" engine dialect, planned with the upstream Atlas SQLite driver.
Package sqlite registers the "sqlite" engine dialect, planned with the upstream Atlas SQLite driver.
Package sqlserver is the database half of the SQL Server dialect of the schema engine: it reads capabilities, schemas and the live dependents of columns, and runs a unit on one connection.
Package sqlserver is the database half of the SQL Server dialect of the schema engine: it reads capabilities, schemas and the live dependents of columns, and runs a unit on one connection.

Jump to

Keyboard shortcuts

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