Documentation ¶
Index ¶
- Constants
- func GetPkgStructName(pkgPath, structName string) string
- type Field
- type ParseComments
- func (s *ParseComments) FindField(pkgPath, structName, fieldName string) (*Field, bool)
- func (s *ParseComments) FindStruct(pkgStruct string) (*Struct, bool)
- func (s *ParseComments) ParseFile(fileName string) error
- func (s *ParseComments) ParseFiles(paths ...string) error
- func (s *ParseComments) Visit(node ast.Node) ast.Visitor
- type Struct
Constants ¶
View Source
const MapType = "map"
View Source
const MapTypeStringString = "map[string]string"
Variables ¶
This section is empty.
Functions ¶
func GetPkgStructName ¶
Types ¶
type Field ¶
type Field struct { Name string TypePkg string `yaml:",omitempty"` // blank for builtin types TypeName string `yaml:",omitempty"` MapType string `yaml:",omitempty"` Comment string `yaml:",omitempty"` PointerType bool `yaml:",omitempty"` ArrayedInParent bool `yaml:",omitempty"` Hidden bool `yaml:",omitempty"` ReadOnly bool `yaml:",omitempty"` Required bool `yaml:",omitempty"` }
type ParseComments ¶
type ParseComments struct { Structs []*Struct `yaml:",omitempty"` Embedded []string `yaml:",omitempty"` // pkgStruct names of embedded objects // contains filtered or unexported fields }
func NewParseComments ¶
func NewParseComments() *ParseComments
func (*ParseComments) FindField ¶
func (s *ParseComments) FindField(pkgPath, structName, fieldName string) (*Field, bool)
Lookup field comments based on package path, go struct name, and go field name. For example, lookup("github.com/company/repo/pkg/path", "MyObject", "MyField")
func (*ParseComments) FindStruct ¶
func (s *ParseComments) FindStruct(pkgStruct string) (*Struct, bool)
func (*ParseComments) ParseFile ¶
func (s *ParseComments) ParseFile(fileName string) error
func (*ParseComments) ParseFiles ¶
func (s *ParseComments) ParseFiles(paths ...string) error
Parse files and directories. Passed in paths may be files or directories. Directory scanning is not recursive.
Click to show internal directories.
Click to hide internal directories.