Documentation
¶
Index ¶
- Variables
- func AsInt(value interface{}) (int, bool)
- func FilterFields(data map[string]interface{}, fields []string) map[string]interface{}
- func NormalizeDataMap(data map[string]interface{}) map[string]interface{}
- func SetKeyTranslator(fn func(key string) string)
- func SetTranslator(fn func(msgId string) string)
- func ToDataMap(data interface{}) map[string]interface{}
- type Colors
- type FormatType
- type Option
- type Renderer
Constants ¶
This section is empty.
Variables ¶
View Source
var T_ = func(msgId string) string { return msgId }
T_ is the string translation hook, defaults to identity
Functions ¶
func FilterFields ¶
FilterFields keeps only the requested fields, dot notation selects nested ones
func NormalizeDataMap ¶
NormalizeDataMap normalizes all map values to basic JSON types
func SetKeyTranslator ¶
SetKeyTranslator sets the field label translator
func SetTranslator ¶
SetTranslator sets the translation function
Types ¶
type Colors ¶
type Colors struct {
Accent string `yaml:"accent"`
TreeBranch string `yaml:"treeBranch"`
ResultError string `yaml:"resultError"`
}
Colors is the renderer color scheme
type FormatType ¶
type FormatType string
FormatType selects the text layout
const ( FormatTypeTree FormatType = "tree" FormatTypePlain FormatType = "plain" )
Text format types
type Option ¶
type Option func(*Renderer)
Option configures a Renderer
func WithAccentKeys ¶
WithAccentKeys sets keys whose values are highlighted with the accent style
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer renders data maps as styled tree or plain text
func (*Renderer) RenderText ¶
func (r *Renderer) RenderText(dataMap map[string]interface{}, formatType FormatType, isError bool) string
RenderText renders the data map in the given format type
Click to show internal directories.
Click to hide internal directories.