✨ Init
This commit is contained in:
29
resource/plug_template/main.go.tpl
Normal file
29
resource/plug_template/main.go.tpl
Normal file
@@ -0,0 +1,29 @@
|
||||
package {{ .Snake}}
|
||||
|
||||
import (
|
||||
{{- if .HasGlobal }}
|
||||
"miniapp/plugin/{{ .Snake}}/global"
|
||||
{{- end }}
|
||||
"miniapp/plugin/{{ .Snake}}/router"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type {{ .PlugName}}Plugin struct {
|
||||
}
|
||||
|
||||
func Create{{ .PlugName}}Plug({{- range .Global}} {{.Key}} {{.Type}}, {{- end }})*{{ .PlugName}}Plugin {
|
||||
{{- if .HasGlobal }}
|
||||
{{- range .Global}}
|
||||
global.GlobalConfig.{{.Key}} = {{.Key}}
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
return &{{ .PlugName}}Plugin{}
|
||||
}
|
||||
|
||||
func (*{{ .PlugName}}Plugin) Register(group *gin.RouterGroup) {
|
||||
router.RouterGroupApp.Init{{ .PlugName}}Router(group)
|
||||
}
|
||||
|
||||
func (*{{ .PlugName}}Plugin) RouterPath() string {
|
||||
return "{{ .RouterGroup}}"
|
||||
}
|
Reference in New Issue
Block a user