Documentation
¶
Index ¶
- Constants
- func NewNamedInLocalPkg(t *types.Named, pkg *types.Package) *types.Named
- func QualifiedFieldPath(n *types.TypeName, f string) string
- func QualifiedTypePath(n *types.TypeName) string
- type Comments
- type EnumTypeTmplInput
- type FieldFilter
- type FieldFilterChain
- type FieldProcessor
- type FieldProcessorChain
- type FieldTmplInput
- type Flattener
- type FlattenerOption
- type IgnoreFieldFilter
- type IgnoreTypeFilter
- type Merger
- type NopFieldFilter
- type NopTypeFilter
- type Printer
- type PrinterOption
- type StructTypeTmplInput
- type Traverser
- type TraverserOption
- type TypeFilter
- type TypeFilterChain
- type TypeProcessor
- type TypeProcessorChain
Constants ¶
View Source
const ( SectionMerged = "merged" SectionTypes = "types" )
View Source
const ( StructTypeTmpl = ` {{ .Comment }} type {{ .Name }} struct { {{ .Fields }} }` FieldTmpl = "\n\n\n{{ .Comment }}\n{{ .Name }} {{ .Type }} `{{ .Tag }}`" EnumTypeTmpl = ` {{ .Comment }} type {{ .Name }} {{ .UnderlyingType }}` )
Variables ¶
This section is empty.
Functions ¶
func QualifiedFieldPath ¶
QualifiedFieldPath returns a fully qualified path for the field of the given type. The format is <package path>.<type name>:<field name>
func QualifiedTypePath ¶
QualifiedTypePath returns a fully qualified path for the type name. The format is <package path>.<type name>
Types ¶
type Comments ¶
Comments holds all comments that will be printed together with objects. We have to have this map separate from the types because go/types package doesn't include comments anywhere in its structs.
func (Comments) AddFieldComment ¶
AddFieldComment lets you add comment for the given field of the type.
type EnumTypeTmplInput ¶
type FieldFilter ¶
type FieldFilterChain ¶
type FieldFilterChain []FieldFilter
type FieldProcessor ¶
type FieldProcessorChain ¶
type FieldProcessorChain []FieldProcessor
type FieldTmplInput ¶
type Flattener ¶
type Flattener struct { Imports *packages.Imports // RemotePkgPath is the path of the package of the remote type we're pulling // the types from. RemotePkgPath string LocalPkg *types.Package TypeFilter TypeFilter FieldFilter FieldFilter }
func NewFlattener ¶
func NewFlattener(im *packages.Imports, opts ...FlattenerOption) *Flattener
type FlattenerOption ¶
type FlattenerOption func(*Flattener)
func WithFieldFilters ¶
func WithFieldFilters(ff ...FieldFilter) FlattenerOption
func WithLocalPkg ¶
func WithLocalPkg(pkg *types.Package) FlattenerOption
func WithRemotePkgPath ¶
func WithRemotePkgPath(path string) FlattenerOption
func WithTypeFilters ¶
func WithTypeFilters(tf ...TypeFilter) FlattenerOption
type IgnoreFieldFilter ¶
type IgnoreFieldFilter struct {
// contains filtered or unexported fields
}
func NewIgnoreFieldFilter ¶
func NewIgnoreFieldFilter(list []string) *IgnoreFieldFilter
type IgnoreTypeFilter ¶
type IgnoreTypeFilter struct {
// contains filtered or unexported fields
}
func NewIgnoreTypeFilter ¶
func NewIgnoreTypeFilter(list []string) *IgnoreTypeFilter
type NopFieldFilter ¶
type NopFieldFilter struct{}
type NopTypeFilter ¶
type NopTypeFilter struct{}
type Printer ¶
func NewPrinter ¶
type PrinterOption ¶
type PrinterOption func(*Printer)
func WithComments ¶
func WithComments(c Comments) PrinterOption
type StructTypeTmplInput ¶
type Traverser ¶
type Traverser struct { TypeProcessors TypeProcessor FieldProcessors FieldProcessor // contains filtered or unexported fields }
func NewTraverser ¶
func NewTraverser(cache *packages.Cache, opts ...TraverserOption) *Traverser
type TraverserOption ¶
type TraverserOption func(*Traverser)
func WithFieldProcessor ¶
func WithFieldProcessor(fp FieldProcessor) TraverserOption
func WithTypeProcessor ¶
func WithTypeProcessor(tp TypeProcessor) TraverserOption
type TypeFilterChain ¶
type TypeFilterChain []TypeFilter
type TypeProcessorChain ¶
type TypeProcessorChain []TypeProcessor
Click to show internal directories.
Click to hide internal directories.