-
Notifications
You must be signed in to change notification settings - Fork 127
generic.Type support function definition ? #80
Description
i want to define function with generic.Type define. for example:
define template_demo.go :
- type ModelType generic.Type
func registerModelType() {
MngCreater = append(MngCreater, ModelType(GlobalmgDb))
}
- then run genny command:
input_file="./template_res_register.go"
out_file="res_register_1.go" ##
real_type="RegisterSignDailyFortuneMg,RegisterSecretChitchatWork" ###RegisterSecretChitchatWork
pkg_name="common_res"
genny -in ${input_file} -out ${out_file} -pkg ${pkg_name} gen "ModelType=${real_type}"
- then generated codes:
func registerRegisterSecretChitchatWork() {
MngCreater = append(MngCreater, RegisterSecretChitchatWork(GlobalmgDb))
}
- when i build project, error happen . show defined template file err:
cannot use ModelType(GlobalmgDb) (value of type ModelType) as data_cache.CreateRes value in argument to append: ModelType does not implement data_cache.CreateRes (missing method Create)