application

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 10 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseData

func ParseData(data []byte) (interface{}, error)

ParseData parses JSON data into an interface{}

func PrintTable

func PrintTable(spec *Spec, fullData interface{}) error

PrintTable prints JSON data in tabular format based on the provided specification

func ReadData

func ReadData(dataFilePath string) ([]byte, error)

ReadData reads a data file

func ReadParseData

func ReadParseData(dataFilePath string) (interface{}, error)

ReadParseData reads a data file and parses it into an interface{}

func ReadSpec

func ReadSpec(specFile string) ([]byte, error)

ReadSpec reads a spec file

func Run

func Run(args []string) error

Run start application

func ValidateDataFile

func ValidateDataFile(args []string) (string, error)

ValidateDataFile validates the data file argument, ensuring that either a single file is provided or data is piped to stdin

func ValidateSpec

func ValidateSpec(spec *Spec) error

ValidateSpec validates that the spec meets minimum requirements

func ValidateSpecFile

func ValidateSpecFile(specFile string) string

ValidateSpecFile validates the spec file option Requires either the specFile parameter or JSON2TABLE_SPEC_FILE environment variable to be set

Types

type Arguments

type Arguments struct {
	SpecFile string
	DataFile string
}

Arguments holds the parsed CLI arguments

func ParseArguments

func ParseArguments(c *cli.Command) (Arguments, error)

ParseArguments parses CLI arguments, validates them into an Arguments struct

type Column

type Column struct {
	Path  string `json:"path" validate:"required"`
	Title string `json:"title"`

	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

func ParseAndValidateSpec(data []byte) (*Spec, error)

ParseAndValidateSpec parses JSON data into a Spec and validates it

func ReadParseValidateSpec

func ReadParseValidateSpec(specFile string) (*Spec, error)

ReadParseValidateSpec reads a spec file, parses it, and validates it

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL