generic_command

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AmbiguousCommand

type AmbiguousCommand struct {
	CommandPath       string
	PotentialCommands []string
}

func (AmbiguousCommand) Error

func (e AmbiguousCommand) Error() string

type CommandNotFound

type CommandNotFound struct {
	CommandPath string
}

func (CommandNotFound) Error

func (e CommandNotFound) Error() string

type GenericCommandHandler

type GenericCommandHandler struct {
	// If true, all glazed outputs will try to use a row output if possible.
	// This means that "ragged" objects (where columns might not all be present)
	// will have missing columns, only the fields of the first object will be used
	// as rows.
	//
	// This is true per default, and needs to be explicitly set to false to use
	// a normal TableMiddleware oriented output.
	Stream bool

	// AdditionalData is passed to the template being rendered.
	AdditionalData map[string]interface{}

	ParameterFilter *config.ParameterFilter

	// TemplateName is the name of the template that is lookup up through the given TemplateLookup
	// used to render the glazed command.
	TemplateName string
	// IndexTemplateName is the name of the template that is looked up through TemplateLookup to render
	// command indexes. Leave empty to not render index pages at all.
	IndexTemplateName string
	// TemplateLookup is used to look up both TemplateName and IndexTemplateName
	TemplateLookup render.TemplateLookup

	// path under which the command handler is served
	BasePath string

	// WhitelistedLayers contains the list of layers that are allowed to be modified through query parameters.
	// If empty, all layers are allowed.
	WhitelistedLayers []string
	// contains filtered or unexported fields
}

func NewGenericCommandHandler

func NewGenericCommandHandler(options ...GenericCommandHandlerOption) (*GenericCommandHandler, error)

func (*GenericCommandHandler) ServeData

func (gch *GenericCommandHandler) ServeData(c echo.Context, command cmds.Command) error

func (*GenericCommandHandler) ServeDataTables

func (gch *GenericCommandHandler) ServeDataTables(c echo.Context, command cmds.Command, downloadPath string) error

func (*GenericCommandHandler) ServeDownload

func (gch *GenericCommandHandler) ServeDownload(c echo.Context, command cmds.Command) error

func (*GenericCommandHandler) ServeRepository

func (gch *GenericCommandHandler) ServeRepository(server *parka.Server, basePath string, repository *repositories.Repository) error

func (*GenericCommandHandler) ServeSingleCommand

func (gch *GenericCommandHandler) ServeSingleCommand(server *parka.Server, basePath string, command cmds.Command) error

func (*GenericCommandHandler) ServeStreaming

func (gch *GenericCommandHandler) ServeStreaming(c echo.Context, command cmds.Command) error

func (*GenericCommandHandler) ServeText

func (gch *GenericCommandHandler) ServeText(c echo.Context, command cmds.Command) error

type GenericCommandHandlerOption

type GenericCommandHandlerOption func(handler *GenericCommandHandler)

func WithDefaultIndexTemplateName

func WithDefaultIndexTemplateName(name string) GenericCommandHandlerOption

func WithDefaultTemplateName

func WithDefaultTemplateName(name string) GenericCommandHandlerOption

func WithIndexTemplateName

func WithIndexTemplateName(name string) GenericCommandHandlerOption

func WithMergeAdditionalData

func WithMergeAdditionalData(data map[string]interface{}, override bool) GenericCommandHandlerOption

WithMergeAdditionalData merges the passed in map with the handler's AdditionalData map. If a value is already set in the AdditionalData map and override is true, it will get overwritten.

func WithParameterFilter

func WithParameterFilter(overridesAndDefaults *config.ParameterFilter) GenericCommandHandlerOption

func WithPostMiddlewares added in v0.5.16

func WithPostMiddlewares(middlewares ...sources.Middleware) GenericCommandHandlerOption

func WithPreMiddlewares added in v0.5.16

func WithPreMiddlewares(middlewares ...sources.Middleware) GenericCommandHandlerOption

func WithTemplateName

func WithTemplateName(name string) GenericCommandHandlerOption

func WithWhitelistedLayers added in v0.5.21

func WithWhitelistedLayers(layers ...string) GenericCommandHandlerOption

Jump to

Keyboard shortcuts

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