datadepend

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColumnFilled added in v0.7.1

func ColumnFilled(p *sqlcheck.Pass, t *schema.Table, c *schema.Column, pos int) bool

ColumnFilled checks if the column was filled with values before the given position.

Types

type Analyzer

type Analyzer struct {
	sqlcheck.Options
	Handler
}

Analyzer checks data-dependent changes.

func New

func New(r *schemahcl.Resource, h Handler) (*Analyzer, error)

New creates a new data-dependent analyzer with the given options.

func (*Analyzer) Analyze

func (a *Analyzer) Analyze(ctx context.Context, p *sqlcheck.Pass) error

Analyze runs data-depend analysis on MySQL changes.

func (*Analyzer) Diagnostics

func (a *Analyzer) Diagnostics(_ context.Context, p *sqlcheck.Pass) (diags []sqlcheck.Diagnostic)

Diagnostics runs the common analysis on the file and returns its diagnostics.

func (*Analyzer) Name added in v0.6.5

func (*Analyzer) Name() string

Name of the analyzer. Implements the sqlcheck.NamedAnalyzer interface.

func (*Analyzer) Report

func (a *Analyzer) Report(p *sqlcheck.Pass, diags []sqlcheck.Diagnostic) error

Report provides standard reporting for data-dependent changes. Drivers that decorate this Analyzer should call this function to get consistent reporting between dialects.

type ColumnHandler added in v0.5.0

type ColumnHandler func(*ColumnPass) ([]sqlcheck.Diagnostic, error)

ColumnHandler allows provide custom diagnostic for specific column rules.

type ColumnPass added in v0.5.0

type ColumnPass struct {
	*sqlcheck.Pass
	Change *sqlcheck.Change // Change context (statement).
	Table  *schema.Table    // The table this column belongs to.
	Column *schema.Column   // The diagnosed column.
}

ColumnPass wraps the information needed by the handler below to diagnose columns.

type Handler added in v0.6.4

type Handler struct {
	// AddNotNull is applied when a new non-nullable column was
	// added to an existing table.
	AddNotNull ColumnHandler

	// ModifyNotNull is an optional handler applied when
	// a nullable column was changed to non-nullable.
	ModifyNotNull ColumnHandler
}

Handler holds the underlying driver handlers.

Jump to

Keyboard shortcuts

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