utils

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileTypeYAML    = "yaml"
	FileTypeJSON    = "json"
	FileTypeUnknown = "unknown"
)

Variables

This section is empty.

Functions

func IsJSON

func IsJSON(content string) bool

IsJSON checks if the passed content of JSON.

func IsYAML

func IsYAML(content string) bool

IsYAML checks if the passed content of YAML.

Types

type Object

type Object string

Object implements method that check for file content type.

func (Object) CheckFileType

func (obj Object) CheckFileType(log *logrus.Logger) string

CheckFileType checks the file type of the content passed, it validates for YAML/JSON.

type Renderer

type Renderer struct {
	YAML bool
	JSON bool
	// contains filtered or unexported fields
}

Renderer implements methods to render output in JSON/YAML format.

func GetRenderer

func GetRenderer(writer io.Writer, log *logrus.Logger, yaml, json bool) Renderer

GetRenderer returns the new instance of Renderer.

func (*Renderer) Render

func (r *Renderer) Render(value interface{}) error

Render renders the output based on the output format selection (toYAML, toJSON). If none is selected it prints as the source.

Jump to

Keyboard shortcuts

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