Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrorTargetInterfaceNotFound = errors.New("the target interface is not found in the source tree")
)
Functions ¶
func UniqSortedPackages ¶
func UniqSortedPackages(sts []*StructType) []string
Types ¶
type Generator ¶
type Generator interface {
// Generate source with templateName
Generate(tmplName string) (src []byte, err error)
}
func NewStructTypeGenerator ¶
func NewStructTypeGenerator(ctl app_control.Control, sts []*StructType) Generator
type Scanner ¶
type Scanner interface {
// Find struct which implements the given interface.
// Please pass the type `t` as like reflect.TypeOf((*INTERFACE_PKG.INTERFACE)(nil)).Elem()
FindStructImplements(refType reflect.Type) ([]*StructType, error)
// Find struct which has name starts from prefix.
FindStructHasPrefix(prefix string) ([]*StructType, error)
// Exclude `*_test.go` files.
ExcludeTest() Scanner
// Limit path with prefix
PathFilterPrefix(prefix string) Scanner
}
func NewScanner ¶
func NewScanner(c app_control.Control, path string) (Scanner, error)
type StructType ¶
type StructType struct {
// Relative package path from the scan root.
Package string `json:"package"`
// Name of the struct type.
Name string `json:"name"`
}
func SortedStructTypes ¶
func SortedStructTypes(sts []*StructType) (sorted []*StructType)
Click to show internal directories.
Click to hide internal directories.