Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions tpl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ func MainTemplate() []byte {
package main

import (
"github.com/tinh-tinh/tinhtinh/core"
"github.com/tinh-tinh/tinhtinh/v2/core"
"{{ .PkgName}}/app"
)

Expand All @@ -22,13 +22,13 @@ func AppTemplate() []byte {
package app

import (
"github.com/tinh-tinh/tinhtinh/core"
"github.com/tinh-tinh/tinhtinh/v2/core"
)

func NewModule() *core.DynamicModule {
func NewModule() core.Module {
appModule := core.NewModule(core.NewModuleOptions{
Controllers: []core.Controller{NewController},
Providers: []core.Provider{NewService},
Controllers: []core.Controllers{NewController},
Providers: []core.Providers{NewService},
})

return appModule
Expand All @@ -40,12 +40,12 @@ func ModuleTemplate() []byte {
return []byte(`
package {{ .ModName }}

import "github.com/tinh-tinh/tinhtinh/core"
import "github.com/tinh-tinh/tinhtinh/v2/core"

func NewModule(module *core.DynamicModule) *core.DynamicModule {
func NewModule(module core.Module) core.Module {
{{ .ModName }}Module := module.New(core.NewModuleOptions{
Controllers: []core.Controller{NewController},
Providers: []core.Provider{NewService},
Controllers: []core.Controllers{NewController},
Providers: []core.Providers{NewService},
})

return {{ .ModName }}Module
Expand All @@ -57,12 +57,12 @@ func ControllerTemplate() []byte {
return []byte(`
package {{ .ModName }}

import "github.com/tinh-tinh/tinhtinh/core"
import "github.com/tinh-tinh/tinhtinh/v2/core"

func NewController(module *core.DynamicModule) *core.DynamicController {
func NewController(module core.Module) core.Controller {
ctrl := module.NewController("{{ .ModName }}")

ctrl.Post("", func(ctx core.Ctx) error {
ctrl.Post("", func(ctx core.Ctx) error {
return ctx.JSON(core.Map{"data": "ok"})
})

Expand Down Expand Up @@ -91,7 +91,7 @@ func ServiceTemplate() []byte {
return []byte(`
package {{ .ModName }}

import "github.com/tinh-tinh/tinhtinh/core"
import "github.com/tinh-tinh/tinhtinh/v2/core"

const {{ .UpperModName }}_SERVICE core.Provide = "{{ .UpperModName}}_SERVICE"

Expand All @@ -117,7 +117,7 @@ func (s *{{ .ModName }}Service) Delete(id string) interface{} {
return nil
}

func NewService(module *core.DynamicModule) *core.DynamicProvider {
func NewService(module core.Module) core.Provider {
svc := module.NewProvider(core.ProviderOptions{
Name: {{ .UpperModName }}_SERVICE,
Value: &{{ .ModName }}Service{},
Expand Down