sqlcheck

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 4 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer interface {
	// Analyze executes the analysis function.
	Analyze(context.Context, *Pass) error
}

An Analyzer describes a migration file analyzer.

type Analyzers

type Analyzers []Analyzer

Analyzers implements Analyzer.

func (Analyzers) Analyze

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

Analyze implements Analyzer.

type Change

type Change struct {
	schema.Changes        // The actual changes.
	Stmt           string // The SQL statement generated this change.
	Pos            int    // The position of the statement in the file.
}

A Change in a migration file.

type Diagnostic

type Diagnostic struct {
	Pos     int    // Diagnostic position.
	Message string // Diagnostic message.
}

A Diagnostic is a message associated with a source location or range.

type File

type File struct {
	migrate.File
	// Changes is the list of changes this file represents.
	Changes []*Change
}

File represents a parsed version of a migration file.

type Pass

type Pass struct {
	// A migration file and the changes it describes.
	File *File

	// Dev is a driver-specific environment used to execute analysis work.
	Dev *sqlclient.Client

	// Report reports a diagnostic
	Report Reporter
}

A Pass provides information to the Run function that applies a specific analyzer to an SQL file.

type Reporter

type Reporter interface {
	Report(Diagnostic)
}

Reporter represents a diagnostic reporter.

var NopReporter Reporter = ReporterFunc(func(Diagnostic) {})

NopReporter is a Reporter that does nothing.

type ReporterFunc

type ReporterFunc func(Diagnostic)

ReporterFunc is a function that implements Reporter.

func (ReporterFunc) Report

func (f ReporterFunc) Report(d Diagnostic)

Report calls f(d).

Jump to

Keyboard shortcuts

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