cmds

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCobraCommandWithEscuseMeMiddlewares added in v0.2.3

func BuildCobraCommandWithEscuseMeMiddlewares(
	cmd cmds.Command,
	options ...cli.CobraParserOption,
) (*cobra.Command, error)

func GetCobraCommandEscuseMeMiddlewares added in v0.2.3

func GetCobraCommandEscuseMeMiddlewares(
	commandSettings *cli.GlazedCommandSettings,
	cmd *cobra.Command,
	args []string,
) ([]middlewares.Middleware, error)

func NewRepositoryFactory added in v0.2.4

func NewRepositoryFactory() handlers.RepositoryFactory

Types

type ESClientFactory added in v0.2.3

type ESClientFactory func(*layers.ParsedLayers) (*elasticsearch.Client, error)

type ElasticSearchCommand added in v0.2.3

type ElasticSearchCommand struct {
	*cmds.CommandDescription `yaml:",inline"`
	Query                    string `yaml:"query"`
	// contains filtered or unexported fields
}

func NewElasticSearchCommand added in v0.2.3

func NewElasticSearchCommand(
	description *cmds.CommandDescription,
	clientFactory ESClientFactory,
	query string,
) (*ElasticSearchCommand, error)

func (*ElasticSearchCommand) RenderQuery added in v0.2.3

func (esc *ElasticSearchCommand) RenderQuery(parameters map[string]interface{}) (string, error)

func (*ElasticSearchCommand) RenderQueryToJSON added in v0.2.3

func (esc *ElasticSearchCommand) RenderQueryToJSON(parameters map[string]interface{}) (string, error)

func (*ElasticSearchCommand) RunIntoGlazeProcessor added in v0.2.3

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

func (*ElasticSearchCommand) RunQueryIntoGlaze added in v0.2.3

func (esc *ElasticSearchCommand) RunQueryIntoGlaze(
	ctx context.Context,
	es *elasticsearch.Client,
	parsedLayers *layers.ParsedLayers,
	gp middlewares.Processor,
) error

type ElasticSearchCommandLoader added in v0.2.3

type ElasticSearchCommandLoader struct {
	// contains filtered or unexported fields
}

ElasticSearchCommandLoader walks through a directory and finds all directories that end with .escuse-me and loads the commands from there. The layout of an .escuse-me directory is as follows: - main.yaml (mandatory) contains the command description

  • contains flags, arguments, name, short
  • reference the query template file

- the alias folder, which contains alias definitions in single yaml files - the data folder, which contains additional data in json / csv / yaml format

  • this data is passed to the template at evaluation file, and can be used to store things like tags and constant strings, boost values and the like

func NewElasticSearchCommandLoader added in v0.2.3

func NewElasticSearchCommandLoader(
	clientFactory ESClientFactory,
) *ElasticSearchCommandLoader

func (*ElasticSearchCommandLoader) IsFileSupported added in v0.2.3

func (escl *ElasticSearchCommandLoader) IsFileSupported(f fs.FS, fileName string) bool

func (*ElasticSearchCommandLoader) LoadCommands added in v0.2.3

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

type EscuseMeCommandDescription added in v0.2.3

type EscuseMeCommandDescription 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"`

	QueryTemplate string `yaml:"queryTemplate,omitempty"`
}

type QueriesCommand

type QueriesCommand struct {
	*glazed_cmds.CommandDescription
	// contains filtered or unexported fields
}

func NewQueriesCommand

func NewQueriesCommand(
	allQueries []*ElasticSearchCommand,
	aliases []*alias.CommandAlias,
	options ...glazed_cmds.CommandDescriptionOption,
) (*QueriesCommand, error)

func (*QueriesCommand) RunIntoGlazeProcessor

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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