Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] schema里使用StructTag添加的tag,在types里生成的结构体里没有 #238

Open
nullcache opened this issue Dec 21, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@nullcache
Copy link

Describe the bug
schema里使用StructTag添加的tag,在types里生成的结构体里没有对应的tag

To Reproduce
Steps to reproduce the behavior:

// ent/schema/person.go
func (Person) Fields() []ent.Field {
	return []ent.Field{
		field.String("name").Comment("姓名").StructTag(`xlsx:"姓名"`).NotEmpty(),
		field.String("company").Comment("公司").StructTag(`xlsx:"公司"`).NotEmpty(),
		field.Int("age").StructTag(`xlsx:"年龄"`).Validate(isPositive),
	}
}

// types/types.go
type PersonInfo struct {
	BaseIDInfo
	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
	Status *uint8 `json:"status,optional"`
	// 名称
	Name *string `json:"name,optional"`
	// 公司
	Company *string `json:"company,optional"`
	// Age
	Age *int `json:"age,optional"`
}

Expected behavior

type PersonInfo struct {
	BaseIDInfo
	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
	Status *uint8 `json:"status,optional"`
	// 名称
	Name *string `json:"name,optional" xlsx:"姓名"`
	// 公司
	Company *string `json:"company,optional" xlsx:"公司"`
	// Age
	Age *int `json:"age,optional" xlsx:"年龄"`
}

Screenshots

Desktop (please complete the following information):

  • OS: macos 14.1.2
  • Browser chrome
  • Version
  • entgo.io/ent v0.12.5
    • github.com/casbin/casbin/v2 v2.80.0
    • github.com/suyuan32/simple-admin-common v1.2.5
    • github.com/suyuan32/simple-admin-core v1.2.5
    • github.com/xuri/excelize/v2 v2.8.0
    • github.com/zeromicro/go-zero v1.6.0
@suyuan32
Copy link
Owner

目前不支持 StructTag

@suyuan32 suyuan32 self-assigned this Dec 21, 2023
@suyuan32 suyuan32 added the enhancement New feature or request label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants