Documentation
¶
Index ¶
- Constants
- func IsValidInput(data []byte) (isValidJSON bool, isValidJSONLines bool, err error)
- func IsValidJSON(input []byte) error
- func IsValidJSONLines(input []byte) error
- func Prettify(inputJSON []byte, chromaStyle *chroma.Style, isJSONLines bool) (*bytes.Buffer, error)
- func ScanLinesWithDynamicBufferSize(input []byte, maxBufferSize int, processLine func([]byte) error) error
Constants ¶
const FourSpaces = " "
Variables ¶
This section is empty.
Functions ¶
func IsValidInput ¶ added in v0.7.0
IsValidInput checks the validity of input data as JSON or JSON lines. It takes a byte slice 'data' and returns two boolean values indicating whether the data is valid JSON and valid JSON lines, along with an error if the data is not valid in either format.
func IsValidJSON ¶ added in v0.7.0
func IsValidJSONLines ¶ added in v0.7.0
func ScanLinesWithDynamicBufferSize ¶ added in v0.7.0
func ScanLinesWithDynamicBufferSize(input []byte, maxBufferSize int, processLine func([]byte) error) error
ScanLinesWithDynamicBufferSize scans the input byte slice line by line, using a dynamically increasing buffer size. It starts with an initial buffer size of 64KB and doubles the buffer size each time a line exceeds the current buffer size, up to the specified maximum buffer size.
If a line exceeds the maximum buffer size, it returns an error.
The processLine function is called for each line and should return an error if processing fails.
The function returns an error if the input exceeds the maximum buffer size or if any other error occurs during line processing. It returns nil if all lines are processed successfully.
Types ¶
This section is empty.