Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
dengsgo committed Aug 20, 2023
1 parent 29ee65f commit c8a0ff5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ If `ctx.TargetDo()` is not executed in the decorator, it means that the real log
## Package references

In the `datetime` [example/datetime](example/datetime) example above, our decorator and target function are in a package and we don't need to think about packages.
In the `datetime` [example/datetime](example/datetime) example above, our decorator and target function are in a package, and we don't need to think about packages.

Package references need to be considered when we have many packages.

Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
`go-decorator` is a compilation chaining tool that implements the decorator feature of the Go language.

In the go code, use the `//go:decorator decoratorfunctionName` to annotate functions, and you can use the `decoratorfunctionName` to quickly complete template code injection, change function behavior, control logical flow, and more.

Using this tool, you can use the decorator `decoratorfunctionName` by annotating the function with `//go:decoratorfunctionName`, which allows you to quickly inject sample code, change the behavior of the function, control the flow of logic, and more.
The usage scenarios of decorators can be compared to other languages, such as Python and TypeScript.

`go-decorator` is a decorator injection performed during compilation, so it does not damage the source files of your project, nor does it generate new `.go` files or other unnecessary files in the project. It is completely different from the `go:generate` generative expression.

## Guide

查看: [中文文档](GUIDE.zh_cn.md) | [English Guide](GUIDE.md) | More

## Install

Install via `go install`.
Expand Down
6 changes: 5 additions & 1 deletion README.zh_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
`go-decorator` 是实现 Go 语言装饰器特性的编译链工具。

在 go 代码中,使用 `//go:decor decoratorfunctionName` 来注释函数,即可使用装饰器`decoratorfunctionName`,快速完成样板代码注入、改变函数行为、控制逻辑流程等。
使用该工具,通过 `//go:decor decoratorfunctionName` 来注释函数,即可使用装饰器`decoratorfunctionName`,快速完成样板代码注入、改变函数行为、控制逻辑流程等。

装饰器的使用场景,可以类比其他语言,比如 Python、TypeScript。

`go-decorator` 是在编译时进行的装饰器注入,因此它不会破坏你项目的源文件,也不会额外在项目中生成新的`.go`文件和其他多余文件。 和 `go:generate` 生成式完全不同。

## Guide

查看: [中文文档](GUIDE.zh_cn.md) | [English Guide](GUIDE.md) | 更多

## Install

通过 `go install` 安装:
Expand Down

0 comments on commit c8a0ff5

Please sign in to comment.