Code optimized (#523)
* optimized markdown generator * optimized markdown generator * optimized markdown generator * add more comment * add comment * add comment * add comments for rpc tool * add comments for model tool * add comments for model tool * add comments for model tool * add comments for config tool * add comments for config tool * add comments * add comments * add comments * add comments * add comment * remove rpc main head info * add comment * optimized Co-authored-by: anqiansong <anqiansong@xiaoheiban.cn>
This commit is contained in:
@@ -33,6 +33,7 @@ type (
|
||||
cfg *config.Config
|
||||
}
|
||||
|
||||
// Option defines a function with argument defaultGenerator
|
||||
Option func(generator *defaultGenerator)
|
||||
|
||||
code struct {
|
||||
@@ -48,6 +49,7 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
// NewDefaultGenerator creates an instance for defaultGenerator
|
||||
func NewDefaultGenerator(dir string, cfg *config.Config, opt ...Option) (*defaultGenerator, error) {
|
||||
if dir == "" {
|
||||
dir = pwd
|
||||
@@ -75,6 +77,7 @@ func NewDefaultGenerator(dir string, cfg *config.Config, opt ...Option) (*defaul
|
||||
return generator, nil
|
||||
}
|
||||
|
||||
// WithConsoleOption creates a console option
|
||||
func WithConsoleOption(c console.Console) Option {
|
||||
return func(generator *defaultGenerator) {
|
||||
generator.Console = c
|
||||
@@ -189,6 +192,7 @@ func (g *defaultGenerator) genFromDDL(source string, withCache bool) (map[string
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Table defines mysql table
|
||||
type Table struct {
|
||||
parser.Table
|
||||
CacheKey map[string]Key
|
||||
|
||||
Reference in New Issue
Block a user