Documentation
¶
Index ¶
- Constants
- func NewGlazedSchema(options ...GlazeSectionOption) (schema.Section, error)
- func NewJqMiddlewaresFromSettings(settings *JqSettings) (*middlewares.JqObjectMiddleware, *middlewares.JqTableMiddleware, error)
- func SetupProcessorOutput(gp *middlewares.TableProcessor, glazedValues *values.SectionValues, ...) (formatters.OutputFormatter, error)
- func SetupRowOutputFormatter(glazedValues *values.SectionValues) (formatters.RowOutputFormatter, error)
- func SetupSimpleTableProcessor(output string, tableFormat string, options ...middlewares.TableProcessorOption) (*middlewares.TableProcessor, error)
- func SetupTableOutputFormatter(glazedValues *values.SectionValues) (formatters.TableOutputFormatter, error)
- func SetupTableProcessor(glazedValues *values.SectionValues, ...) (*middlewares.TableProcessor, error)
- type ErrorRowFormatUnsupported
- type ErrorTableFormatUnsupported
- type ErrorUnknownFormat
- type FieldsFilterFlagsDefaults
- type FieldsFilterSettings
- type FieldsFiltersSection
- type GlazeSectionOption
- func WithFieldsFiltersSectionOptions(options ...schema.SectionOption) GlazeSectionOption
- func WithJqSectionOptions(options ...schema.SectionOption) GlazeSectionOption
- func WithOutputSectionOptions(options ...schema.SectionOption) GlazeSectionOption
- func WithRenameSectionOptions(options ...schema.SectionOption) GlazeSectionOption
- func WithReplaceSectionOptions(options ...schema.SectionOption) GlazeSectionOption
- func WithSelectSectionOptions(options ...schema.SectionOption) GlazeSectionOption
- func WithSkipLimitSectionOptions(options ...schema.SectionOption) GlazeSectionOption
- func WithSortSectionOptions(options ...schema.SectionOption) GlazeSectionOption
- func WithTemplateSectionOptions(options ...schema.SectionOption) GlazeSectionOption
- type GlazedSection
- func (g *GlazedSection) AddFields(...*fields.Definition)
- func (g *GlazedSection) AddSectionToCobraCommand(cmd *cobra.Command) error
- func (g *GlazedSection) Clone() schema.Section
- func (g *GlazedSection) GatherFieldsFromMap(m map[string]interface{}, onlyProvided bool, options ...fields.ParseOption) (*fields.FieldValues, error)
- func (g *GlazedSection) GetDefinitions() *fields.Definitions
- func (g *GlazedSection) GetDescription() string
- func (g *GlazedSection) GetName() string
- func (g *GlazedSection) GetPrefix() string
- func (g *GlazedSection) GetSlug() string
- func (g *GlazedSection) InitializeDefaultsFromStruct(s interface{}) error
- func (g *GlazedSection) MarshalYAML() (interface{}, error)
- func (g *GlazedSection) ParseSectionFromCobraCommand(cmd *cobra.Command, options ...fields.ParseOption) (*values.SectionValues, error)
- type JqSection
- type JqSettings
- type OutputFormatterSettings
- type OutputSection
- type RenameFlagsDefaults
- type RenameSection
- type RenameSettings
- type ReplaceSection
- type ReplaceSettings
- type SelectSection
- type SelectSettings
- type SkipLimitSection
- type SkipLimitSettings
- type SortFlagsSettings
- type SortSection
- type TemplateFlagsDefaults
- type TemplateFormatterSettings
- type TemplateSection
- type TemplateSettings
Constants ¶
const GlazedSlug = "glazed"
const GlazedTemplateSectionSlug = "glazed-template"
Variables ¶
This section is empty.
Functions ¶
func NewGlazedSchema ¶ added in v1.0.0
func NewGlazedSchema(options ...GlazeSectionOption) (schema.Section, error)
NewGlazedSchema creates a new glazed schema section containing all glazed output/formatting settings. It wraps NewGlazedSection for the schema facade package.
func NewJqMiddlewaresFromSettings ¶
func NewJqMiddlewaresFromSettings(settings *JqSettings) (*middlewares.JqObjectMiddleware, *middlewares.JqTableMiddleware, error)
func SetupProcessorOutput ¶ added in v0.3.2
func SetupProcessorOutput( gp *middlewares.TableProcessor, glazedValues *values.SectionValues, 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(glazedValues *values.SectionValues) (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(glazedValues *values.SectionValues) (formatters.TableOutputFormatter, error)
func SetupTableProcessor ¶ added in v0.3.1
func SetupTableProcessor( glazedValues *values.SectionValues, 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 use parsed values 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 FieldsFilterFlagsDefaults ¶
type FieldsFilterFlagsDefaults struct {
Fields []string `glazed:"fields"`
Filter []string `glazed:"filter"`
RegexFields []string `glazed:"regex-fields"`
RegexFilters []string `glazed:"regex-filters"`
SortColumns bool `glazed:"sort-columns"`
RemoveNulls bool `glazed:"remove-nulls"`
RemoveDuplicates []string `glazed:"remove-duplicates"`
}
type FieldsFilterSettings ¶
type FieldsFilterSettings struct {
Filters []string `glazed:"filter"`
Fields []string `glazed:"fields"`
RegexFields []string `glazed:"regex-fields"`
RegexFilters []string `glazed:"regex-filters"`
SortColumns bool `glazed:"sort-columns"`
RemoveNulls bool `glazed:"remove-nulls"`
RemoveDuplicates []string `glazed:"remove-duplicates"`
ReorderColumns []string `glazed:"reorder-columns"`
}
func NewFieldsFilterSettings ¶
func NewFieldsFilterSettings(glazedValues *values.SectionValues) (*FieldsFilterSettings, error)
func (*FieldsFilterSettings) AddMiddlewares ¶
func (ffs *FieldsFilterSettings) AddMiddlewares(p_ *middlewares.TableProcessor)
type FieldsFiltersSection ¶ added in v1.0.0
type FieldsFiltersSection struct {
*schema.SectionImpl `yaml:",inline"`
}
func NewFieldsFiltersSection ¶ added in v1.0.0
func NewFieldsFiltersSection(options ...schema.SectionOption) (*FieldsFiltersSection, error)
func (*FieldsFiltersSection) AddSectionToCobraCommand ¶ added in v1.0.0
func (f *FieldsFiltersSection) AddSectionToCobraCommand(cmd *cobra.Command) error
func (*FieldsFiltersSection) Clone ¶ added in v1.0.0
func (f *FieldsFiltersSection) Clone() schema.Section
func (*FieldsFiltersSection) ParseSectionFromCobraCommand ¶ added in v1.0.0
func (f *FieldsFiltersSection) ParseSectionFromCobraCommand( cmd *cobra.Command, options ...fields.ParseOption, ) (*values.SectionValues, error)
type GlazeSectionOption ¶ added in v1.0.0
type GlazeSectionOption func(*GlazedSection) error
func WithFieldsFiltersSectionOptions ¶ added in v1.0.0
func WithFieldsFiltersSectionOptions(options ...schema.SectionOption) GlazeSectionOption
func WithJqSectionOptions ¶ added in v1.0.0
func WithJqSectionOptions(options ...schema.SectionOption) GlazeSectionOption
func WithOutputSectionOptions ¶ added in v1.0.0
func WithOutputSectionOptions(options ...schema.SectionOption) GlazeSectionOption
func WithRenameSectionOptions ¶ added in v1.0.0
func WithRenameSectionOptions(options ...schema.SectionOption) GlazeSectionOption
func WithReplaceSectionOptions ¶ added in v1.0.0
func WithReplaceSectionOptions(options ...schema.SectionOption) GlazeSectionOption
func WithSelectSectionOptions ¶ added in v1.0.0
func WithSelectSectionOptions(options ...schema.SectionOption) GlazeSectionOption
func WithSkipLimitSectionOptions ¶ added in v1.0.0
func WithSkipLimitSectionOptions(options ...schema.SectionOption) GlazeSectionOption
func WithSortSectionOptions ¶ added in v1.0.0
func WithSortSectionOptions(options ...schema.SectionOption) GlazeSectionOption
func WithTemplateSectionOptions ¶ added in v1.0.0
func WithTemplateSectionOptions(options ...schema.SectionOption) GlazeSectionOption
type GlazedSection ¶ added in v1.0.0
type GlazedSection struct {
FieldsFiltersSection *FieldsFiltersSection `yaml:"fieldsFiltersSection"`
OutputSection *OutputSection `yaml:"outputSection"`
RenameSection *RenameSection `yaml:"renameSection"`
ReplaceSection *ReplaceSection `yaml:"replaceSection"`
SelectSection *SelectSection `yaml:"selectSection"`
TemplateSection *TemplateSection `yaml:"templateSection"`
JqSection *JqSection `yaml:"jqSection"`
SortSection *SortSection `yaml:"sortSection"`
SkipLimitSection *SkipLimitSection `yaml:"skipLimitSection"`
}
func NewGlazedSection ¶ added in v1.0.0
func NewGlazedSection(options ...GlazeSectionOption) (*GlazedSection, error)
func (*GlazedSection) AddFields ¶ added in v1.0.0
func (g *GlazedSection) AddFields(...*fields.Definition)
func (*GlazedSection) AddSectionToCobraCommand ¶ added in v1.0.0
func (g *GlazedSection) AddSectionToCobraCommand(cmd *cobra.Command) error
func (*GlazedSection) Clone ¶ added in v1.0.0
func (g *GlazedSection) Clone() schema.Section
func (*GlazedSection) GatherFieldsFromMap ¶ added in v1.0.0
func (g *GlazedSection) GatherFieldsFromMap( m map[string]interface{}, onlyProvided bool, options ...fields.ParseOption, ) (*fields.FieldValues, error)
func (*GlazedSection) GetDefinitions ¶ added in v1.0.0
func (g *GlazedSection) GetDefinitions() *fields.Definitions
func (*GlazedSection) GetDescription ¶ added in v1.0.0
func (g *GlazedSection) GetDescription() string
func (*GlazedSection) GetName ¶ added in v1.0.0
func (g *GlazedSection) GetName() string
func (*GlazedSection) GetPrefix ¶ added in v1.0.0
func (g *GlazedSection) GetPrefix() string
func (*GlazedSection) GetSlug ¶ added in v1.0.0
func (g *GlazedSection) GetSlug() string
func (*GlazedSection) InitializeDefaultsFromStruct ¶ added in v1.0.0
func (g *GlazedSection) InitializeDefaultsFromStruct(s interface{}) error
func (*GlazedSection) MarshalYAML ¶ added in v1.0.0
func (g *GlazedSection) MarshalYAML() (interface{}, error)
func (*GlazedSection) ParseSectionFromCobraCommand ¶ added in v1.0.0
func (g *GlazedSection) ParseSectionFromCobraCommand( cmd *cobra.Command, options ...fields.ParseOption, ) (*values.SectionValues, error)
type JqSection ¶ added in v1.0.0
type JqSection struct {
*schema.SectionImpl `yaml:",inline"`
}
func NewJqSection ¶ added in v1.0.0
func NewJqSection(options ...schema.SectionOption) (*JqSection, error)
type JqSettings ¶
type JqSettings struct {
JqExpression string `glazed:"jq"`
JqFile string `glazed:"jq-file"`
JqFieldExpressions map[string]string `glazed:"field-jq"`
}
func NewJqSettingsFromValues ¶ added in v1.0.0
func NewJqSettingsFromValues(glazedValues *values.SectionValues) (*JqSettings, error)
type OutputFormatterSettings ¶
type OutputFormatterSettings struct {
Output string `glazed:"output"`
OutputFile string `glazed:"output-file"`
OutputFileTemplate string `glazed:"output-file-template"`
OutputMultipleFiles bool `glazed:"output-multiple-files"`
Stream bool `glazed:"stream"`
SheetName string `glazed:"sheet-name"`
TableFormat string `glazed:"table-format"`
TableStyle string `glazed:"table-style"`
TableStyleFile string `glazed:"table-style-file"`
PrintTableStyle bool `glazed:"print-table-style"`
OutputAsObjects bool `glazed:"output-as-objects"`
FlattenObjects bool `glazed:"flatten"`
WithHeaders bool `glazed:"with-headers"`
CsvSeparator string `glazed:"csv-separator"`
Template string `glazed:"template-file"`
TemplateData map[string]interface{} `glazed:"template-data"`
TemplateFormatterSettings *TemplateFormatterSettings
SqlTableName string `glazed:"sql-table-name"`
WithUpsert bool `glazed:"sql-upsert"`
SqlSplitByRows int `glazed:"sql-split-by-rows"`
}
func NewOutputFormatterSettings ¶
func NewOutputFormatterSettings(glazedValues *values.SectionValues) (*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 OutputSection ¶ added in v1.0.0
type OutputSection struct {
*schema.SectionImpl `yaml:",inline"`
}
func NewOutputSection ¶ added in v1.0.0
func NewOutputSection(options ...schema.SectionOption) (*OutputSection, error)
func (*OutputSection) Clone ¶ added in v1.0.0
func (f *OutputSection) Clone() schema.Section
type RenameFlagsDefaults ¶
type RenameSection ¶ added in v1.0.0
type RenameSection struct {
*schema.SectionImpl `yaml:",inline"`
}
func NewRenameSection ¶ added in v1.0.0
func NewRenameSection(options ...schema.SectionOption) (*RenameSection, error)
func (*RenameSection) Clone ¶ added in v1.0.0
func (f *RenameSection) Clone() schema.Section
type RenameSettings ¶
type RenameSettings struct {
RenameFields map[types.FieldName]string
RenameRegexps row.RegexpReplacements
YamlFile string
}
func NewRenameSettingsFromValues ¶ added in v1.0.0
func NewRenameSettingsFromValues(glazedValues *values.SectionValues) (*RenameSettings, error)
func (*RenameSettings) AddMiddlewares ¶
func (rs *RenameSettings) AddMiddlewares(processor *middlewares.TableProcessor) error
type ReplaceSection ¶ added in v1.0.0
type ReplaceSection struct {
*schema.SectionImpl `yaml:",inline"`
}
func NewReplaceSection ¶ added in v1.0.0
func NewReplaceSection(options ...schema.SectionOption) (*ReplaceSection, error)
func (*ReplaceSection) Clone ¶ added in v1.0.0
func (f *ReplaceSection) Clone() schema.Section
type ReplaceSettings ¶
type ReplaceSettings struct {
ReplaceFile string `glazed:"replace-file"`
AddFields map[string]string `glazed:"add-fields"`
}
func NewReplaceSettingsFromValues ¶ added in v1.0.0
func NewReplaceSettingsFromValues(glazedValues *values.SectionValues) (*ReplaceSettings, error)
func (*ReplaceSettings) AddMiddlewares ¶
func (rs *ReplaceSettings) AddMiddlewares(of *middlewares.TableProcessor) error
type SelectSection ¶ added in v1.0.0
type SelectSection struct {
*schema.SectionImpl `yaml:",inline"`
}
func NewSelectSection ¶ added in v1.0.0
func NewSelectSection(options ...schema.SectionOption) (*SelectSection, error)
func (*SelectSection) Clone ¶ added in v1.0.0
func (f *SelectSection) Clone() schema.Section
type SelectSettings ¶
type SelectSettings struct {
SelectField string `glazed:"select"`
SelectSeparator string `glazed:"select-separator"`
SelectTemplate string `glazed:"select-template"`
}
func NewSelectSettingsFromValues ¶ added in v1.0.0
func NewSelectSettingsFromValues(glazedValues *values.SectionValues) (*SelectSettings, error)
type SkipLimitSection ¶ added in v1.0.0
type SkipLimitSection struct {
*schema.SectionImpl `yaml:",inline"`
}
func NewSkipLimitSection ¶ added in v1.0.0
func NewSkipLimitSection(options ...schema.SectionOption) (*SkipLimitSection, error)
func (*SkipLimitSection) Clone ¶ added in v1.0.0
func (f *SkipLimitSection) Clone() schema.Section
type SkipLimitSettings ¶ added in v0.4.21
func NewSkipLimitSettingsFromValues ¶ added in v1.0.0
func NewSkipLimitSettingsFromValues(glazedValues *values.SectionValues) (*SkipLimitSettings, error)
type SortFlagsSettings ¶
type SortFlagsSettings struct {
SortBy []string `glazed:"sort-by"`
}
func NewSortSettingsFromValues ¶ added in v1.0.0
func NewSortSettingsFromValues(glazedValues *values.SectionValues) (*SortFlagsSettings, error)
func (*SortFlagsSettings) AddMiddlewares ¶
func (s *SortFlagsSettings) AddMiddlewares(p_ *middlewares.TableProcessor)
type SortSection ¶ added in v1.0.0
type SortSection struct {
*schema.SectionImpl `yaml:",inline"`
}
func NewSortSection ¶ added in v1.0.0
func NewSortSection(options ...schema.SectionOption) (*SortSection, error)
func (*SortSection) Clone ¶ added in v1.0.0
func (f *SortSection) Clone() schema.Section
type TemplateFlagsDefaults ¶
type TemplateFlagsDefaults struct {
Template string `glazed:"template"`
TemplateField map[string]string `glazed:"template-field"`
UseRowTemplates bool `glazed:"use-row-templates"`
}
func NewTemplateFlagsDefaults ¶
func NewTemplateFlagsDefaults() *TemplateFlagsDefaults
type TemplateFormatterSettings ¶
TemplateFormatterSettings is probably obsolete...
type TemplateSection ¶ added in v1.0.0
type TemplateSection struct {
*schema.SectionImpl `yaml:",inline"`
}
func NewTemplateSection ¶ added in v1.0.0
func NewTemplateSection(options ...schema.SectionOption) (*TemplateSection, error)
func (*TemplateSection) Clone ¶ added in v1.0.0
func (f *TemplateSection) Clone() schema.Section
type TemplateSettings ¶
type TemplateSettings struct {
RenameSeparator string
UseRowTemplates bool `glazed:"use-row-templates"`
Templates map[types.FieldName]string
}
func NewTemplateSettings ¶
func NewTemplateSettings(section *values.SectionValues) (*TemplateSettings, error)
func (*TemplateSettings) AddMiddlewares ¶
func (tf *TemplateSettings) AddMiddlewares(p_ *middlewares.TableProcessor) error
func (*TemplateSettings) UpdateWithSelectSettings ¶
func (tf *TemplateSettings) UpdateWithSelectSettings(ss *SelectSettings)