field

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatByDefault

func FormatByDefault(v interface{}) string

Default field formatting function

Types

type Field

type Field struct {
	// contains filtered or unexported fields
}

Struct to represent a field in table output

func NewHidden

func NewHidden(name string, jsonPropertyName string) *Field

Create new hidden Field struct

func NewHiddenWithToStringFunc

func NewHiddenWithToStringFunc(name string, jsonPropertyName string, toString ToStringFunc) *Field

Create new hidden Field struct with To String function

func NewVisible

func NewVisible(name string, jsonPropertyName string) *Field

Create new visible Field struct

func NewVisibleWithToStringFunc

func NewVisibleWithToStringFunc(name string, jsonPropertyName string, toString ToStringFunc) *Field

Create new visible Field struct with To String function

func (*Field) Format

func (f *Field) Format(value interface{}) interface{}

Format field value

func (*Field) Hide

func (f *Field) Hide()

Don't show field in table output

func (*Field) IsVisible

func (f *Field) IsVisible() bool

Whether the field is visible

func (*Field) JsonPropertyName

func (f *Field) JsonPropertyName() string

Get field's JSON property name

func (*Field) Name

func (f *Field) Name() string

Get field's name

func (*Field) NameMatches

func (f *Field) NameMatches(name string) bool

Whether the field's name matches the given string (case-insensitive)

func (*Field) SetJsonPropertyName

func (f *Field) SetJsonPropertyName(newJsonPropertyName string)

Modifiy a field's JSON property name

func (*Field) Show

func (f *Field) Show()

Show field in table output

type ToStringFunc

type ToStringFunc func(v interface{}) string

Jump to

Keyboard shortcuts

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