go-codegen is a library for generating Go code. It's useful for generating boilerplate code, or code that is tedious to write by hand. It's similar to go-generate, but go-codegen is a library that you can use to generate code, instead of a tool that you run on the command line.
go get github.com/go-codegen/go-codegen
go install github.com/go-codegen/go-codegen
type Recipient struct {
gorm.Model
}
type User struct {
gorm.Model
NameAction string `gorm:"unique"`
Age int `codegen:"unique"`
RecipientID int
Recipient
}
go-codegen createRepository gorm --path=test/repository-test.go --out=test/files/
- unique - when you create a repository methods, the field will be unique in method find