parsecomments

package
v1.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MapType = "map"
View Source
const MapTypeStringString = "map[string]string"

Variables

This section is empty.

Functions

func GetPkgStructName

func GetPkgStructName(pkgPath, structName string) string

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.

func (*ParseComments) Visit

func (s *ParseComments) Visit(node ast.Node) ast.Visitor

type Struct

type Struct struct {
	Pkg      string
	Name     string
	Fields   []*Field `yaml:",omitempty"`
	Embedded []string `yaml:",omitempty"` // pkgStruct names
	// contains filtered or unexported fields
}

func NewStruct

func NewStruct() *Struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL