This commit is contained in:
parent
8ba5e98c50
commit
582988add2
4 changed files with 50 additions and 35 deletions
|
@ -28,6 +28,7 @@ func newLoginProcessToken(db *gorm.DB, opts ...gen.DOOption) loginProcessToken {
|
|||
_loginProcessToken.ALL = field.NewAsterisk(tableName)
|
||||
_loginProcessToken.UserId = field.NewString(tableName, "user_id")
|
||||
_loginProcessToken.Token = field.NewString(tableName, "token")
|
||||
_loginProcessToken.ExpiresAt = field.NewTime(tableName, "expires_at")
|
||||
_loginProcessToken.User = loginProcessTokenBelongsToUser{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
|
@ -180,6 +181,7 @@ type loginProcessToken struct {
|
|||
ALL field.Asterisk
|
||||
UserId field.String
|
||||
Token field.String
|
||||
ExpiresAt field.Time
|
||||
User loginProcessTokenBelongsToUser
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
|
@ -199,6 +201,7 @@ func (l *loginProcessToken) updateTableName(table string) *loginProcessToken {
|
|||
l.ALL = field.NewAsterisk(table)
|
||||
l.UserId = field.NewString(table, "user_id")
|
||||
l.Token = field.NewString(table, "token")
|
||||
l.ExpiresAt = field.NewTime(table, "expires_at")
|
||||
|
||||
l.fillFieldMap()
|
||||
|
||||
|
@ -215,9 +218,10 @@ func (l *loginProcessToken) GetFieldByName(fieldName string) (field.OrderExpr, b
|
|||
}
|
||||
|
||||
func (l *loginProcessToken) fillFieldMap() {
|
||||
l.fieldMap = make(map[string]field.Expr, 3)
|
||||
l.fieldMap = make(map[string]field.Expr, 4)
|
||||
l.fieldMap["user_id"] = l.UserId
|
||||
l.fieldMap["token"] = l.Token
|
||||
l.fieldMap["expires_at"] = l.ExpiresAt
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -36,14 +36,16 @@ func newUser(db *gorm.DB, opts ...gen.DOOption) user {
|
|||
_user.Description = field.NewString(tableName, "description")
|
||||
_user.IsBot = field.NewBool(tableName, "is_bot")
|
||||
_user.IconId = field.NewString(tableName, "icon_id")
|
||||
_user.BackgroundId = field.NewString(tableName, "background_id")
|
||||
_user.BannerId = field.NewString(tableName, "banner_id")
|
||||
_user.BackgroundId = field.NewField(tableName, "background_id")
|
||||
_user.BannerId = field.NewField(tableName, "banner_id")
|
||||
_user.Indexable = field.NewBool(tableName, "indexable")
|
||||
_user.PublicKey = field.NewBytes(tableName, "public_key")
|
||||
_user.RestrictedFollow = field.NewBool(tableName, "restricted_follow")
|
||||
_user.Location = field.NewString(tableName, "location")
|
||||
_user.Birthday = field.NewTime(tableName, "birthday")
|
||||
_user.Location = field.NewField(tableName, "location")
|
||||
_user.Birthday = field.NewField(tableName, "birthday")
|
||||
_user.Verified = field.NewBool(tableName, "verified")
|
||||
_user.PasskeyId = field.NewBytes(tableName, "passkey_id")
|
||||
_user.FinishedRegistration = field.NewBool(tableName, "finished_registration")
|
||||
_user.RemoteInfo = userHasOneRemoteInfo{
|
||||
db: db.Session(&gorm.Session{}),
|
||||
|
||||
|
@ -321,14 +323,16 @@ type user struct {
|
|||
Description field.String
|
||||
IsBot field.Bool
|
||||
IconId field.String
|
||||
BackgroundId field.String
|
||||
BannerId field.String
|
||||
BackgroundId field.Field
|
||||
BannerId field.Field
|
||||
Indexable field.Bool
|
||||
PublicKey field.Bytes
|
||||
RestrictedFollow field.Bool
|
||||
Location field.String
|
||||
Birthday field.Time
|
||||
Location field.Field
|
||||
Birthday field.Field
|
||||
Verified field.Bool
|
||||
PasskeyId field.Bytes
|
||||
FinishedRegistration field.Bool
|
||||
RemoteInfo userHasOneRemoteInfo
|
||||
|
||||
InfoFields userHasManyInfoFields
|
||||
|
@ -376,14 +380,16 @@ func (u *user) updateTableName(table string) *user {
|
|||
u.Description = field.NewString(table, "description")
|
||||
u.IsBot = field.NewBool(table, "is_bot")
|
||||
u.IconId = field.NewString(table, "icon_id")
|
||||
u.BackgroundId = field.NewString(table, "background_id")
|
||||
u.BannerId = field.NewString(table, "banner_id")
|
||||
u.BackgroundId = field.NewField(table, "background_id")
|
||||
u.BannerId = field.NewField(table, "banner_id")
|
||||
u.Indexable = field.NewBool(table, "indexable")
|
||||
u.PublicKey = field.NewBytes(table, "public_key")
|
||||
u.RestrictedFollow = field.NewBool(table, "restricted_follow")
|
||||
u.Location = field.NewString(table, "location")
|
||||
u.Birthday = field.NewTime(table, "birthday")
|
||||
u.Location = field.NewField(table, "location")
|
||||
u.Birthday = field.NewField(table, "birthday")
|
||||
u.Verified = field.NewBool(table, "verified")
|
||||
u.PasskeyId = field.NewBytes(table, "passkey_id")
|
||||
u.FinishedRegistration = field.NewBool(table, "finished_registration")
|
||||
|
||||
u.fillFieldMap()
|
||||
|
||||
|
@ -400,7 +406,7 @@ func (u *user) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|||
}
|
||||
|
||||
func (u *user) fillFieldMap() {
|
||||
u.fieldMap = make(map[string]field.Expr, 29)
|
||||
u.fieldMap = make(map[string]field.Expr, 31)
|
||||
u.fieldMap["id"] = u.ID
|
||||
u.fieldMap["username"] = u.Username
|
||||
u.fieldMap["created_at"] = u.CreatedAt
|
||||
|
@ -419,6 +425,8 @@ func (u *user) fillFieldMap() {
|
|||
u.fieldMap["location"] = u.Location
|
||||
u.fieldMap["birthday"] = u.Birthday
|
||||
u.fieldMap["verified"] = u.Verified
|
||||
u.fieldMap["passkey_id"] = u.PasskeyId
|
||||
u.fieldMap["finished_registration"] = u.FinishedRegistration
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ type User struct {
|
|||
// In theory, could also slash Id in half, but that would be a lot more calculations than the
|
||||
// saved space is worth
|
||||
PasskeyId []byte
|
||||
FinishedRegistration bool // Whether this account has completed registration yet
|
||||
|
||||
// ---- "Remote" linked values
|
||||
InfoFields []UserInfoField
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
package storage
|
||||
|
||||
//go:generate go run ../cmd/NewRoleHelperGenerator/main.go -input ./models/Role.go -output role_generated.go -mod storage
|
||||
|
|
Loading…
Reference in a new issue