Documentation ¶
Index ¶
- Constants
- func FiledPathAndAccessCheckCondition(receiverVar string, isReceiverReference, redeclareReceiver bool, ...) (string, string, []string)
- func FuncBodyNoArg(name string, returnType string, nolint bool, content string) string
- func FuncBodyWithArgs(name string, args []string, returnType string, nolint bool, content string) string
- func FuncDeclName(funcDecl *ast.FuncDecl) string
- func GenerateGetter(model *struc.Model, ...) string
- func GenerateSetter(model *struc.Model, ...) string
- func GetFieldConstName(typeName string, fieldName struc.FieldName, export, snake bool) string
- func GetFieldRef(fields ...struc.FieldName) struc.FieldName
- func GetFieldType(typeName string, export, snake bool) string
- func GetTypeName(typeName string, pkg string) string
- func IdentName(name string, export bool) string
- func IsExported(name string) bool
- func LegalIdentName(name string) string
- func MethodBody(name string, isFunc bool, ...) string
- func MethodName(typ, fun string) string
- func NoLint(nolint bool) string
- func OutPackageName(outPackageName string, outPackage *packages.Package) string
- func PathToShortVarName(fieldPath string) string
- func PathToVarName(fieldPath string) string
- func Quoted(value string) string
- func TypeParamsDeclarationString(list *types.TypeParamList, basePkgPath string) string
- func TypeParamsString(tparams *types.TypeParamList, basePkgPath string) string
- func TypeReceiverVar(typeName string) string
- type CodeRewriter
- type FieldConst
- type FieldInfo
- type Generator
- func (g *Generator) AddFuncDecl(node *ast.FuncDecl) error
- func (g *Generator) AddFuncOrMethod(name, body string) error
- func (g *Generator) AddImport(pack, name, alias string) (string, error)
- func (g *Generator) AddMethod(typ, name, body string) error
- func (g *Generator) AddStruct(s Structure) error
- func (g *Generator) AddType(typeName string, typeValue string) error
- func (g *Generator) FormatSrc() ([]byte, error)
- func (g *Generator) GenerateAsMapFunc(model *struc.Model, name, keyType string, constants []FieldConst, ...) (string, string, string, error)
- func (g *Generator) GenerateEnumFromName(typ *types.Named, constNames c.Collection[[]string], name string, export bool, ...) (string, string, error)
- func (g *Generator) GenerateEnumFromValue(typ *types.Named, constValNamesMap ordered.Map[goconstant.Value, []string], ...) (string, string, error)
- func (g *Generator) GenerateEnumName(typ *types.Named, constValNamesMap ordered.Map[goconstant.Value, []string], ...) (string, string, error)
- func (g *Generator) GenerateEnumValues(typ *types.Named, constValNamesMap collection.Map[goconstant.Value, []string], ...) (string, string, error)
- func (g *Generator) GenerateFieldConstant(model *struc.Model, ...) error
- func (g *Generator) GenerateFieldConstants(model *struc.Model, typ string, export, snake, allFields bool, ...) ([]FieldConst, error)
- func (g *Generator) GetFullFieldTypeName(fieldType struc.FieldType, baseType bool) (string, error)
- func (g *Generator) GetPackageNameOrAlias(pkgName, pkgPath string) (string, error)
- func (g *Generator) ImportPack(pkg *types.Package, basePackagePath string) (*types.Package, error)
- func (g *Generator) Repack(typ types.Type, basePackagePath string) (types.Type, error)
- func (g *Generator) RepackObj(typName *types.TypeName, basePackagePath string) (*types.TypeName, error)
- func (g *Generator) RepackTuple(vr *types.Tuple, basePackagePath string) (*types.Tuple, error)
- func (g *Generator) RepackVar(vr *types.Var, basePackagePath string) (*types.Var, error)
- func (g *Generator) Src() ([]byte, error)
- func (g *Generator) WriteBody(outPackageName string) error
- type RewriteEngine
- type RewriteTrigger
- type Structure
Constants ¶
View Source
const Autoname = "."
View Source
const BaseConstType = "string"
View Source
const DefaultMethodSuffixAll = "All"
View Source
const DefaultMethodSuffixByName = "ByName"
View Source
const DefaultMethodSuffixByValue = "ByValue"
Variables ¶
This section is empty.
Functions ¶
func FuncBodyNoArg ¶ added in v0.0.5
func FuncBodyWithArgs ¶ added in v0.0.5
func FuncDeclName ¶
func GenerateGetter ¶ added in v0.0.2
func GenerateSetter ¶ added in v0.0.2
func GetFieldConstName ¶
func GetFieldType ¶
func GetTypeName ¶
func IsExported ¶ added in v0.0.2
func LegalIdentName ¶
func MethodBody ¶ added in v0.0.5
func MethodName ¶
func OutPackageName ¶
func PathToShortVarName ¶
func PathToVarName ¶
func TypeParamsDeclarationString ¶
func TypeParamsDeclarationString(list *types.TypeParamList, basePkgPath string) string
func TypeParamsString ¶
func TypeParamsString(tparams *types.TypeParamList, basePkgPath string) string
func TypeReceiverVar ¶ added in v0.0.2
Types ¶
type CodeRewriter ¶
type CodeRewriter struct {
// contains filtered or unexported fields
}
func NewCodeRewriter ¶
func NewCodeRewriter(fieldValueRewriters []string) (*CodeRewriter, error)
type FieldConst ¶ added in v0.0.2
type FieldConst struct {
// contains filtered or unexported fields
}
func (FieldConst) Name ¶ added in v0.0.2
func (constant FieldConst) Name() string
type Generator ¶
type Generator struct { OutPkgPath string OutPkgTypes *types.Package // contains filtered or unexported fields }
func (*Generator) AddFuncOrMethod ¶
func (*Generator) GenerateAsMapFunc ¶
func (*Generator) GenerateEnumFromName ¶ added in v0.0.5
func (*Generator) GenerateEnumFromValue ¶ added in v0.0.5
func (*Generator) GenerateEnumName ¶ added in v0.0.5
func (*Generator) GenerateEnumValues ¶ added in v0.0.5
func (*Generator) GenerateFieldConstant ¶
func (*Generator) GenerateFieldConstants ¶
func (*Generator) GetFullFieldTypeName ¶ added in v0.0.2
func (*Generator) GetPackageNameOrAlias ¶ added in v0.0.5
func (*Generator) ImportPack ¶
func (*Generator) RepackTuple ¶
type RewriteTrigger ¶
type RewriteTrigger string
const ( RewriteTriggerEmpty RewriteTrigger = "" RewriteTriggerField RewriteTrigger = "field" RewriteTriggerType RewriteTrigger = "type" )
Click to show internal directories.
Click to hide internal directories.