Skip to content

support gin aop exmaple (like java) 一个支持Go AOP 的示例,为了方便直观感受AOP的便捷性,示例简单集成了Gin框架作为示例。

Notifications You must be signed in to change notification settings

sjqzhang/gdi_aop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2dd28a8 · Sep 23, 2024

History

4 Commits
Nov 2, 2023
Nov 2, 2023
Nov 2, 2023
Nov 2, 2023
Nov 2, 2023
Sep 23, 2024
Nov 2, 2023
Nov 2, 2023

Repository files navigation

GO AOP 注解示例

package controller
import (
	"gdi_aop/dto"
	"github.com/gin-gonic/gin"
	"time"
)
//@router /api
type HelloController struct {
}

//@middleware log;cache(ttl=10)
//@router /index [get]
func (c HelloController) Index(ctx *gin.Context, req *dto.HelloRequest) interface{} {
	return time.Now().String()
}

上面的示例中使用日志和缓存注解 cache设定10秒过期,多个注解之间用;进行分隔

About

support gin aop exmaple (like java) 一个支持Go AOP 的示例,为了方便直观感受AOP的便捷性,示例简单集成了Gin框架作为示例。

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages