cmds

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRepositoryFactory

func NewRepositoryFactory() handlers.RepositoryFactory

Types

type SqlCommand

type SqlCommand struct {
	*cmds.CommandDescription `yaml:",inline"`
	Query                    string            `yaml:"query"`
	SubQueries               map[string]string `yaml:"subqueries,omitempty"`
	// contains filtered or unexported fields
}

SqlCommand describes a command line command that runs a query

func NewSqlCommand

func NewSqlCommand(
	description *cmds.CommandDescription,
	options ...SqlCommandOption,
) (*SqlCommand, error)

func (*SqlCommand) Description

func (s *SqlCommand) Description() *cmds.CommandDescription

func (*SqlCommand) IsValid

func (s *SqlCommand) IsValid() bool

func (*SqlCommand) Metadata added in v0.1.74

func (s *SqlCommand) Metadata(
	ctx context.Context,
	parsedLayers *layers.ParsedLayers) (map[string]interface{}, error)

func (*SqlCommand) RenderQuery

func (s *SqlCommand) RenderQuery(
	ctx context.Context,
	ps map[string]interface{},
	db *sqlx.DB,
) (string, error)

func (*SqlCommand) RenderQueryFull

func (s *SqlCommand) RenderQueryFull(
	ctx context.Context,
	parsedLayers *layers.ParsedLayers,
) (string, error)

func (*SqlCommand) RunIntoGlazeProcessor added in v0.2.0

func (s *SqlCommand) RunIntoGlazeProcessor(
	ctx context.Context,
	parsedLayers *layers.ParsedLayers,
	gp middlewares.Processor,
) error

func (*SqlCommand) RunQueryIntoGlaze

func (s *SqlCommand) RunQueryIntoGlaze(
	ctx context.Context,
	db *sqlx.DB,
	gp middlewares.Processor) error

func (*SqlCommand) String

func (s *SqlCommand) String() string

func (*SqlCommand) ToYAML

func (s *SqlCommand) ToYAML(w io.Writer) error

type SqlCommandDescription

type SqlCommandDescription struct {
	Name      string                            `yaml:"name"`
	Short     string                            `yaml:"short"`
	Long      string                            `yaml:"long,omitempty"`
	Layout    []*layout.Section                 `yaml:"layout,omitempty"`
	Flags     []*parameters.ParameterDefinition `yaml:"flags,omitempty"`
	Arguments []*parameters.ParameterDefinition `yaml:"arguments,omitempty"`
	Layers    []layers.ParameterLayer           `yaml:"layers,omitempty"`

	SubQueries map[string]string `yaml:"subqueries,omitempty"`
	Query      string            `yaml:"query"`
}

type SqlCommandLoader

type SqlCommandLoader struct {
	DBConnectionFactory sql.DBConnectionFactory
}

func (*SqlCommandLoader) IsFileSupported added in v0.1.80

func (scl *SqlCommandLoader) IsFileSupported(f fs.FS, fileName string) bool

func (*SqlCommandLoader) LoadCommands added in v0.1.80

func (scl *SqlCommandLoader) LoadCommands(
	f fs.FS, entryName string,
	options []cmds.CommandDescriptionOption,
	aliasOptions []alias.Option,
) ([]cmds.Command, error)

type SqlCommandOption

type SqlCommandOption func(*SqlCommand)

func WithDbConnectionFactory

func WithDbConnectionFactory(factory clay_sql.DBConnectionFactory) SqlCommandOption

func WithQuery

func WithQuery(query string) SqlCommandOption

func WithSubQueries

func WithSubQueries(subQueries map[string]string) SqlCommandOption

type SqletonCommand

type SqletonCommand interface {
	RunQueryIntoGlaze(
		ctx context.Context,
		db *sqlx.DB,
		parameters map[string]interface{},
		gp middlewares.TableProcessor,
	) error
	RenderQuery(parameters map[string]interface{}) (string, error)
}

Jump to

Keyboard shortcuts

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