Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCode ¶
func GenerateCode(iface InterfaceInfo, outputDir string) error
GenerateCode generates implementation code for an interface
func ProcessInterface ¶
func ProcessInterface(iface InterfaceInfo, outputDir string) error
ProcessInterface handles processing of an interface for code generation
Types ¶
type InterfaceInfo ¶
type InterfaceInfo struct {
Name string // 接口名称
PackageName string // 包名
Depends []string // 依赖的包
Methods []MethodInfo // 接口方法
FilePath string // 文件路径
Comment string // 注释
}
表示解析到的接口信息
func ParseFile ¶
func ParseFile(filePath string) ([]InterfaceInfo, error)
ParseFile 解析单个Go文件,查找带有特定注释的接口定义
type MethodInfo ¶
type MethodInfo struct {
Name string // 方法名称
Params []ParamInfo // 参数信息
Results []ParamInfo // 返回值信息
Comment []string // 方法注释
}
表示接口方法信息
type StructInfo ¶
创建一个用于生成代码的结构体信息
func FindStructInfo ¶
func FindStructInfo(filePath string, structName string) (*StructInfo, error)
查找并解析结构体信息
Click to show internal directories.
Click to hide internal directories.