Skip to content

Commit

Permalink
docs: usage of diy method
Browse files Browse the repository at this point in the history
  • Loading branch information
tr1v3r committed Jul 7, 2022
1 parent 19c330c commit f028103
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.ZH_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,12 @@ type Method interface {

方法输入参数和返回值支持基础类型(int、string、bool等)、结构体和占位符(`gen.T`/`gen.M`/`gen.RowsAffected`),类型支持指针和数组,返回值最多返回一个值和一个 error。

用法(完整case见[快速开始](#quick-start)):
```go
// 在表user和company生成的结构体上实现model.Method中包含的方法
g.ApplyInterface(func(method model.Method) {}, model.User{}, g.GenerateModel("company"))
```

##### <span id="syntax-of-template">模板</span>

###### <span id="placeholder">占位符</span>
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,12 @@ type Method interface {
```
Method input parameters and return values support basic types (`int`, `string`, `bool`...), struct and placeholders (`gen.T`/`gen.M`/`gen.RowsAffected`), and types support pointers and arrays. The return value is at most a value and an error.

Usage(complete case on [Quick start](#quick-start)):
```go
// implement model.Method on table "user" and "comany"
g.ApplyInterface(func(method model.Method) {}, model.User{}, g.GenerateModel("company"))
```

##### Syntax of template

###### placeholder
Expand Down

0 comments on commit f028103

Please sign in to comment.