Documentation
¶
Overview ¶
Package application run the application
Package application run the application ¶
Package application run the application ¶
Package application run the application ¶
Package application run the application
Index ¶
- func ParseData(data []byte) (interface{}, error)
- func PrintTable(spec *Spec, fullData interface{}) error
- func ReadData(dataFilePath string) ([]byte, error)
- func ReadParseData(dataFilePath string) (interface{}, error)
- func ReadSpec(specFile string) ([]byte, error)
- func Run(args []string) error
- func ValidateDataFile(args []string) (string, error)
- func ValidateSpec(spec *Spec) error
- func ValidateSpecFile(specFile string) string
- type Alignment
- type Arguments
- type Column
- type Spec
- type StringOrStringArray
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrintTable ¶
PrintTable prints JSON data in tabular format based on the provided specification
func ReadParseData ¶
ReadParseData reads a data file and parses it into an interface{}
func ValidateDataFile ¶
ValidateDataFile validates the data file argument, ensuring that either a single file is provided or data is piped to stdin
func ValidateSpec ¶
ValidateSpec validates that the spec meets minimum requirements
func ValidateSpecFile ¶
ValidateSpecFile validates the spec file option
Types ¶
type Alignment ¶ added in v0.3.0
type Alignment string
Alignment represents text alignment in a column
type Column ¶
type Column struct {
Path StringOrStringArray `json:"path" validate:"required"`
Title string `json:"title"`
MinWidth int `json:"minWidth" validate:"min=0,ltefield=MaxWidth"`
MaxWidth int `json:"maxWidth" validate:"min=0,gtefield=MinWidth"`
Align Alignment `json:"align" validate:"omitempty,oneof=left right center"`
Width int
}
Column represents a column specification
type Spec ¶
type Spec struct {
DataPath string `json:"dataPath"`
Columns []Column `json:"columns" validate:"required,min=1,dive"`
}
Spec represents the specification structure
func ParseAndValidateSpec ¶
ParseAndValidateSpec parses JSON data into a Spec and validates it
type StringOrStringArray ¶ added in v0.3.0
type StringOrStringArray []string
StringOrStringArray is a custom type that can unmarshal from either a string or []string
func (*StringOrStringArray) UnmarshalJSON ¶ added in v0.3.0
func (s *StringOrStringArray) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler for StringOrStringArray