cmd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 72 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFailedChecks = errors.New("failed checks")
View Source
var ErrPluginProcessDisabled = errors.New("plugin: process-based plugins disabled via SQLCDEBUG=processplugins=0")

Functions

func CreateDB

func CreateDB(ctx context.Context, dir, filename, querySetName string, o *Options) error

func Diff

func Diff(ctx context.Context, dir, name string, opts *Options) error

func Do

func Do(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) int

Do runs the command logic.

func Format

func Format(ctx context.Context, dir, filename string, o *Options) (map[string]string, error)

Format formats every query file referenced by the configuration with its engine's SQL formatter. It returns the formatted contents of each file, keyed by absolute path. Query files for engines without a formatter are skipped.

func Generate

func Generate(ctx context.Context, dir, filename string, o *Options) (map[string]string, error)

func NewCmdVet

func NewCmdVet() *cobra.Command

func Process

func Process(ctx context.Context, rp ResultProcessor, dir, filename string, o *Options) error

func Push

func Push(ctx context.Context, dir, filename string, opts *Options) error

func Verify

func Verify(ctx context.Context, dir, filename string, opts *Options) error

func Vet

func Vet(ctx context.Context, dir, filename string, opts *Options) error

Types

type Env

type Env struct {
	DryRun     bool
	Experiment opts.Experiment
}

func ParseEnv

func ParseEnv(c *cobra.Command) Env

func (*Env) Validate

func (e *Env) Validate(cfg *config.Config) error

type Options

type Options struct {
	Env    Env
	Stderr io.Writer
	// TODO: Move these to a command-specific struct
	Tags    []string
	Against string

	// Testing only
	MutateConfig func(*config.Config)
}

func (*Options) ReadConfig

func (o *Options) ReadConfig(dir, filename string) (string, *config.Config, error)

type OutputPair

type OutputPair struct {
	Gen    config.SQLGen
	Plugin *config.Codegen

	config.SQL
}

type ResultProcessor

type ResultProcessor interface {
	Pairs(context.Context, *config.Config) []OutputPair
	ProcessResult(context.Context, config.CombinedSettings, OutputPair, *compiler.Result) error
}

Jump to

Keyboard shortcuts

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