Documentation
¶
Index ¶
- func DefaultVersionedImportAlias(importPath string) string
- func FormatGeneratedContent(filename string, content []byte) ([]byte, error)
- func FormatToolActionComment(name, comment, action, toolKind string) string
- func IsUnaryMethod(method *protogen.Method) bool
- func IsVersionSegment(source string) bool
- func IsVersionedImportPath(importPath string) bool
- func NormalizeCommentText(comments protogen.Comments) string
- func ProtocVersion(gen *protogen.Plugin) string
- func StripRedundantImportAliases(content []byte) ([]byte, error)
- func ToolDescription(service *protogen.Service, method *protogen.Method) string
- func Unexport(source string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultVersionedImportAlias ¶
DefaultVersionedImportAlias 返回版本目录常用的生成包别名,例如 common/v1 -> commonv1。
func FormatGeneratedContent ¶
FormatGeneratedContent 使用 gofmt 规则整理生成代码。
func FormatToolActionComment ¶
FormatToolActionComment 生成 Tool 构造或注册方法注释。
func IsUnaryMethod ¶
IsUnaryMethod 判断当前 RPC 是否为普通一元调用。
func IsVersionSegment ¶
IsVersionSegment 判断路径段是否为 v1/v2 这类 proto 版本目录。
func IsVersionedImportPath ¶
IsVersionedImportPath 判断 import path 最后一段是否为 v1/v2 这类版本目录。
func NormalizeCommentText ¶
NormalizeCommentText 提取 proto 注释文本,并清理多余的注释标记与空白。
func ProtocVersion ¶
ProtocVersion 返回当前 protoc 编译器版本信息。
func StripRedundantImportAliases ¶
StripRedundantImportAliases 去掉冗余 import 别名,并修正版本目录包别名。
func ToolDescription ¶
ToolDescription 生成 Tool 描述,优先使用 RPC 注释,其次使用 service 注释和方法名兜底。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.