Documentation ¶
Index ¶
- func FlattenMapIntoColumns(rows types.MapRow) types.MapRow
- func PreserveColumnOrder(oldColumns []types.FieldName, newColumns map[types.FieldName]interface{}) []types.FieldName
- type ColumnMiddlewareConfig
- type FieldsFilterMiddleware
- type FlattenObjectMiddleware
- type JqObjectMiddleware
- type JqTableMiddleware
- type ObjectGoTemplateMiddleware
- type ObjectMiddleware
- type PreserveColumnOrderMiddleware
- type RegexReplacement
- type RegexpReplacement
- type RegexpReplacements
- type RegexpSkip
- type RemoveNullsMiddleware
- type RenameColumnMiddleware
- func NewFieldRenameColumnMiddleware(renames map[types.FieldName]types.FieldName) *RenameColumnMiddleware
- func NewRegexpRenameColumnMiddleware(renames RegexpReplacements) *RenameColumnMiddleware
- func NewRenameColumnMiddleware(renames map[types.FieldName]types.FieldName, regexpRenames RegexpReplacements) *RenameColumnMiddleware
- func NewRenameColumnMiddlewareFromYAML(decoder *yaml.Decoder) (*RenameColumnMiddleware, error)
- type ReorderColumnOrderMiddleware
- type ReplaceMiddleware
- type Replacement
- type RowGoTemplateMiddleware
- type Skip
- type SortColumnsMiddleware
- type TableMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ColumnMiddlewareConfig ¶
type ColumnMiddlewareConfig struct { FieldRenames map[types.FieldName]types.FieldName `yaml:"renames"` // FIXME regex renames actually need to ordered RegexpRenames RegexpReplacements `yaml:"regexpRenames"` }
type FieldsFilterMiddleware ¶
type FieldsFilterMiddleware struct {
// contains filtered or unexported fields
}
FieldsFilterMiddleware keeps columns that are in the fields list and removes columns that are in the filters list.
empty lists means that all columns are accepted.
The returned rows are SimpleRows
func NewFieldsFilterMiddleware ¶
func NewFieldsFilterMiddleware(fields []string, filters []string) *FieldsFilterMiddleware
type FlattenObjectMiddleware ¶
type FlattenObjectMiddleware struct { }
func NewFlattenObjectMiddleware ¶
func NewFlattenObjectMiddleware() *FlattenObjectMiddleware
type JqObjectMiddleware ¶ added in v0.2.33
type JqObjectMiddleware struct {
// contains filtered or unexported fields
}
func NewJqObjectMiddleware ¶ added in v0.2.33
func NewJqObjectMiddleware( expression string, ) (*JqObjectMiddleware, error)
type JqTableMiddleware ¶ added in v0.2.33
type JqTableMiddleware struct {
// contains filtered or unexported fields
}
func NewJqTableMiddleware ¶ added in v0.2.33
func NewJqTableMiddleware( fieldExpressions map[types.FieldName]string, ) (*JqTableMiddleware, error)
type ObjectGoTemplateMiddleware ¶
type ObjectGoTemplateMiddleware struct {
// contains filtered or unexported fields
}
func NewObjectGoTemplateMiddleware ¶
func NewObjectGoTemplateMiddleware( templateStrings map[types.FieldName]string, ) (*ObjectGoTemplateMiddleware, error)
NewObjectGoTemplateMiddleware creates a new template firmware used to process individual objects.
It will render the template for each object and return a single field.
TODO(manuel, 2023-02-02) Add support for passing in custom funcmaps See #110 https://github.com/go-go-golems/glazed/issues/110
func (*ObjectGoTemplateMiddleware) Process ¶
func (rgtm *ObjectGoTemplateMiddleware) Process(object map[string]interface{}) ([]map[string]interface{}, error)
Process will render each template for the input object and return an object with the newly created fields.
TODO(manuel, 2022-11-21) This should allow merging the new results straight back
type ObjectMiddleware ¶
type PreserveColumnOrderMiddleware ¶
type PreserveColumnOrderMiddleware struct {
// contains filtered or unexported fields
}
func NewPreserveColumnOrderMiddleware ¶
func NewPreserveColumnOrderMiddleware(columns []types.FieldName) *PreserveColumnOrderMiddleware
type RegexReplacement ¶
type RegexpReplacement ¶
type RegexpReplacements ¶
type RegexpReplacements []*RegexpReplacement
func (*RegexpReplacements) UnmarshalYAML ¶
func (rr *RegexpReplacements) UnmarshalYAML(value *yaml.Node) error
type RegexpSkip ¶
type RemoveNullsMiddleware ¶ added in v0.2.44
type RemoveNullsMiddleware struct { }
func NewRemoveNullsMiddleware ¶ added in v0.2.44
func NewRemoveNullsMiddleware() *RemoveNullsMiddleware
type RenameColumnMiddleware ¶
type RenameColumnMiddleware struct { Renames map[types.FieldName]types.FieldName // orderedmap *regexp.Regexp -> string RegexpRenames RegexpReplacements }
func NewFieldRenameColumnMiddleware ¶
func NewFieldRenameColumnMiddleware(renames map[types.FieldName]types.FieldName) *RenameColumnMiddleware
func NewRegexpRenameColumnMiddleware ¶
func NewRegexpRenameColumnMiddleware(renames RegexpReplacements) *RenameColumnMiddleware
func NewRenameColumnMiddleware ¶
func NewRenameColumnMiddleware( renames map[types.FieldName]types.FieldName, regexpRenames RegexpReplacements, ) *RenameColumnMiddleware
func NewRenameColumnMiddlewareFromYAML ¶
func NewRenameColumnMiddlewareFromYAML(decoder *yaml.Decoder) (*RenameColumnMiddleware, error)
type ReorderColumnOrderMiddleware ¶
type ReorderColumnOrderMiddleware struct {
// contains filtered or unexported fields
}
func NewReorderColumnOrderMiddleware ¶
func NewReorderColumnOrderMiddleware(columns []types.FieldName) *ReorderColumnOrderMiddleware
type ReplaceMiddleware ¶
type ReplaceMiddleware struct { Replacements map[types.FieldName][]*Replacement RegexReplacements map[types.FieldName][]*RegexpReplacement RegexSkips map[types.FieldName][]*RegexpSkip Skips map[types.FieldName][]*Skip }
func NewReplaceMiddleware ¶
func NewReplaceMiddleware( replacements map[types.FieldName][]*Replacement, regexReplacements map[types.FieldName][]*RegexpReplacement, regexSkips map[types.FieldName][]*RegexpSkip, skips map[types.FieldName][]*Skip, ) *ReplaceMiddleware
func NewReplaceMiddlewareFromYAML ¶
func NewReplaceMiddlewareFromYAML(b []byte) (*ReplaceMiddleware, error)
type Replacement ¶
type RowGoTemplateMiddleware ¶
type RowGoTemplateMiddleware struct { // this field is used to replace "." in keys before passing them to the template, // in order to avoid having to use the `index` template function to access fields // that contain a ".", which is frequent due to flattening. RenameSeparator string // contains filtered or unexported fields }
func NewRowGoTemplateMiddleware ¶
func NewRowGoTemplateMiddleware( templateStrings map[types.FieldName]string, renameSeparator string) (*RowGoTemplateMiddleware, error)
NewRowGoTemplateMiddleware creates a new RowGoTemplateMiddleware which is the simplest go template middleware.
It will render the template for each row and return the result as a new column called with the given title.
Because nested objects will be flattened to individual columns using the . separator, this will make fields inaccessible to the template. One way around this is to use {{ index . "field.subfield" }} in the template. Another is to pass a separator rename option.
TODO(manuel, 2023-02-02) Add support for passing in custom funcmaps See #110 https://github.com/go-go-golems/glazed/issues/110
type SortColumnsMiddleware ¶
type SortColumnsMiddleware struct { }
func NewSortColumnsMiddleware ¶
func NewSortColumnsMiddleware() *SortColumnsMiddleware