Giter Site home page Giter Site logo

dengsgo / go-decorator Goto Github PK

View Code? Open in Web Editor NEW
46.0 2.0 3.0 191 KB

让 Go 便捷使用装饰器的工具,装饰器能够切面 (AOP)、代理 (Proxy) 任意的函数和方法,提供观察和控制函数的能力。go-decorator is a tool that allows Go to easily use decorators. The decorator can slice aspect (AOP) and proxy any function and method, providing the ability to observe and control functions.

License: MIT License

Go 100.00%
compiler decorator go tool go-decorator golang golang-application golang-cli golang-library golang-module

go-decorator's People

Contributors

dengsgo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-decorator's Issues

增加装饰器参数

允许定义类似 func Logging(ctx *decor.Context, key string, autoBr bool) 这样的装饰器,可以额外传递参数给装饰器。

当方法返回值包含error类型时,执行报错

func (m *Demo) Run(a string, b string) (result string, err error) { result = fmt.Sprintf("%s %s", a, b) return }
报错:
`panic: interface conversion: interface is nil, not error

goroutine 1 [running]:
go-decorator-demo/demo.(*Demo).Run(0x9395a0, {0x84af04, 0x5}, {0x84af09, 0x5})
D:/GoProjects/go-decorator-demo/demo/demo.go:11 +0x27e
main.main()
D:/GoProjects/go-decorator-demo/main.go:10 +0x3c
exit status 2`

貌似在interface{}转换为error类型时发生错误,stackoverflow中有解决方案

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.