Documentation
¶
Overview ¶
Package structdoc provides a means of exposing struct tags for use when generating documentation for those structs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatFields ¶
FormatFields formats the supplied fields as follows:
<prefix><name>:<padding><text>
where padding is calculated so as to line up the text. Prefix sets the number of spaces to be prefixed and indent increases the prefix for each sub field.
Types ¶
type Description ¶
Description represents a structured description of a struct type based on struct tags. The Detail field may be supplied when constructing the description.
func Describe ¶
func Describe(t interface{}, tag, detail string) (*Description, error)
Describe generates a Description for the supplied type based on its struct tags. Detail can be used to provide a top level of detail, such as the type name and a summary.
func (*Description) String ¶
func (d *Description) String() string
String returns a string representation of the description.
type Field ¶
type Field struct { // Name is the name of the original field. The name takes // into account any name specified via a json or yaml tag. Name string // Doc is the text extracted from the struct tag for this field. Doc string // Slice is true if this field is a slice. Slice bool // Fields, if this field is a struct, contains descriptions for // any documented fields in that struct. Fields []Field `json:",omitempty" yaml:",omitempty"` }
Field represents the description of a field and any similarly tagged subfields.