Documentation ¶
Index ¶
- func Capitalize(s string) string
- 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 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 // 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
Click to show internal directories.
Click to hide internal directories.