Documentation
¶
Overview ¶
codegen defines general utilities for codegen.
Index ¶
- Constants
- func BufPrintf(w io.Writer) (func(format string, args ...any), func() error)
- func EnumerateCommentGroup(comments *ast.CommentGroup) iter.Seq[string]
- func ExcludeIgnoredGenDecl(genDecl *ast.GenDecl) (bool, error)
- func ExcludeIgnoredTypeSpec(ts *ast.TypeSpec, _ types.Object) (bool, error)
- func FieldAst(st *ast.StructType) iter.Seq[FieldDescAst]
- func FieldDst(st *dst.StructType) iter.Seq[FieldDescDst]
- func ParseFieldDirectiveCommentDst[T any](prefix string, comments dst.FieldDecorations, ...) (T, bool, error)
- func PrintAstExprPanicking(expr ast.Expr) string
- func PrintFileHeader(w io.Writer, af *ast.File, fset *token.FileSet) error
- func PrintTypeParamsAst(ts *ast.TypeSpec) string
- func PrintTypeParamsDst(ts *dst.TypeSpec) string
- func TrimPackageComment(f *dst.File)
- func TypeToAst(ty types.Type, pkgPath string, importMap imports.ImportMap) ast.Expr
- func TypeToDst(ty types.Type, pkgPath string, importMap imports.ImportMap) dst.Expr
- type Direction
- type FieldDescAst
- type FieldDescDst
- type Parser
Constants ¶
View Source
const ( DirectiveCommentIgnore = "ignore" DirectiveCommentGenerated = "generated" )
View Source
const (
DirectivePrefix = "codegen:"
)
Variables ¶
This section is empty.
Functions ¶
func EnumerateCommentGroup ¶
func EnumerateCommentGroup(comments *ast.CommentGroup) iter.Seq[string]
func ExcludeIgnoredTypeSpec ¶
func FieldAst ¶
func FieldAst(st *ast.StructType) iter.Seq[FieldDescAst]
func FieldDst ¶
func FieldDst(st *dst.StructType) iter.Seq[FieldDescDst]
func PrintAstExprPanicking ¶
func PrintTypeParamsAst ¶
func PrintTypeParamsDst ¶
func TrimPackageComment ¶
Types ¶
type Direction ¶
type Direction struct {
// contains filtered or unexported fields
}
func ParseDirectiveComment ¶
func ParseDirectiveComment(comments *ast.CommentGroup) (Direction, bool, error)
func (Direction) MustIgnore ¶
Click to show internal directories.
Click to hide internal directories.