Documentation ¶
Index ¶
- Variables
- func BuilderFuncName(fieldName, prefix, postfix string) string
- func ExecuteAny(value any, args ...Option) string
- func ExecuteString(typeName string, packagePath string, args ...Option) string
- func ExecuteType(typ reflect.Type, args ...Option) string
- func Files(pkg *packages.Package) files
- func OptionTypeName(applyeeName string) string
- func OptionVarName(fieldName, prefix, postfix string) string
- type Field
- type Gen
- func (g Gen) FieldNameByIndex() string
- func (g Gen) FieldTypeByIndex() string
- func (g Gen) ParamNameByIndex() string
- func (g Gen) ParamTypeByIndex() string
- func (g Gen) ReceiverName() string
- func (g Gen) Render(tmpl string) string
- func (g Gen) RenderApplyFunc() string
- func (g Gen) RenderChainFunc() string
- func (g Gen) RenderOptionType() string
- func (g Gen) RenderOptionVariable() string
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var WithAutoImports = func(autoImports bool) func(o *option) {
return func(o *option) {
o.autoImports = autoImports
}
}
View Source
var WithBuilderMode = func(builderMode bool) func(o *option) {
return func(o *option) {
o.builderMode = builderMode
}
}
View Source
var WithPostfix = func(postfix string) func(o *option) {
return func(o *option) {
o.postfix = postfix
}
}
View Source
var WithPrefix = func(prefix string) func(o *option) {
return func(o *option) {
o.prefix = prefix
}
}
View Source
var WithWriteFile = func(writeFile string) func(o *option) {
return func(o *option) {
o.writeFile = writeFile
}
}
Functions ¶
func BuilderFuncName ¶ added in v1.4.0
BuilderFuncName give the input variable a proper name
func ExecuteAny ¶
func Files ¶ added in v1.1.1
TODO: currently, the implementation doesn't understand package alias implement this function in future need
func OptionTypeName ¶
OptionTypeName give the option type a proper name replace xxxOptions --> XXXOption replace xxxConfig --> XXXOption replace xxxConfigs --> XXXOption
func OptionVarName ¶
OptionVarName give the option variable a proper name
Types ¶
type Gen ¶
type Gen struct { TypeName string Fields []Field Index int WithPrefix string WithPostfix string PackageName string }
Gen is a wide type which will be rendered with a bunch of templates
func LoadDefinition ¶
func (Gen) FieldNameByIndex ¶
func (Gen) FieldTypeByIndex ¶
func (Gen) ParamNameByIndex ¶ added in v1.0.2
func (Gen) ParamTypeByIndex ¶ added in v1.2.0
func (Gen) ReceiverName ¶ added in v1.4.0
func (Gen) RenderApplyFunc ¶
func (Gen) RenderChainFunc ¶ added in v1.4.0
func (Gen) RenderOptionType ¶
func (Gen) RenderOptionVariable ¶
Click to show internal directories.
Click to hide internal directories.