Model 字段包含泛型时,无法生成
- Dominant language
- Go
- Stars
- 108
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
## GORM Playground Link
https://github.com/go-gorm/playground/pull/1
## Description
1. models
```go
package models
import (
"gorm.io/datatypes"
)
type UserQuestionnaireStepAnswer struct {
StepID uint64 `gorm:"column:stepId;type:bigint(20) unsigned;not null;comment:步骤ID" json:"stepId,string"`
Answer datatypes.JSON `gorm:"column:answer;type:json;not null;comment:用户回答" json:"answer"`
}
// UserQuestionnaire 用户问卷表
type UserQuestionnaire struct {
ID uint64 `gorm:"column:id;type:bigint(20) unsigned;primaryKey;comment:ID" json:"id,string"`
Steps datatypes.JSONSlice[UserQuestionnaireStepAnswer] `gorm:"column:steps;type:json;not null;comment:各步骤的用户回答" json:"steps"`
}
```
2. gen
```go
// Code generated by 'gorm.io/cli/gorm'. DO NOT EDIT.
package gcli_gen
import (
"gorm.io/cli/gorm/field"
"internal/dal/models"
)
var UserQuestionnaire = struct {
ID field.Number[uint64]
Steps field.Struct[models.UserQuestionnaireStepAnswer]]
}{
ID: field.Number[uint64]{}.WithColumn("id"),
Steps: field.Struct[models.UserQuestionnaireStepAnswer]]{}.WithName("Steps"),
}
```
生成代码结果中 `Steps` 字段类型泛型缺失
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.