1
1
mirror of https://github.com/wader/fq.git synced 2024-11-29 23:27:12 +03:00
fq/pkg/decode/format.go
Mattias Wadman c93301fc70 raw,bits,bytes: Replace raw format with bits and bytes format that decode to a binary
raw format was a hack to skip decoding to be able to get a binary using tobyte etc.
Now you can do fq -d bytes ... instead of fq -d raw 'tobytes | ...'
2022-11-20 19:51:12 +01:00

52 lines
915 B
Go

package decode
type Group []Format
type Dependency struct {
Names []string
Group *Group
}
type Format struct {
Name string
ProbeOrder int // probe order is from low to hi value then by name
Description string
Groups []string
DecodeFn func(d *D, _ any) any
DecodeInArg any
DecodeOutType any
RootArray bool
RootName string
Dependencies []Dependency
Help FormatHelp
Functions []string
SkipDecodeFunction bool
}
type HelpExample struct {
Comment string
Code string
}
type HelpFunction struct {
Name string
Examples []HelpExample
}
type HelpReference struct {
Title string
URL string
}
type FormatHelp struct {
Notes string
Functions []HelpFunction
References []HelpReference
}
func FormatFn(d func(d *D, _ any) any) Group {
return Group{{
DecodeFn: d,
}}
}