-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,13 @@ A command-line tool to generate constructor code for a struct. It doesn't need m | |
Just add this comment line to the struct you want to generate a constructor. It doesn't need a manual installation. | ||
|
||
```go | ||
//go:generate go run github.com/Bin-Huang/[email protected].0 | ||
//go:generate go run github.com/Bin-Huang/[email protected].1 | ||
``` | ||
|
||
For example: | ||
|
||
```go | ||
//go:generate go run github.com/Bin-Huang/[email protected].0 | ||
//go:generate go run github.com/Bin-Huang/[email protected].1 | ||
type UserService struct { | ||
baseService | ||
userRepository *repositories.UserRepository | ||
|
@@ -65,7 +65,7 @@ type UserService struct { | |
2. Write an `init` method for the struct | ||
|
||
```go | ||
//go:generate go run github.com/Bin-Huang/[email protected].0 --init | ||
//go:generate go run github.com/Bin-Huang/[email protected].1 --init | ||
type Controller struct { | ||
logger *zap.Logger | ||
debug bool | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,13 +11,13 @@ Doc: [English](README.md) | **中文** | |
它的使用方式非常简单,不用专门手动安装,只需要在结构体添加下面这行代码注释就能工作。 | ||
|
||
```go | ||
//go:generate go run github.com/Bin-Huang/[email protected].0 | ||
//go:generate go run github.com/Bin-Huang/[email protected].1 | ||
``` | ||
|
||
举个例子: | ||
|
||
```go | ||
//go:generate go run github.com/Bin-Huang/[email protected].0 | ||
//go:generate go run github.com/Bin-Huang/[email protected].1 | ||
type UserService struct { | ||
baseService | ||
userRepository *repositories.UserRepository | ||
|
@@ -67,7 +67,7 @@ type UserService struct { | |
2. 为结构体实现一个 `init` 方法 | ||
|
||
```go | ||
//go:generate go run github.com/Bin-Huang/[email protected].0 --init | ||
//go:generate go run github.com/Bin-Huang/[email protected].1 --init | ||
type Controller struct { | ||
logger *zap.Logger | ||
debug bool | ||
|