 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func Capitalize(s string) string
- func GetStructFieldsIndex(v reflect.Type) [][]int
- func Marshal(data interface{}, opt *MarshalOpt) (string, error)
- func RegisterMarshalerFunc(i interface{}, f MarshalerFunc)
- type EnumMarshalSpec
- type EnumMarshalSpecs
- type MarshalFieldOpt
- type MarshalOpt
- type MarshalSection
- type Marshaler
- type MarshalerFunc
- type UnknownFieldError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capitalize ¶
Capitalize returns the given string with a first character in uppercase.
func GetStructFieldsIndex ¶ added in v2.28.0
GetStructFieldsIndex will return a list of fieldIndex ([]int) sorted by their position in the Go struct. This function will handle anonymous field and make sure that if a field is overwritten only the highest is returned. You can use reflect GetFieldByIndex([]int) to get the correct field.
func Marshal ¶
func Marshal(data interface{}, opt *MarshalOpt) (string, error)
    func RegisterMarshalerFunc ¶
func RegisterMarshalerFunc(i interface{}, f MarshalerFunc)
    TODO: implement the same logic as args.RegisterMarshalFunc(), where i must be a pointer RegisterMarshalerFunc bind the given type of i with the given MarshalerFunc
Types ¶
type EnumMarshalSpec ¶
type EnumMarshalSpec struct {
	// Attribute (mainly colors) to use.
	Attribute color.Attribute
	// Value is the value that will be printed for the given value.
	Value string
}
    EnumMarshalSpec contains specs used by EnumMarshalFunc.
type EnumMarshalSpecs ¶
type EnumMarshalSpecs map[interface{}]*EnumMarshalSpec
    type MarshalFieldOpt ¶
type MarshalOpt ¶
type MarshalOpt struct {
	Title      string
	Fields     []*MarshalFieldOpt
	Sections   []*MarshalSection
	SubOptions map[string]*MarshalOpt
	// Is set to true if we are marshaling a table cell
	TableCell bool
	// DisableShrinking will disable columns shrinking based on terminal size
	DisableShrinking bool
}
    MarshalOpt is hydrated by core.View
type MarshalSection ¶
MarshalSection describes a section to build from a given struct. When marshalling, this section is shown under the main struct section.
type MarshalerFunc ¶
type MarshalerFunc func(interface{}, *MarshalOpt) (string, error)
    func EnumMarshalFunc ¶
func EnumMarshalFunc(specs EnumMarshalSpecs) MarshalerFunc
EnumMarshalFunc returns a marshal func to marshal an enum.
type UnknownFieldError ¶
func (*UnknownFieldError) Error ¶
func (u *UnknownFieldError) Error() string