Work on ensuring data consistency even for yet unknown fields
Some checks failed
/ docker (push) Has been cancelled
Some checks failed
/ docker (push) Has been cancelled
This commit is contained in:
parent
7e10627618
commit
bf0aaaca8f
12 changed files with 458 additions and 5 deletions
|
@ -51,6 +51,7 @@ func newUser(db *gorm.DB, opts ...gen.DOOption) user {
|
|||
_user.FinishedRegistration = field.NewBool(tableName, "finished_registration")
|
||||
_user.PrivateKeyRsa = field.NewBytes(tableName, "private_key_rsa")
|
||||
_user.PrivateKeyEd = field.NewBytes(tableName, "private_key_ed")
|
||||
_user.RawData = field.NewBytes(tableName, "raw_data")
|
||||
_user.RemoteInfoId = field.NewField(tableName, "remote_info_id")
|
||||
_user.RemoteInfo = userHasOneRemoteInfo{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
@ -392,6 +393,7 @@ type user struct {
|
|||
FinishedRegistration field.Bool
|
||||
PrivateKeyRsa field.Bytes
|
||||
PrivateKeyEd field.Bytes
|
||||
RawData field.Bytes
|
||||
RemoteInfoId field.Field
|
||||
RemoteInfo userHasOneRemoteInfo
|
||||
|
||||
|
@ -455,6 +457,7 @@ func (u *user) updateTableName(table string) *user {
|
|||
u.FinishedRegistration = field.NewBool(table, "finished_registration")
|
||||
u.PrivateKeyRsa = field.NewBytes(table, "private_key_rsa")
|
||||
u.PrivateKeyEd = field.NewBytes(table, "private_key_ed")
|
||||
u.RawData = field.NewBytes(table, "raw_data")
|
||||
u.RemoteInfoId = field.NewField(table, "remote_info_id")
|
||||
|
||||
u.fillFieldMap()
|
||||
|
@ -472,7 +475,7 @@ func (u *user) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|||
}
|
||||
|
||||
func (u *user) fillFieldMap() {
|
||||
u.fieldMap = make(map[string]field.Expr, 36)
|
||||
u.fieldMap = make(map[string]field.Expr, 37)
|
||||
u.fieldMap["id"] = u.ID
|
||||
u.fieldMap["username"] = u.Username
|
||||
u.fieldMap["created_at"] = u.CreatedAt
|
||||
|
@ -496,6 +499,7 @@ func (u *user) fillFieldMap() {
|
|||
u.fieldMap["finished_registration"] = u.FinishedRegistration
|
||||
u.fieldMap["private_key_rsa"] = u.PrivateKeyRsa
|
||||
u.fieldMap["private_key_ed"] = u.PrivateKeyEd
|
||||
u.fieldMap["raw_data"] = u.RawData
|
||||
u.fieldMap["remote_info_id"] = u.RemoteInfoId
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue