Skip to content

Releases: alimy/mir

v3.0.0

07 Jan 17:35
v3.0.0
135cc97
Compare
Choose a tag to compare
  • implement #26 RFC.

mirc/v3.0.0

07 Jan 17:50
0c02669
Compare
Choose a tag to compare
  • adapter go-mir v3 spec implement.

v3.0.0-rc.1

02 Jan 04:32
v3.0.0-rc.1
135cc97
Compare
Choose a tag to compare
  • first rc version release

v3.0.0-beta.4

01 Jan 08:54
v3.0.0-beta.4
4589c24
Compare
Choose a tag to compare
  • fourth beta version releaase

v3.0.0-beta.2

23 Dec 06:36
v3.0.0-beta.2
22bc41d
Compare
Choose a tag to compare
  • add external struct model that from external package as api's request/response support

v3.0.0-alpha.7

15 Dec 03:16
v3.0.0-alpha.7
a1d8117
Compare
Choose a tag to compare
  • add custom WatchCtxDone option for control whether generate watch context done code in register servants.

set WatchCtxDone(true)

// file: mirc/main.go 

//go:generate go run main.go
func main() {
	log.Println("generate code start")
	opts := Options{
		RunMode(InSerialMode),
		GeneratorName(GeneratorGin),
		WatchCtxDone(true),
		SinkPath("auto"),
	}
	if err := Generate(opts); err != nil {
		log.Fatal(err)
	}
	log.Println("generate code finish")
}

will generate watch context done code

// file: mirc/auto/v1/site.go

// RegisterSiteServant register Site servant to gin
func RegisterSiteServant(e *gin.Engine, s Site, r SiteRender) {
	router := e.Group("v1")
	// use chain for router
	middlewares := s.Chain()
	router.Use(middlewares...)

	// register routes info to router
	{
		h := func(c *gin.Context) {
			select {
			case <-c.Request.Context().Done():
				return
			default:
			}

			r.RenderArticles(c, s.Articles())
		}
		router.Handle("POST", "/articles/:category/", h)
		router.Handle("GET", "/articles/:category/", h)
		router.Handle("HEAD", "/articles/:category/", h)
	}

	router.Handle("GET", "/index/", func(c *gin.Context) {
		select {
		case <-c.Request.Context().Done():
			return
		default:
		}

		r.RenderIndex(c, s.Index())
	})
}

set WatchCtxDone(false)

// file: mirc/main.go 

//go:generate go run main.go
func main() {
	log.Println("generate code start")
	opts := Options{
		RunMode(InSerialMode),
		GeneratorName(GeneratorGin),
		WatchCtxDone(false),
		SinkPath("auto"),
	}
	if err := Generate(opts); err != nil {
		log.Fatal(err)
	}
	log.Println("generate code finish")
}

will not generate watch context done code

// file: mirc/auto/v1/site.go

// RegisterSiteServant register Site servant to gin
func RegisterSiteServant(e *gin.Engine, s Site, r SiteRender) {
	router := e.Group("v1")
	// use chain for router
	middlewares := s.Chain()
	router.Use(middlewares...)

	// register routes info to router
	{
		h := func(c *gin.Context) {
			r.RenderArticles(c, s.Articles())
		}
		router.Handle("POST", "/articles/:category/", h)
		router.Handle("GET", "/articles/:category/", h)
		router.Handle("HEAD", "/articles/:category/", h)
	}

	router.Handle("GET", "/index/", func(c *gin.Context) {
		r.RenderIndex(c, s.Index())
	})
}

mirc/v3.0.0-alpha.6

14 Dec 12:47
mirc/v3.0.0-alpha.6
3fd74b3
Compare
Choose a tag to compare
  • adapter go-mir v3.0.0-alpha.6

v3.0.0-alpha.6

13 Dec 11:53
v3.0.0-alpha.6
bdca1a1
Compare
Choose a tag to compare
  • add hertz/echo/iris/fiber/macaron engine style generator support
  • optimize gin/mux/chi/httprouter engine style gnerator add Request.Context().Done() support
  • fixed gin/chi/hertz/httprouter/mux engine style generator miss a return segment in template

v3.0.0-alpha.5

13 Dec 04:15
511ca17
Compare
Choose a tag to compare
  • add chi/mux/httprouter engine style generator support
  • optimize gin engine style generator code generate

v3.0.0-alpha.3

09 Dec 13:33
13ee91e
Compare
Choose a tag to compare
  • add gin engine style generator for v3 spec base implement