How to generate Setxxx() method to model_gen.go
- Lenguaje dominante
- Go
- Estrellas
- 10.8k
- Forks
- 1.3k
- Merge medio
- 2 d 36 min
- PR fusionados (30 d)
- 26
Descripción
### What happened?
I have an interface MongoModel nad use implements this.
```graphql
interface MongoModel {
id: ID
createdAt: Int
updatedAt: Int
deletedAt: Int
}
type User implements MongoModel {
id: ID
createdAt: Int
updatedAt: Int
deletedAt: Int
username: String!
nickname: String
email: String
password: String
mobile: String
}
```
This interface only generates Getxxx method in model_gen.go
```go
type MongoModel interface {
IsMongoModel()
GetID() *string
GetCreatedAt() *int64
GetUpdatedAt() *int64
GetDeletedAt() *int64
}
type User struct {
ID *string `json:"id,omitempty" bson:"_id,omitempty"`
CreatedAt *int64 `json:"createdAt,omitempty" bson:"createdAt,omitempty"`
UpdatedAt *int64 `json:"updatedAt,omitempty" bson:"updatedAt,omitempty"`
DeletedAt *int64 `json:"deletedAt,omitempty" bson:"deletedAt,omitempty"`
Username string `json:"username" bson:"username"`
Nickname *string `json:"nickname,omitempty" bson:"nickname,omitempty"`
Email *string `json:"email,omitempty" bson:"email,omitempty"`
Password *string `json:"password,omitempty" bson:"password,omitempty"`
Mobile *string `json:"mobile,omitempty" bson:"mobile,omitempty"`
}
func (User) IsMongoModel() {}
func (this User) GetID() *string { return this.ID }
func (this User) GetCreatedAt() *int64 { return this.CreatedAt }
func (this User) GetUpdatedAt() *int64 { return this.UpdatedAt }
func (this User) GetDeletedAt() *int64 { return this.DeletedAt }
```
### What did you expect?
How to generate of Setxxx method, since I need to set this field.
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.