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

结构体嵌套不支持 #72

Closed
vcqr opened this issue Apr 22, 2019 · 2 comments
Closed

结构体嵌套不支持 #72

vcqr opened this issue Apr 22, 2019 · 2 comments

Comments

@vcqr
Copy link

vcqr commented Apr 22, 2019

type BaseModel struct {
	Status    uint8 `orm:"status"`     //数据状态
	CreatedAt int   `orm:"created_at"` //创建时间
	UpdatedAt int   `orm:"updated_at"` // 更新时间
}

type Ceshi struct{
	Id         int    `orm:"id"`
	Name       string `orm:"name"`
	Email      string `orm:"email"`
        BaseModel
}

var ceshi Ceshi

db.Table(&ceshi).Where("id", 1).Select()

嵌套的结构体字段无法解析出来,最终执行的语句是
SELECT id, name, email, BaseModel FROM ceshi WHERE id = 1 LIMIT 1
要是这样重复的字段就无法抽象出来

@fizzday
Copy link
Member

fizzday commented Jun 26, 2019

2.0版本已上线, 已解决此问题

@fizzday fizzday closed this as completed Jun 26, 2019
@BenedictKing
Copy link

在v2.1.4-rc版本这个问题仍然存在

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants