generic_command

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 19 Imported by: 2

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
	// contains filtered or unexported fields
}

func NewGenericCommandHandler

func NewGenericCommandHandler(options ...GenericCommandHandlerOption) *GenericCommandHandler

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 WithTemplateName

func WithTemplateName(name string) GenericCommandHandlerOption

Jump to

Keyboard shortcuts

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