cmd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: MIT Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const QueryFlagSqlcVetDisable = "@sqlc-vet-disable"
View Source
const RuleDbPrepare = "sqlc/db-prepare"

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 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
	Debug    opts.Debug
	Remote   bool
	NoRemote bool
}

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