We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
使用字符串类型的uuid或者openid进入,执行的时候都没有触发分表算法,无法使用分表, 表结构 type O2UID struct { OID string form:"oid" json:"oid" gorm:"primaryKey;autoIncrement:false;column:oid;type:char(128)" UID uint64 form:"uid" json:"uid" gorm:"column:uid" } 查询的时候报错 Unknown column 'o2_uids.oid' in 'where clause'
form:"oid" json:"oid" gorm:"primaryKey;autoIncrement:false;column:oid;type:char(128)"
form:"uid" json:"uid" gorm:"column:uid"
The text was updated successfully, but these errors were encountered:
问题找到了,但是还是不太理解,在结果接收的结构体赋值,会导致查询语句异常 这个是错误的 o2u := &model.O2UID{OID: oid} <- 这里赋值了 tx := s.conn.GetDB(0).Model(&model.O2UID{}).Where("oid = ?", oid).First(&o2u) "SELECT * FROM o2_uids_5 WHERE oid = ? AND o2_uids.oid = ? ORDER BY o2_uids_5.oid LIMIT ?"
o2_uids
oid
o2_uids_5
这个是正确的 o2u := &model.O2UID{} tx := s.conn.GetDB(0).Model(&model.O2UID{}).Where("oid = ?", oid).First(&o2u) "SELECT * FROM users_3 WHERE uid = ? ORDER BY users_3.uid LIMIT ?"
users_3
uid
Sorry, something went wrong.
jinzhu
No branches or pull requests
使用字符串类型的uuid或者openid进入,执行的时候都没有触发分表算法,无法使用分表,
表结构
type O2UID struct {
OID string
form:"oid" json:"oid" gorm:"primaryKey;autoIncrement:false;column:oid;type:char(128)"
UID uint64
form:"uid" json:"uid" gorm:"column:uid"
}
查询的时候报错
Unknown column 'o2_uids.oid' in 'where clause'
The text was updated successfully, but these errors were encountered: