Documentation ¶
Index ¶
Constants ¶
const ( // HeadComment populates `yaml.Node` `HeadComment`. HeadComment = iota // LineComment populates `yaml.Node` `LineComment`. LineComment // FootComment populates `yaml.Node` `FootComment`. FootComment )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Appearance ¶
Appearance of a type in a different type.
type CommentsFlags ¶
type CommentsFlags int
CommentsFlags comments encoding flags type.
const ( // CommentsDisabled renders no comments. CommentsDisabled CommentsFlags = 0 // CommentsExamples enables commented yaml examples rendering. CommentsExamples CommentsFlags = 1 << iota // CommentsDocs enables rendering each config field short docstring. CommentsDocs // CommentsAll renders all comments. CommentsAll = CommentsExamples | CommentsDocs )
type Doc ¶
type Doc struct { // Comments stores foot, line and head comments. Comments [3]string // Fields contains fields documentation if related item is a struct. Fields []Doc // Examples list of example values for the item. Examples []*Example // Values is only used to render valid values list in the documentation. Values []string // Description represents the full description for the item. Description string // Name represents struct name or field name. Name string // Type represents struct name or field type. Type string // Note is rendered as a note for the example in markdown file. Note string // AppearsIn describes back references for the type. AppearsIn []Appearance }
Doc represents a struct documentation rendered from comments by docgen.
func (*Doc) AddExample ¶
AddExample adds a new example snippet to the doc.
type Documented ¶
type Documented interface { // Doc requests documentation object. Doc() *Doc }
Documented is used to check if struct has any documentation defined for it.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder implements config encoder.
func NewEncoder ¶
NewEncoder initializes and returns an `Encoder`.
type Example ¶
type Example struct { Name string // contains filtered or unexported fields }
Example represents one example snippet for a type.
type FileDoc ¶
type FileDoc struct { // Name will be used in md file name pattern. Name string // Description file description, supports markdown. Description string // Structs structs defined in the file. Structs []*Doc // Types is map of all non-trivial types defined in the file. Types map[string]*Doc }
FileDoc represents a single go file documentation.
type Option ¶
type Option func(*Options)
Option gives ability to alter config encoder output settings.
func WithComments ¶
func WithComments(flags CommentsFlags) Option
WithComments enables comments and examples in the encoder.
func WithOmitEmpty ¶
WithOmitEmpty toggles omitempty handling.
type Options ¶
type Options struct { Comments CommentsFlags OmitEmpty bool }
Options defines encoder config.