package datadepend
import "ariga.io/atlas/sql/sqlcheck/datadepend"
Index ¶
- func ColumnFilled(p *sqlcheck.Pass, t *schema.Table, c *schema.Column, pos int) bool
- func HasNotNullCheck(p *sqlcheck.Pass, c *schema.Column) bool
- type Analyzer
- func New(r *schemahcl.Resource, h Handler) (*Analyzer, error)
- func (a *Analyzer) Analyze(ctx context.Context, p *sqlcheck.Pass) error
- func (a *Analyzer) Diagnostics(_ context.Context, p *sqlcheck.Pass) (diags []sqlcheck.Diagnostic)
- func (*Analyzer) Name() string
- func (a *Analyzer) Report(p *sqlcheck.Pass, diags []sqlcheck.Diagnostic) error
- type ColumnHandler
- type ColumnPass
- type Handler
Functions ¶
func ColumnFilled ¶
ColumnFilled checks if the column was filled with values before the given position.
func HasNotNullCheck ¶
HasNotNullCheck checks if the given column has a check constraint with a NOT NULL check. In case a CHECK exists, this reduces the risk for data-depend conflicts when changing a nullable column to non-nullable.
Types ¶
type Analyzer ¶
Analyzer checks data-dependent changes.
func New ¶
New creates a new data-dependent analyzer with the given options.
func (*Analyzer) Analyze ¶
Analyze runs data-depend analysis on MySQL changes.
func (*Analyzer) Diagnostics ¶
Diagnostics runs the common analysis on the file and returns its diagnostics.
func (*Analyzer) Name ¶
Name of the analyzer. Implements the sqlcheck.NamedAnalyzer interface.
func (*Analyzer) Report ¶
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 ¶
type ColumnHandler func(*ColumnPass) ([]sqlcheck.Diagnostic, error)
ColumnHandler allows provide custom diagnostic for specific column rules.
type ColumnPass ¶
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 ¶
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.
Source Files ¶
datadepend.go
- Version
- v0.32.0 (latest)
- Published
- Mar 10, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 1 month ago –
Tools for package owners.