Documentation ¶
Index ¶
- Constants
- func NewJqMiddlewaresFromSettings(settings *JqSettings) (*middlewares.JqObjectMiddleware, *middlewares.JqTableMiddleware, error)
- func SetupProcessorOutput(gp *middlewares.TableProcessor, glazedLayer *layers.ParsedLayer, w io.Writer) (formatters.OutputFormatter, error)
- func SetupRowOutputFormatter(glazedLayer *layers.ParsedLayer) (formatters.RowOutputFormatter, error)
- func SetupSimpleTableProcessor(output string, tableFormat string, options ...middlewares.TableProcessorOption) (*middlewares.TableProcessor, error)
- func SetupTableOutputFormatter(glazedLayer *layers.ParsedLayer) (formatters.TableOutputFormatter, error)
- func SetupTableProcessor(glazedLayer *layers.ParsedLayer, options ...middlewares.TableProcessorOption) (*middlewares.TableProcessor, error)
- type ErrorRowFormatUnsupported
- type ErrorTableFormatUnsupported
- type ErrorUnknownFormat
- type FieldsFilterFlagsDefaults
- type FieldsFilterSettings
- type FieldsFiltersParameterLayer
- func (f *FieldsFiltersParameterLayer) AddLayerToCobraCommand(cmd *cobra.Command) error
- func (f *FieldsFiltersParameterLayer) Clone() layers.ParameterLayer
- func (f *FieldsFiltersParameterLayer) ParseLayerFromCobraCommand(cmd *cobra.Command, options ...parameters.ParseStepOption) (*layers.ParsedLayer, error)
- type GlazeParameterLayerOption
- func WithFieldsFiltersParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
- func WithJqParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
- func WithOutputParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
- func WithRenameParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
- func WithReplaceParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
- func WithSelectParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
- func WithSkipLimitParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
- func WithSortParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
- func WithTemplateParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
- type GlazedParameterLayers
- func (g *GlazedParameterLayers) AddFlags(...*parameters.ParameterDefinition)
- func (g *GlazedParameterLayers) AddLayerToCobraCommand(cmd *cobra.Command) error
- func (g *GlazedParameterLayers) Clone() layers.ParameterLayer
- func (g *GlazedParameterLayers) GatherParametersFromMap(m map[string]interface{}, onlyProvided bool, ...) (*parameters.ParsedParameters, error)
- func (g *GlazedParameterLayers) GetDescription() string
- func (g *GlazedParameterLayers) GetName() string
- func (g *GlazedParameterLayers) GetParameterDefinitions() *parameters.ParameterDefinitions
- func (g *GlazedParameterLayers) GetPrefix() string
- func (g *GlazedParameterLayers) GetSlug() string
- func (g *GlazedParameterLayers) InitializeParameterDefaultsFromStruct(s interface{}) error
- func (g *GlazedParameterLayers) MarshalYAML() (interface{}, error)
- func (g *GlazedParameterLayers) ParseLayerFromCobraCommand(cmd *cobra.Command, options ...parameters.ParseStepOption) (*layers.ParsedLayer, error)
- type JqParameterLayer
- type JqSettings
- type OutputFormatterSettings
- type OutputParameterLayer
- type RenameFlagsDefaults
- type RenameParameterLayer
- type RenameSettings
- type ReplaceParameterLayer
- type ReplaceSettings
- type SelectParameterLayer
- type SelectSettings
- type SkipLimitParameterLayer
- type SkipLimitSettings
- type SortFlagsSettings
- type SortParameterLayer
- type TemplateFlagsDefaults
- type TemplateFormatterSettings
- type TemplateParameterLayer
- type TemplateSettings
Constants ¶
const GlazedSlug = "glazed"
const GlazedTemplateLayerSlug = "glazed-template"
Variables ¶
This section is empty.
Functions ¶
func NewJqMiddlewaresFromSettings ¶
func NewJqMiddlewaresFromSettings(settings *JqSettings) (*middlewares.JqObjectMiddleware, *middlewares.JqTableMiddleware, error)
func SetupProcessorOutput ¶ added in v0.3.2
func SetupProcessorOutput( gp *middlewares.TableProcessor, glazedLayer *layers.ParsedLayer, w io.Writer, ) (formatters.OutputFormatter, error)
SetupProcessorOutput creates a new Output middleware (either row or table, depending on the format and the stream flag set in ps) and adds it to the TableProcessor. Additional middlewares required by ] the chosen output format might be added as well (for example, flattening rows when using table-oriented output formats).
It also returns the output formatter that was created.
func SetupRowOutputFormatter ¶ added in v0.3.1
func SetupRowOutputFormatter(glazedLayer *layers.ParsedLayer) (formatters.RowOutputFormatter, error)
func SetupSimpleTableProcessor ¶ added in v0.4.36
func SetupSimpleTableProcessor( output string, tableFormat string, options ...middlewares.TableProcessorOption, ) (*middlewares.TableProcessor, error)
func SetupTableOutputFormatter ¶ added in v0.3.1
func SetupTableOutputFormatter(glazedLayer *layers.ParsedLayer) (formatters.TableOutputFormatter, error)
func SetupTableProcessor ¶ added in v0.3.1
func SetupTableProcessor( glazedLayer *layers.ParsedLayer, options ...middlewares.TableProcessorOption, ) (*middlewares.TableProcessor, error)
SetupTableProcessor processes all the glazed flags out of ps and returns a TableProcessor configured with all the necessary middlewares except for the output formatter.
DO(manuel, 2023-06-30) It would be good to used a parsedLayer here, if we ever refactor that part
Types ¶
type ErrorRowFormatUnsupported ¶ added in v0.3.2
type ErrorRowFormatUnsupported struct {
// contains filtered or unexported fields
}
func (*ErrorRowFormatUnsupported) Error ¶ added in v0.3.2
func (e *ErrorRowFormatUnsupported) Error() string
type ErrorTableFormatUnsupported ¶ added in v0.3.2
type ErrorTableFormatUnsupported struct {
// contains filtered or unexported fields
}
func (*ErrorTableFormatUnsupported) Error ¶ added in v0.3.2
func (e *ErrorTableFormatUnsupported) Error() string
type ErrorUnknownFormat ¶ added in v0.3.2
type ErrorUnknownFormat struct {
// contains filtered or unexported fields
}
func (*ErrorUnknownFormat) Error ¶ added in v0.3.2
func (e *ErrorUnknownFormat) Error() string
type FieldsFilterSettings ¶
type FieldsFilterSettings struct { Filters []string `glazed.parameter:"filter"` Fields []string `glazed.parameter:"fields"` SortColumns bool `glazed.parameter:"sort-columns"` RemoveNulls bool `glazed.parameter:"remove-nulls"` RemoveDuplicates []string `glazed.parameter:"remove-duplicates"` ReorderColumns []string `glazed.parameter:"reorder-columns"` }
func NewFieldsFilterSettings ¶
func NewFieldsFilterSettings(glazedLayer *layers.ParsedLayer) (*FieldsFilterSettings, error)
func (*FieldsFilterSettings) AddMiddlewares ¶
func (ffs *FieldsFilterSettings) AddMiddlewares(p_ *middlewares.TableProcessor)
type FieldsFiltersParameterLayer ¶
type FieldsFiltersParameterLayer struct {
*layers.ParameterLayerImpl `yaml:",inline"`
}
func NewFieldsFiltersParameterLayer ¶
func NewFieldsFiltersParameterLayer(options ...layers.ParameterLayerOptions) (*FieldsFiltersParameterLayer, error)
func (*FieldsFiltersParameterLayer) AddLayerToCobraCommand ¶ added in v0.4.36
func (f *FieldsFiltersParameterLayer) AddLayerToCobraCommand(cmd *cobra.Command) error
func (*FieldsFiltersParameterLayer) Clone ¶ added in v0.4.36
func (f *FieldsFiltersParameterLayer) Clone() layers.ParameterLayer
func (*FieldsFiltersParameterLayer) ParseLayerFromCobraCommand ¶ added in v0.4.36
func (f *FieldsFiltersParameterLayer) ParseLayerFromCobraCommand( cmd *cobra.Command, options ...parameters.ParseStepOption, ) (*layers.ParsedLayer, error)
type GlazeParameterLayerOption ¶
type GlazeParameterLayerOption func(*GlazedParameterLayers) error
func WithFieldsFiltersParameterLayerOptions ¶
func WithFieldsFiltersParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
func WithJqParameterLayerOptions ¶
func WithJqParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
func WithOutputParameterLayerOptions ¶
func WithOutputParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
func WithRenameParameterLayerOptions ¶
func WithRenameParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
func WithReplaceParameterLayerOptions ¶
func WithReplaceParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
func WithSelectParameterLayerOptions ¶
func WithSelectParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
func WithSkipLimitParameterLayerOptions ¶ added in v0.4.21
func WithSkipLimitParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
func WithSortParameterLayerOptions ¶
func WithSortParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
func WithTemplateParameterLayerOptions ¶
func WithTemplateParameterLayerOptions(options ...layers.ParameterLayerOptions) GlazeParameterLayerOption
type GlazedParameterLayers ¶
type GlazedParameterLayers struct { FieldsFiltersParameterLayer *FieldsFiltersParameterLayer `yaml:"fieldsFiltersParameterLayer"` OutputParameterLayer *OutputParameterLayer `yaml:"outputParameterLayer"` RenameParameterLayer *RenameParameterLayer `yaml:"renameParameterLayer"` ReplaceParameterLayer *ReplaceParameterLayer `yaml:"replaceParameterLayer"` SelectParameterLayer *SelectParameterLayer `yaml:"selectParameterLayer"` TemplateParameterLayer *TemplateParameterLayer `yaml:"templateParameterLayer"` JqParameterLayer *JqParameterLayer `yaml:"jqParameterLayer"` SortParameterLayer *SortParameterLayer `yaml:"sortParameterLayer"` SkipLimitParameterLayer *SkipLimitParameterLayer `yaml:"skipLimitParameterLayer"` }
func NewGlazedParameterLayers ¶
func NewGlazedParameterLayers(options ...GlazeParameterLayerOption) (*GlazedParameterLayers, error)
func (*GlazedParameterLayers) AddFlags ¶ added in v0.4.36
func (g *GlazedParameterLayers) AddFlags(...*parameters.ParameterDefinition)
func (*GlazedParameterLayers) AddLayerToCobraCommand ¶ added in v0.4.36
func (g *GlazedParameterLayers) AddLayerToCobraCommand(cmd *cobra.Command) error
func (*GlazedParameterLayers) Clone ¶ added in v0.4.36
func (g *GlazedParameterLayers) Clone() layers.ParameterLayer
func (*GlazedParameterLayers) GatherParametersFromMap ¶ added in v0.4.36
func (g *GlazedParameterLayers) GatherParametersFromMap( m map[string]interface{}, onlyProvided bool, options ...parameters.ParseStepOption, ) (*parameters.ParsedParameters, error)
func (*GlazedParameterLayers) GetDescription ¶
func (g *GlazedParameterLayers) GetDescription() string
func (*GlazedParameterLayers) GetName ¶
func (g *GlazedParameterLayers) GetName() string
func (*GlazedParameterLayers) GetParameterDefinitions ¶
func (g *GlazedParameterLayers) GetParameterDefinitions() *parameters.ParameterDefinitions
func (*GlazedParameterLayers) GetPrefix ¶
func (g *GlazedParameterLayers) GetPrefix() string
func (*GlazedParameterLayers) GetSlug ¶
func (g *GlazedParameterLayers) GetSlug() string
func (*GlazedParameterLayers) InitializeParameterDefaultsFromStruct ¶
func (g *GlazedParameterLayers) InitializeParameterDefaultsFromStruct(s interface{}) error
func (*GlazedParameterLayers) MarshalYAML ¶ added in v0.4.0
func (g *GlazedParameterLayers) MarshalYAML() (interface{}, error)
func (*GlazedParameterLayers) ParseLayerFromCobraCommand ¶ added in v0.4.36
func (g *GlazedParameterLayers) ParseLayerFromCobraCommand( cmd *cobra.Command, options ...parameters.ParseStepOption, ) (*layers.ParsedLayer, error)
type JqParameterLayer ¶
type JqParameterLayer struct {
*layers.ParameterLayerImpl `yaml:",inline"`
}
func NewJqParameterLayer ¶
func NewJqParameterLayer(options ...layers.ParameterLayerOptions) (*JqParameterLayer, error)
func (*JqParameterLayer) Clone ¶ added in v0.4.36
func (f *JqParameterLayer) Clone() layers.ParameterLayer
type JqSettings ¶
type JqSettings struct { JqExpression string `glazed.parameter:"jq"` JqFile string `glazed.parameter:"jq-file"` JqFieldExpressions map[string]string `glazed.parameter:"field-jq"` }
func NewJqSettingsFromParameters ¶
func NewJqSettingsFromParameters(glazedLayer *layers.ParsedLayer) (*JqSettings, error)
type OutputFormatterSettings ¶
type OutputFormatterSettings struct { Output string `glazed.parameter:"output"` OutputFile string `glazed.parameter:"output-file"` OutputFileTemplate string `glazed.parameter:"output-file-template"` OutputMultipleFiles bool `glazed.parameter:"output-multiple-files"` Stream bool `glazed.parameter:"stream"` SheetName string `glazed.parameter:"sheet-name"` TableFormat string `glazed.parameter:"table-format"` TableStyle string `glazed.parameter:"table-style"` TableStyleFile string `glazed.parameter:"table-style-file"` PrintTableStyle bool `glazed.parameter:"print-table-style"` OutputAsObjects bool `glazed.parameter:"output-as-objects"` FlattenObjects bool `glazed.parameter:"flatten"` WithHeaders bool `glazed.parameter:"with-headers"` CsvSeparator string `glazed.parameter:"csv-separator"` Template string `glazed.parameter:"template-file"` TemplateData map[string]interface{} `glazed.parameter:"template-data"` TemplateFormatterSettings *TemplateFormatterSettings SqlTableName string `glazed.parameter:"sql-table-name"` WithUpsert bool `glazed.parameter:"sql-upsert"` SqlSplitByRows int `glazed.parameter:"sql-split-by-rows"` }
func NewOutputFormatterSettings ¶
func NewOutputFormatterSettings(glazedLayer *layers.ParsedLayer) (*OutputFormatterSettings, error)
func (*OutputFormatterSettings) CreateRowOutputFormatter ¶ added in v0.3.1
func (ofs *OutputFormatterSettings) CreateRowOutputFormatter() (formatters.RowOutputFormatter, error)
func (*OutputFormatterSettings) CreateTableOutputFormatter ¶ added in v0.3.1
func (ofs *OutputFormatterSettings) CreateTableOutputFormatter() (formatters.TableOutputFormatter, error)
type OutputParameterLayer ¶
type OutputParameterLayer struct {
*layers.ParameterLayerImpl `yaml:",inline"`
}
func NewOutputParameterLayer ¶
func NewOutputParameterLayer(options ...layers.ParameterLayerOptions) (*OutputParameterLayer, error)
func (*OutputParameterLayer) Clone ¶ added in v0.4.36
func (f *OutputParameterLayer) Clone() layers.ParameterLayer
type RenameFlagsDefaults ¶
type RenameParameterLayer ¶
type RenameParameterLayer struct {
*layers.ParameterLayerImpl `yaml:",inline"`
}
func NewRenameParameterLayer ¶
func NewRenameParameterLayer(options ...layers.ParameterLayerOptions) (*RenameParameterLayer, error)
func (*RenameParameterLayer) Clone ¶ added in v0.4.36
func (f *RenameParameterLayer) Clone() layers.ParameterLayer
type RenameSettings ¶
type RenameSettings struct { RenameFields map[types.FieldName]string RenameRegexps row.RegexpReplacements YamlFile string }
func NewRenameSettingsFromParameters ¶
func NewRenameSettingsFromParameters(glazedLayer *layers.ParsedLayer) (*RenameSettings, error)
func (*RenameSettings) AddMiddlewares ¶
func (rs *RenameSettings) AddMiddlewares(processor *middlewares.TableProcessor) error
type ReplaceParameterLayer ¶
type ReplaceParameterLayer struct {
*layers.ParameterLayerImpl `yaml:",inline"`
}
func NewReplaceParameterLayer ¶
func NewReplaceParameterLayer(options ...layers.ParameterLayerOptions) (*ReplaceParameterLayer, error)
func (*ReplaceParameterLayer) Clone ¶ added in v0.4.36
func (f *ReplaceParameterLayer) Clone() layers.ParameterLayer
type ReplaceSettings ¶
type ReplaceSettings struct { ReplaceFile string `glazed.parameter:"replace-file"` AddFields map[string]string `glazed.parameter:"add-fields"` }
func NewReplaceSettingsFromParameters ¶
func NewReplaceSettingsFromParameters(glazedLayer *layers.ParsedLayer) (*ReplaceSettings, error)
func (*ReplaceSettings) AddMiddlewares ¶
func (rs *ReplaceSettings) AddMiddlewares(of *middlewares.TableProcessor) error
type SelectParameterLayer ¶
type SelectParameterLayer struct {
*layers.ParameterLayerImpl `yaml:",inline"`
}
func NewSelectParameterLayer ¶
func NewSelectParameterLayer(options ...layers.ParameterLayerOptions) (*SelectParameterLayer, error)
func (*SelectParameterLayer) Clone ¶ added in v0.4.36
func (f *SelectParameterLayer) Clone() layers.ParameterLayer
type SelectSettings ¶
type SelectSettings struct { SelectField string `glazed.parameter:"select"` SelectSeparator string `glazed.parameter:"select-separator"` SelectTemplate string `glazed.parameter:"select-template"` }
func NewSelectSettingsFromParameters ¶
func NewSelectSettingsFromParameters(glazedLayer *layers.ParsedLayer) (*SelectSettings, error)
type SkipLimitParameterLayer ¶ added in v0.4.21
type SkipLimitParameterLayer struct {
*layers.ParameterLayerImpl `yaml:",inline"`
}
func NewSkipLimitParameterLayer ¶ added in v0.4.21
func NewSkipLimitParameterLayer(options ...layers.ParameterLayerOptions) (*SkipLimitParameterLayer, error)
func (*SkipLimitParameterLayer) Clone ¶ added in v0.4.36
func (f *SkipLimitParameterLayer) Clone() layers.ParameterLayer
type SkipLimitSettings ¶ added in v0.4.21
type SkipLimitSettings struct { Skip int `glazed.parameter:"glazed-skip"` Limit int `glazed.parameter:"glazed-limit"` }
func NewSkipLimitSettingsFromParameters ¶ added in v0.4.21
func NewSkipLimitSettingsFromParameters(glazedLayer *layers.ParsedLayer) (*SkipLimitSettings, error)
type SortFlagsSettings ¶
type SortFlagsSettings struct {
SortBy []string `glazed.parameter:"sort-by"`
}
func NewSortSettingsFromParameters ¶
func NewSortSettingsFromParameters(glazedLayer *layers.ParsedLayer) (*SortFlagsSettings, error)
func (*SortFlagsSettings) AddMiddlewares ¶
func (s *SortFlagsSettings) AddMiddlewares(p_ *middlewares.TableProcessor)
type SortParameterLayer ¶
type SortParameterLayer struct {
*layers.ParameterLayerImpl `yaml:",inline"`
}
func NewSortParameterLayer ¶
func NewSortParameterLayer(options ...layers.ParameterLayerOptions) (*SortParameterLayer, error)
func (*SortParameterLayer) Clone ¶ added in v0.4.36
func (f *SortParameterLayer) Clone() layers.ParameterLayer
type TemplateFlagsDefaults ¶
type TemplateFlagsDefaults struct { Template string `glazed.parameter:"template"` TemplateField map[string]string `glazed.parameter:"template-field"` UseRowTemplates bool `glazed.parameter:"use-row-templates"` }
func NewTemplateFlagsDefaults ¶
func NewTemplateFlagsDefaults() *TemplateFlagsDefaults
type TemplateFormatterSettings ¶
TemplateFormatterSettings is probably obsolete...
type TemplateParameterLayer ¶
type TemplateParameterLayer struct {
*layers.ParameterLayerImpl `yaml:",inline"`
}
func NewTemplateParameterLayer ¶
func NewTemplateParameterLayer(options ...layers.ParameterLayerOptions) (*TemplateParameterLayer, error)
func (*TemplateParameterLayer) Clone ¶ added in v0.4.36
func (f *TemplateParameterLayer) Clone() layers.ParameterLayer
type TemplateSettings ¶
type TemplateSettings struct { RenameSeparator string UseRowTemplates bool `glazed.parameter:"use-row-templates"` Templates map[types.FieldName]string }
func NewTemplateSettings ¶
func NewTemplateSettings(layer *layers.ParsedLayer) (*TemplateSettings, error)
func (*TemplateSettings) AddMiddlewares ¶
func (tf *TemplateSettings) AddMiddlewares(p_ *middlewares.TableProcessor) error
func (*TemplateSettings) UpdateWithSelectSettings ¶
func (tf *TemplateSettings) UpdateWithSelectSettings(ss *SelectSettings)