cmds

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 31 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"`
	QueryStringTemplate      string `yaml:"query"`
	QueryNodeTemplate        *RawNode
	// contains filtered or unexported fields
}

func NewElasticSearchCommand added in v0.2.3

func NewElasticSearchCommand(
	description *cmds.CommandDescription,
	clientFactory ESClientFactory,
	queryStringTemplate string,
	queryNodeTemplate *RawNode,
) (*ElasticSearchCommand, error)

func (*ElasticSearchCommand) RenderQueryToJSON added in v0.2.3

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

func (*ElasticSearchCommand) RenderQueryToYAML added in v0.2.6

func (esc *ElasticSearchCommand) RenderQueryToYAML(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 ElasticSearchResult added in v0.2.7

type ElasticSearchResult struct {
	Hits struct {
		Hits []struct {
			Source *orderedmap.OrderedMap[string, interface{}] `json:"_source,omitempty"`
			Score  float64                                     `json:"_score"`
		} `json:"hits,omitempty"`
	} `json:"hits"`
}

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"`
	// Query is used for single file escuse-me commands, while QueryTemplate is used for directories,
	// where main.yaml is used to describe the command and the file given in the query template
	// used for the query template.
	Query *RawNode `yaml:"query,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

type RawNode added in v0.2.6

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

func (*RawNode) UnmarshalYAML added in v0.2.6

func (n *RawNode) UnmarshalYAML(value *yaml.Node) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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