Documentation
¶
Index ¶
- type DocTypesMode
- type Interface
- type Jsonc
- func (j *Jsonc) RenderArray(field *distiller.FieldInfo, value []interface{}, indent string) (string, error)
- func (j *Jsonc) RenderElement(itemType types.Type, item interface{}, indent string) (string, error)
- func (j *Jsonc) RenderMap(field *distiller.FieldInfo, value *ordered.Map, indent string) (string, error)
- func (j *Jsonc) RenderStruct(info *distiller.StructInfo, defaults interface{}, indent string, embedded bool, ...) (string, error)
- type Toml
- func (t *Toml) RenderArray(field *distiller.FieldInfo, value []interface{}, indent string) (string, error)
- func (t *Toml) RenderElement(itemType types.Type, item interface{}, indent string) (string, error)
- func (t *Toml) RenderMap(field *distiller.FieldInfo, value *ordered.Map, indent string) (string, error)
- func (t *Toml) RenderStruct(info *distiller.StructInfo, defaults interface{}, indent string, embedded bool, ...) (string, error)
- type Yaml
- func (y *Yaml) RenderArray(field *distiller.FieldInfo, value []interface{}, indent string) (string, error)
- func (y *Yaml) RenderElement(itemType types.Type, item interface{}, indent string) (string, error)
- func (y *Yaml) RenderMap(field *distiller.FieldInfo, value *ordered.Map, indent string) (string, error)
- func (y *Yaml) RenderStruct(info *distiller.StructInfo, defaults interface{}, indent string, embedded bool, ...) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DocTypesMode ¶
type DocTypesMode int
DocTypesMode defines rendering modes for field types in JSONC comments.
const ( NoFields DocTypesMode = iota // Don't show type on all fields (default). AllFields // Show types for all fields. BasicFields // Show types for basic fields only (int, float, bool, string). )
type Interface ¶
type Interface interface {
// RenderStruct renders indented code for specified struct and all nested or embedded ones recursively.
RenderStruct(info *distiller.StructInfo, defaults interface{}, indent string,
embedded bool, parentShadowing []string) (string, error)
// RenderArray renders slice or array fields.
RenderArray(field *distiller.FieldInfo, value []interface{}, indent string) (string, error)
// RenderMap renders map fields.
RenderMap(field *distiller.FieldInfo, value *ordered.Map, indent string) (string, error)
// RenderElement renders an element value of a slice, array or map.
RenderElement(itemType types.Type, item interface{}, indent string) (string, error)
}
Interface defines a renderer interface.
type Jsonc ¶
type Jsonc struct {
// contains filtered or unexported fields
}
Jsonc renders JSONC code from distiller info.
func NewJsonc ¶
func NewJsonc(mode DocTypesMode) *Jsonc
NewJsonc creates a new JSONC renderer. mode controls the rendering of field types in JSONC comments.
func (*Jsonc) RenderArray ¶
func (*Jsonc) RenderElement ¶
func (*Jsonc) RenderStruct ¶
type Toml ¶
type Toml struct {
// contains filtered or unexported fields
}
Toml renders Toml code from distiller info.
func NewToml ¶
func NewToml(mode DocTypesMode, indented bool) *Toml
NewToml creates a new Toml renderer. mode controls the rendering of field types in Toml comments.
func (*Toml) RenderArray ¶
func (*Toml) RenderElement ¶
func (*Toml) RenderStruct ¶
type Yaml ¶ added in v1.0.7
type Yaml struct {
// contains filtered or unexported fields
}
Yaml renders Yaml code from distiller info.
func NewYaml ¶ added in v1.0.7
func NewYaml(mode DocTypesMode, indentSize int) *Yaml
NewYaml creates a new Yaml renderer. mode controls the rendering of field types in Yaml comments.
func (*Yaml) RenderArray ¶ added in v1.0.7
func (*Yaml) RenderElement ¶ added in v1.0.7
func (*Yaml) RenderStruct ¶ added in v1.0.7
Click to show internal directories.
Click to hide internal directories.