Documentation
¶
Overview ¶
Package docgen provides tools for extracting and storing documentation from Go source code.
Index ¶
- func GenerateGoFile(pkgName string, content []byte) []byte
- func GenerateYAML(sourceFiles []string, auxTypes []*TypeDoc, methods []*FunctionDoc) ([]byte, error)
- type Extractor
- type FieldArrayDoc
- type FieldDoc
- type FieldMapDoc
- type FunctionDoc
- type FunctionParamDoc
- type TypeDoc
- type YAMLDoc
- type YAMLField
- type YAMLFieldArray
- type YAMLFieldMap
- type YAMLMethod
- type YAMLMethodParam
- type YAMLType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateGoFile ¶
func GenerateYAML ¶
func GenerateYAML(sourceFiles []string, auxTypes []*TypeDoc, methods []*FunctionDoc) ([]byte, error)
GenerateYAML generates YAML documentation from service documentation.
Types ¶
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
Extractor extracts documentation from Go source code.
func NewExtractor ¶
NewExtractor creates a new documentation extractor.
func (*Extractor) ExtractFunction ¶
type FieldArrayDoc ¶
type FieldArrayDoc struct {
Type string
}
type FieldDoc ¶
type FieldDoc struct {
Name string
Type string // Full type name
Comment string
Tags string
FilePath string
Line int
Nullable bool
IsEmbedded bool
IsMap *FieldMapDoc
IsArray *FieldArrayDoc
}
FieldDoc represents documentation for a struct field.
type FieldMapDoc ¶
type FunctionDoc ¶
type FunctionDoc struct {
Package string
Name string
Comment string
File string
Line int
Params []FunctionParamDoc
Returns []FunctionParamDoc
}
FunctionDoc is some function's documentation.
type FunctionParamDoc ¶
type TypeDoc ¶
type TypeDoc struct {
Name string
Package string
File string
Line int
Comment string
Fields []FieldDoc
Methods []FunctionDoc
IsStruct bool
}
TypeDoc represents documentation for a type.
type YAMLDoc ¶
type YAMLDoc struct {
Checksum string `yaml:"checksum"`
Types map[string]YAMLType `yaml:"types"`
Functions map[string]YAMLMethod `yaml:"functions"`
}
YAMLDoc represents the YAML documentation format.
type YAMLField ¶
type YAMLField struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Comment string `yaml:"comment,omitempty"`
Tags string `yaml:"tags,omitempty"`
Nullable bool `yaml:"nullable,omitempty"`
IsMap *YAMLFieldMap `yaml:"is_map,omitempty"`
IsArray *YAMLFieldArray `yaml:"is_array,omitempty"`
IsEmbedded bool `yaml:"is_embedded,omitempty"`
}
YAMLField represents a field in YAML format.
type YAMLFieldArray ¶
type YAMLFieldArray struct {
Type string `yaml:"type"`
}
type YAMLFieldMap ¶
type YAMLMethod ¶
type YAMLMethod struct {
Comment string `yaml:"comment,omitempty"`
File string `yaml:"file"`
Line int `yaml:"line"`
Inputs []YAMLMethodParam `yaml:"inputs"`
Outputs []YAMLMethodParam `yaml:"outputs"`
}
Method represents a service method in YAML format.
type YAMLMethodParam ¶
type YAMLType ¶
type YAMLType struct {
ID string `yaml:"id"`
PkgPath string `yaml:"package"`
Name string `yaml:"name"`
File string `yaml:"file"`
Line int `yaml:"line"`
Comment string `yaml:"comment,omitempty"`
Fields []YAMLField `yaml:"fields,omitempty"`
Methods map[string]YAMLMethod `yaml:"methods,omitempty"`
IsStruct bool `yaml:"is_struct"`
}
YAMLType represents a type in YAML format.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package docregistry provides a registry for documentation entities extracted from the comments.
|
Package docregistry provides a registry for documentation entities extracted from the comments. |
Click to show internal directories.
Click to hide internal directories.