Skip to content

Releases: alimy/mir

v4.2.0-alpha.6

10 Jun 15:06
v4.2.0-alpha.6
0eb651f
Compare
Choose a tag to compare

add service package.

v4.1.0

30 Dec 05:10
55560f7
Compare
Choose a tag to compare

Added

  • add gin engine support for Context primitive logic
  • add hertz engine support for Context primitive logic
  • add chi engine support for Context primitive logic
  • add mux engine support for Context primitive logic
  • add httprouter engine support Context primitive logic
  • add echo engine support for Context primitive logic
  • add iris engine support for Context primitive logic
  • add fiber engine support for Context primitive logic
  • add macaron engine support for Context primitive logic

mirc/v4.1.0

30 Dec 05:30
mirc/v4.1.0
fbc202c
Compare
Choose a tag to compare
  • adapter for go-mir v4.1.0.

v4.1.0-rc.1

28 Dec 10:46
bd17be9
Compare
Choose a tag to compare
  • prepare to release v4.1.0

v4.1.0-beta.1

26 Dec 15:26
02c54dd
Compare
Choose a tag to compare

add Context primitive indicator use Engine's raw handler as method

adpate for engine

  • gin
  • chi
  • echo
  • fiber
  • hertz
  • httprouter
  • iris
  • macaron
  • mux

mirc/v4.1.0-beta.1

26 Dec 16:08
4c83784
Compare
Choose a tag to compare
  • adapte for go-mir v4.1.0-beta.1

v4.1.0-alpha.3

19 Dec 02:29
4438847
Compare
Choose a tag to compare
  • add Context primitive support for hertz engine code generate

v4.1.0-alpha.2

17 Dec 12:35
14eeeb8
Compare
Choose a tag to compare

v4.1.0-alpha.1

13 Dec 04:11
f54b37e
Compare
Choose a tag to compare
  • add Context primitive support for gin engine code generate

Usage:

// go-mir route interface define file
// Site site interface info
type Site struct {
	Chain            `mir:"-"`
	Index            func(Get, Chain)                               `mir:"/index/"`
	Assets           func(Get, Context)                             `mir:"/assets/:name"`
}

使用gin的代码生成器生成的代码如下

type _binding_ interface {
	Bind(*gin.Context) mir.Error
}

type _render_ interface {
	Render(*gin.Context)
}

type _default_ interface {
	Bind(*gin.Context, any) mir.Error
	Render(*gin.Context, any, mir.Error)
}

type Site interface {
	_default_

	// Chain provide handlers chain for gin
	Chain() gin.HandlersChain

	Assets(*gin.Context)
	Index() mir.Error

	mustEmbedUnimplementedSiteServant()
}

// RegisterSiteServant register Site servant to gin
func RegisterSiteServant(e *gin.Engine, s Site, m ...SiteChain) {
	var cc SiteChain
	if len(m) > 0 {
		cc = m[0]
	} else {
		cc = &UnimplementedSiteChain{}
	}
	router := e
	// use chain for router
	middlewares := s.Chain()
	router.Use(middlewares...)

	router.Handle("GET", "/assets/:name", s.Assets)	
	router.Handle("GET", "/index/", append(cc.ChainIndex(), func(c *gin.Context) {
		select {
		case <-c.Request.Context().Done():
			return
		default:
		}

		s.Render(c, nil, s.Index())
	})...)
}

v4.0.0

27 Jul 11:31
v4.0.0
0ca44c4
Compare
Choose a tag to compare

new generator for go-mir v4 base golang type assert feature.

Generator supported: