Documentation ¶
Index ¶
- Variables
- func Action(c *cli.Context) error
- type AssignConfig
- type Config
- type CustomAssign
- type Generator
- func (g *Generator) AssignerFunc(field *builder.Field) func(builder.Builder, *builder.Variable, ast.Expr)
- func (g *Generator) Generate(config *Config) error
- func (g *Generator) GetCallFunc(field *builder.Field) parser.Type
- func (g *Generator) GetFieldMapName(field *builder.Field) string
- func (g *Generator) PrepareAssigns(configAssigns []*AssignConfig)
- func (g *Generator) PrepareTask(config *Config)
- func (g *Generator) Run()
Constants ¶
This section is empty.
Variables ¶
View Source
var Description = "make a Receiver.SetXXX function"
View Source
var Flags = []cli.Flag{ cli.StringFlag{ Name: "type,t", Usage: "the `TYPE` to setter input", }, cli.StringFlag{ Name: "receiver,r", Usage: "the `RECEIVER` of the setter", }, cli.StringFlag{ Name: "target", Usage: "the `TARGET` of the setter", }, cli.StringFlag{ Name: "name,n", Usage: "the function `NAME`", Value: "Set", }, cli.BoolFlag{ Name: "withmap,m", Usage: "with a map[string]interface{} return", }, cli.BoolFlag{ Name: "withold,j", Usage: "a map[string]interface{} with old values will return", }, cli.BoolFlag{ Name: "checkdiff,d", Usage: "check if different with origin value", }, cli.StringFlag{ Name: "maptag", Usage: "determin the update/old map's key by tag", }, cli.StringFlag{ Name: "output,o", Usage: "output to `FILE`", }, cli.StringSliceFlag{ Name: "import,i", Usage: "the requried imports", }, cli.StringSliceFlag{ Name: "assign,a", Usage: "the exists covnert functions", }, cli.StringFlag{ Name: "tag,g", Usage: "the tag name", Value: "setter", }, }
View Source
var Usage = "generate setter function"
Functions ¶
Types ¶
type AssignConfig ¶
type CustomAssign ¶
type Generator ¶
type Generator struct { generator.Generator TagName string Type parser.Type Receiver parser.Type FuncType parser.Type Withmap bool WithOldMap bool CheckDiff bool Reverse bool Assigns []*CustomAssign MapTag string // contains filtered or unexported fields }
func NewGenerator ¶
func NewGenerator() *Generator
func (*Generator) AssignerFunc ¶
func (*Generator) GetFieldMapName ¶
func (*Generator) PrepareAssigns ¶
func (g *Generator) PrepareAssigns(configAssigns []*AssignConfig)
func (*Generator) PrepareTask ¶
Click to show internal directories.
Click to hide internal directories.