Skip to content

Commit

Permalink
examples: upgrade mir's version -> v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alimy committed Mar 25, 2020
1 parent 4350308 commit eb16eb0
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/alimy/mir/v2/examples
go 1.12

require (
github.com/alimy/mir/v2 v2.1.0
github.com/alimy/mir/v2 v2.2.0
github.com/gin-gonic/gin v1.5.0
)
4 changes: 2 additions & 2 deletions examples/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/alimy/mir/v2 v2.1.0 h1:cc/Koo76aZsOleiDkepIfSeMt/id/l6/YrhXdez+mlo=
github.com/alimy/mir/v2 v2.1.0/go.mod h1:AkAOYbPbTxjp8DsUBTERZdXo+7jcSLEvKhLW+Zp9MZ8=
github.com/alimy/mir/v2 v2.2.0 h1:eR9EHQ9Tym+Z/M9+CIXyFpSzwbODt9Fo9h3yvVxkys8=
github.com/alimy/mir/v2 v2.2.0/go.mod h1:AkAOYbPbTxjp8DsUBTERZdXo+7jcSLEvKhLW+Zp9MZ8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
Expand Down
17 changes: 4 additions & 13 deletions examples/mirc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,23 @@ import (
"github.com/alimy/mir/v2/core"
"github.com/alimy/mir/v2/engine"

routes "github.com/alimy/mir/v2/examples/mirc/routes"
v1 "github.com/alimy/mir/v2/examples/mirc/routes/v1"
v2 "github.com/alimy/mir/v2/examples/mirc/routes/v2"
_ "github.com/alimy/mir/v2/examples/mirc/routes"
_ "github.com/alimy/mir/v2/examples/mirc/routes/v1"
_ "github.com/alimy/mir/v2/examples/mirc/routes/v2"
)

//go:generate go run main.go
func main() {
log.Println("generate code start")
entries := mirEntries()
opts := &core.Options{
RunMode: core.InConcurrentDebugMode,
GeneratorName: core.GeneratorGin,
GeneratorOpts: core.InitOpts{
core.OptSinkPath: "./gen",
},
}
if err := engine.Generate(entries, opts); err != nil {
if err := engine.Generate(opts); err != nil {
log.Fatal(err)
}
log.Println("generate code finish")
}

func mirEntries() []interface{} {
return []interface{}{
new(routes.Site),
new(v1.Site),
new(v2.Site),
}
}
9 changes: 8 additions & 1 deletion examples/mirc/routes/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@

package routes

import "github.com/alimy/mir/v2"
import (
"github.com/alimy/mir/v2"
"github.com/alimy/mir/v2/engine"
)

func init() {
engine.AddEntry(new(Site))
}

// Site mir's struct tag define
type Site struct {
Expand Down
9 changes: 8 additions & 1 deletion examples/mirc/routes/v1/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@

package v1

import "github.com/alimy/mir/v2"
import (
"github.com/alimy/mir/v2"
"github.com/alimy/mir/v2/engine"
)

func init() {
engine.AddEntry(new(Site))
}

// Site mir's struct tag define
type Site struct {
Expand Down
9 changes: 8 additions & 1 deletion examples/mirc/routes/v2/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@

package v2

import "github.com/alimy/mir/v2"
import (
"github.com/alimy/mir/v2"
"github.com/alimy/mir/v2/engine"
)

func init() {
engine.AddEntry(new(Site))
}

// Site mir's struct tag define
type Site struct {
Expand Down

0 comments on commit eb16eb0

Please sign in to comment.