feat: 会话令牌与守卫、看板组件及工位终端功能完善
- 用户表扩展:MES/WMS user 实体新增字段,新增 active_token 迁移 SQL(2026-11-11) - 会话机制:MES 新增 session_guard,重构 token/auth/jwt/perm 与路由;WMS/工作站同步令牌续签与鉴权 - 看板(board):调整 MES 看板产线/生产/侧栏/仓库组件及样式;WMS 看板展示页同步调整 - 工位终端后端:完善报警流、绑定、PLC 对账、拧紧、proxy、上报、站点告警/操作等 handler,补充 mes client/store - 工位终端前端:登录/主界面/各操作面板调整,新增滚动分页与多语言 yaml 文案,刷新构建产物 - MES 业务:新增流程链 logic,调整待审核/产能支撑/产品工艺/设置页、PLC 监控与帮助文档,刷新构建产物 - 更新问题记录文档
This commit is contained in:
@@ -961,6 +961,7 @@ var (
|
||||
{Name: "phone", Type: field.TypeString, Nullable: true, Comment: "电话"},
|
||||
{Name: "is_active", Type: field.TypeBool, Comment: "是否启用", Default: true},
|
||||
{Name: "last_login_at", Type: field.TypeInt64, Nullable: true, Comment: "最近登录时间"},
|
||||
{Name: "active_token", Type: field.TypeString, Nullable: true, Comment: "后台登录会话标识(SID),互踢用;空=无生效后台会话"},
|
||||
{Name: "created_at", Type: field.TypeInt64},
|
||||
{Name: "updated_at", Type: field.TypeInt64},
|
||||
}
|
||||
|
||||
@@ -29995,6 +29995,7 @@ type UserMutation struct {
|
||||
is_active *bool
|
||||
last_login_at *int64
|
||||
addlast_login_at *int64
|
||||
active_token *string
|
||||
created_at *int64
|
||||
addcreated_at *int64
|
||||
updated_at *int64
|
||||
@@ -30534,6 +30535,55 @@ func (m *UserMutation) ResetLastLoginAt() {
|
||||
delete(m.clearedFields, user.FieldLastLoginAt)
|
||||
}
|
||||
|
||||
// SetActiveToken sets the "active_token" field.
|
||||
func (m *UserMutation) SetActiveToken(s string) {
|
||||
m.active_token = &s
|
||||
}
|
||||
|
||||
// ActiveToken returns the value of the "active_token" field in the mutation.
|
||||
func (m *UserMutation) ActiveToken() (r string, exists bool) {
|
||||
v := m.active_token
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldActiveToken returns the old "active_token" field's value of the User entity.
|
||||
// If the User object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *UserMutation) OldActiveToken(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldActiveToken is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldActiveToken requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldActiveToken: %w", err)
|
||||
}
|
||||
return oldValue.ActiveToken, nil
|
||||
}
|
||||
|
||||
// ClearActiveToken clears the value of the "active_token" field.
|
||||
func (m *UserMutation) ClearActiveToken() {
|
||||
m.active_token = nil
|
||||
m.clearedFields[user.FieldActiveToken] = struct{}{}
|
||||
}
|
||||
|
||||
// ActiveTokenCleared returns if the "active_token" field was cleared in this mutation.
|
||||
func (m *UserMutation) ActiveTokenCleared() bool {
|
||||
_, ok := m.clearedFields[user.FieldActiveToken]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetActiveToken resets all changes to the "active_token" field.
|
||||
func (m *UserMutation) ResetActiveToken() {
|
||||
m.active_token = nil
|
||||
delete(m.clearedFields, user.FieldActiveToken)
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (m *UserMutation) SetCreatedAt(i int64) {
|
||||
m.created_at = &i
|
||||
@@ -30680,7 +30730,7 @@ func (m *UserMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *UserMutation) Fields() []string {
|
||||
fields := make([]string, 0, 11)
|
||||
fields := make([]string, 0, 12)
|
||||
if m.username != nil {
|
||||
fields = append(fields, user.FieldUsername)
|
||||
}
|
||||
@@ -30708,6 +30758,9 @@ func (m *UserMutation) Fields() []string {
|
||||
if m.last_login_at != nil {
|
||||
fields = append(fields, user.FieldLastLoginAt)
|
||||
}
|
||||
if m.active_token != nil {
|
||||
fields = append(fields, user.FieldActiveToken)
|
||||
}
|
||||
if m.created_at != nil {
|
||||
fields = append(fields, user.FieldCreatedAt)
|
||||
}
|
||||
@@ -30740,6 +30793,8 @@ func (m *UserMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.IsActive()
|
||||
case user.FieldLastLoginAt:
|
||||
return m.LastLoginAt()
|
||||
case user.FieldActiveToken:
|
||||
return m.ActiveToken()
|
||||
case user.FieldCreatedAt:
|
||||
return m.CreatedAt()
|
||||
case user.FieldUpdatedAt:
|
||||
@@ -30771,6 +30826,8 @@ func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, er
|
||||
return m.OldIsActive(ctx)
|
||||
case user.FieldLastLoginAt:
|
||||
return m.OldLastLoginAt(ctx)
|
||||
case user.FieldActiveToken:
|
||||
return m.OldActiveToken(ctx)
|
||||
case user.FieldCreatedAt:
|
||||
return m.OldCreatedAt(ctx)
|
||||
case user.FieldUpdatedAt:
|
||||
@@ -30847,6 +30904,13 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetLastLoginAt(v)
|
||||
return nil
|
||||
case user.FieldActiveToken:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetActiveToken(v)
|
||||
return nil
|
||||
case user.FieldCreatedAt:
|
||||
v, ok := value.(int64)
|
||||
if !ok {
|
||||
@@ -30957,6 +31021,9 @@ func (m *UserMutation) ClearedFields() []string {
|
||||
if m.FieldCleared(user.FieldLastLoginAt) {
|
||||
fields = append(fields, user.FieldLastLoginAt)
|
||||
}
|
||||
if m.FieldCleared(user.FieldActiveToken) {
|
||||
fields = append(fields, user.FieldActiveToken)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -30986,6 +31053,9 @@ func (m *UserMutation) ClearField(name string) error {
|
||||
case user.FieldLastLoginAt:
|
||||
m.ClearLastLoginAt()
|
||||
return nil
|
||||
case user.FieldActiveToken:
|
||||
m.ClearActiveToken()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown User nullable field %s", name)
|
||||
}
|
||||
@@ -31021,6 +31091,9 @@ func (m *UserMutation) ResetField(name string) error {
|
||||
case user.FieldLastLoginAt:
|
||||
m.ResetLastLoginAt()
|
||||
return nil
|
||||
case user.FieldActiveToken:
|
||||
m.ResetActiveToken()
|
||||
return nil
|
||||
case user.FieldCreatedAt:
|
||||
m.ResetCreatedAt()
|
||||
return nil
|
||||
|
||||
@@ -850,11 +850,11 @@ func init() {
|
||||
// user.DefaultIsActive holds the default value on creation for the is_active field.
|
||||
user.DefaultIsActive = userDescIsActive.Default.(bool)
|
||||
// userDescCreatedAt is the schema descriptor for created_at field.
|
||||
userDescCreatedAt := userFields[9].Descriptor()
|
||||
userDescCreatedAt := userFields[10].Descriptor()
|
||||
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
user.DefaultCreatedAt = userDescCreatedAt.Default.(func() int64)
|
||||
// userDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
userDescUpdatedAt := userFields[10].Descriptor()
|
||||
userDescUpdatedAt := userFields[11].Descriptor()
|
||||
// user.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
user.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() int64)
|
||||
zoneFields := schema.Zone{}.Fields()
|
||||
|
||||
@@ -34,6 +34,8 @@ type User struct {
|
||||
IsActive bool `json:"isActive,omitempty"`
|
||||
// 最近登录时间
|
||||
LastLoginAt int64 `json:"lastLoginAt,omitempty"`
|
||||
// 后台登录会话标识(SID),互踢用;空=无生效后台会话
|
||||
ActiveToken string `json:"activeToken,omitempty"`
|
||||
// CreatedAt holds the value of the "created_at" field.
|
||||
CreatedAt int64 `json:"createdAt,omitempty"`
|
||||
// UpdatedAt holds the value of the "updated_at" field.
|
||||
@@ -50,7 +52,7 @@ func (*User) scanValues(columns []string) ([]any, error) {
|
||||
values[i] = new(sql.NullBool)
|
||||
case user.FieldID, user.FieldRoleID, user.FieldLastLoginAt, user.FieldCreatedAt, user.FieldUpdatedAt:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case user.FieldUsername, user.FieldPassword, user.FieldRealName, user.FieldRole, user.FieldDept, user.FieldPhone:
|
||||
case user.FieldUsername, user.FieldPassword, user.FieldRealName, user.FieldRole, user.FieldDept, user.FieldPhone, user.FieldActiveToken:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
@@ -127,6 +129,12 @@ func (_m *User) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
_m.LastLoginAt = value.Int64
|
||||
}
|
||||
case user.FieldActiveToken:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field active_token", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ActiveToken = value.String
|
||||
}
|
||||
case user.FieldCreatedAt:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||
@@ -202,6 +210,9 @@ func (_m *User) String() string {
|
||||
builder.WriteString("last_login_at=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.LastLoginAt))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("active_token=")
|
||||
builder.WriteString(_m.ActiveToken)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("created_at=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.CreatedAt))
|
||||
builder.WriteString(", ")
|
||||
|
||||
@@ -29,6 +29,8 @@ const (
|
||||
FieldIsActive = "is_active"
|
||||
// FieldLastLoginAt holds the string denoting the last_login_at field in the database.
|
||||
FieldLastLoginAt = "last_login_at"
|
||||
// FieldActiveToken holds the string denoting the active_token field in the database.
|
||||
FieldActiveToken = "active_token"
|
||||
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
||||
FieldCreatedAt = "created_at"
|
||||
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
||||
@@ -49,6 +51,7 @@ var Columns = []string{
|
||||
FieldPhone,
|
||||
FieldIsActive,
|
||||
FieldLastLoginAt,
|
||||
FieldActiveToken,
|
||||
FieldCreatedAt,
|
||||
FieldUpdatedAt,
|
||||
}
|
||||
@@ -127,6 +130,11 @@ func ByLastLoginAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLastLoginAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByActiveToken orders the results by the active_token field.
|
||||
func ByActiveToken(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldActiveToken, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreatedAt orders the results by the created_at field.
|
||||
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
||||
|
||||
@@ -98,6 +98,11 @@ func LastLoginAt(v int64) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldLastLoginAt, v))
|
||||
}
|
||||
|
||||
// ActiveToken applies equality check predicate on the "active_token" field. It's identical to ActiveTokenEQ.
|
||||
func ActiveToken(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||
func CreatedAt(v int64) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldCreatedAt, v))
|
||||
@@ -638,6 +643,81 @@ func LastLoginAtNotNil() predicate.User {
|
||||
return predicate.User(sql.FieldNotNull(FieldLastLoginAt))
|
||||
}
|
||||
|
||||
// ActiveTokenEQ applies the EQ predicate on the "active_token" field.
|
||||
func ActiveTokenEQ(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// ActiveTokenNEQ applies the NEQ predicate on the "active_token" field.
|
||||
func ActiveTokenNEQ(v string) predicate.User {
|
||||
return predicate.User(sql.FieldNEQ(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// ActiveTokenIn applies the In predicate on the "active_token" field.
|
||||
func ActiveTokenIn(vs ...string) predicate.User {
|
||||
return predicate.User(sql.FieldIn(FieldActiveToken, vs...))
|
||||
}
|
||||
|
||||
// ActiveTokenNotIn applies the NotIn predicate on the "active_token" field.
|
||||
func ActiveTokenNotIn(vs ...string) predicate.User {
|
||||
return predicate.User(sql.FieldNotIn(FieldActiveToken, vs...))
|
||||
}
|
||||
|
||||
// ActiveTokenGT applies the GT predicate on the "active_token" field.
|
||||
func ActiveTokenGT(v string) predicate.User {
|
||||
return predicate.User(sql.FieldGT(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// ActiveTokenGTE applies the GTE predicate on the "active_token" field.
|
||||
func ActiveTokenGTE(v string) predicate.User {
|
||||
return predicate.User(sql.FieldGTE(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// ActiveTokenLT applies the LT predicate on the "active_token" field.
|
||||
func ActiveTokenLT(v string) predicate.User {
|
||||
return predicate.User(sql.FieldLT(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// ActiveTokenLTE applies the LTE predicate on the "active_token" field.
|
||||
func ActiveTokenLTE(v string) predicate.User {
|
||||
return predicate.User(sql.FieldLTE(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// ActiveTokenContains applies the Contains predicate on the "active_token" field.
|
||||
func ActiveTokenContains(v string) predicate.User {
|
||||
return predicate.User(sql.FieldContains(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// ActiveTokenHasPrefix applies the HasPrefix predicate on the "active_token" field.
|
||||
func ActiveTokenHasPrefix(v string) predicate.User {
|
||||
return predicate.User(sql.FieldHasPrefix(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// ActiveTokenHasSuffix applies the HasSuffix predicate on the "active_token" field.
|
||||
func ActiveTokenHasSuffix(v string) predicate.User {
|
||||
return predicate.User(sql.FieldHasSuffix(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// ActiveTokenIsNil applies the IsNil predicate on the "active_token" field.
|
||||
func ActiveTokenIsNil() predicate.User {
|
||||
return predicate.User(sql.FieldIsNull(FieldActiveToken))
|
||||
}
|
||||
|
||||
// ActiveTokenNotNil applies the NotNil predicate on the "active_token" field.
|
||||
func ActiveTokenNotNil() predicate.User {
|
||||
return predicate.User(sql.FieldNotNull(FieldActiveToken))
|
||||
}
|
||||
|
||||
// ActiveTokenEqualFold applies the EqualFold predicate on the "active_token" field.
|
||||
func ActiveTokenEqualFold(v string) predicate.User {
|
||||
return predicate.User(sql.FieldEqualFold(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// ActiveTokenContainsFold applies the ContainsFold predicate on the "active_token" field.
|
||||
func ActiveTokenContainsFold(v string) predicate.User {
|
||||
return predicate.User(sql.FieldContainsFold(FieldActiveToken, v))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
func CreatedAtEQ(v int64) predicate.User {
|
||||
return predicate.User(sql.FieldEQ(FieldCreatedAt, v))
|
||||
|
||||
@@ -131,6 +131,20 @@ func (_c *UserCreate) SetNillableLastLoginAt(v *int64) *UserCreate {
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetActiveToken sets the "active_token" field.
|
||||
func (_c *UserCreate) SetActiveToken(v string) *UserCreate {
|
||||
_c.mutation.SetActiveToken(v)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetNillableActiveToken sets the "active_token" field if the given value is not nil.
|
||||
func (_c *UserCreate) SetNillableActiveToken(v *string) *UserCreate {
|
||||
if v != nil {
|
||||
_c.SetActiveToken(*v)
|
||||
}
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (_c *UserCreate) SetCreatedAt(v int64) *UserCreate {
|
||||
_c.mutation.SetCreatedAt(v)
|
||||
@@ -295,6 +309,10 @@ func (_c *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(user.FieldLastLoginAt, field.TypeInt64, value)
|
||||
_node.LastLoginAt = value
|
||||
}
|
||||
if value, ok := _c.mutation.ActiveToken(); ok {
|
||||
_spec.SetField(user.FieldActiveToken, field.TypeString, value)
|
||||
_node.ActiveToken = value
|
||||
}
|
||||
if value, ok := _c.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(user.FieldCreatedAt, field.TypeInt64, value)
|
||||
_node.CreatedAt = value
|
||||
@@ -505,6 +523,24 @@ func (u *UserUpsert) ClearLastLoginAt() *UserUpsert {
|
||||
return u
|
||||
}
|
||||
|
||||
// SetActiveToken sets the "active_token" field.
|
||||
func (u *UserUpsert) SetActiveToken(v string) *UserUpsert {
|
||||
u.Set(user.FieldActiveToken, v)
|
||||
return u
|
||||
}
|
||||
|
||||
// UpdateActiveToken sets the "active_token" field to the value that was provided on create.
|
||||
func (u *UserUpsert) UpdateActiveToken() *UserUpsert {
|
||||
u.SetExcluded(user.FieldActiveToken)
|
||||
return u
|
||||
}
|
||||
|
||||
// ClearActiveToken clears the value of the "active_token" field.
|
||||
func (u *UserUpsert) ClearActiveToken() *UserUpsert {
|
||||
u.SetNull(user.FieldActiveToken)
|
||||
return u
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (u *UserUpsert) SetCreatedAt(v int64) *UserUpsert {
|
||||
u.Set(user.FieldCreatedAt, v)
|
||||
@@ -756,6 +792,27 @@ func (u *UserUpsertOne) ClearLastLoginAt() *UserUpsertOne {
|
||||
})
|
||||
}
|
||||
|
||||
// SetActiveToken sets the "active_token" field.
|
||||
func (u *UserUpsertOne) SetActiveToken(v string) *UserUpsertOne {
|
||||
return u.Update(func(s *UserUpsert) {
|
||||
s.SetActiveToken(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateActiveToken sets the "active_token" field to the value that was provided on create.
|
||||
func (u *UserUpsertOne) UpdateActiveToken() *UserUpsertOne {
|
||||
return u.Update(func(s *UserUpsert) {
|
||||
s.UpdateActiveToken()
|
||||
})
|
||||
}
|
||||
|
||||
// ClearActiveToken clears the value of the "active_token" field.
|
||||
func (u *UserUpsertOne) ClearActiveToken() *UserUpsertOne {
|
||||
return u.Update(func(s *UserUpsert) {
|
||||
s.ClearActiveToken()
|
||||
})
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (u *UserUpsertOne) SetCreatedAt(v int64) *UserUpsertOne {
|
||||
return u.Update(func(s *UserUpsert) {
|
||||
@@ -1177,6 +1234,27 @@ func (u *UserUpsertBulk) ClearLastLoginAt() *UserUpsertBulk {
|
||||
})
|
||||
}
|
||||
|
||||
// SetActiveToken sets the "active_token" field.
|
||||
func (u *UserUpsertBulk) SetActiveToken(v string) *UserUpsertBulk {
|
||||
return u.Update(func(s *UserUpsert) {
|
||||
s.SetActiveToken(v)
|
||||
})
|
||||
}
|
||||
|
||||
// UpdateActiveToken sets the "active_token" field to the value that was provided on create.
|
||||
func (u *UserUpsertBulk) UpdateActiveToken() *UserUpsertBulk {
|
||||
return u.Update(func(s *UserUpsert) {
|
||||
s.UpdateActiveToken()
|
||||
})
|
||||
}
|
||||
|
||||
// ClearActiveToken clears the value of the "active_token" field.
|
||||
func (u *UserUpsertBulk) ClearActiveToken() *UserUpsertBulk {
|
||||
return u.Update(func(s *UserUpsert) {
|
||||
s.ClearActiveToken()
|
||||
})
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (u *UserUpsertBulk) SetCreatedAt(v int64) *UserUpsertBulk {
|
||||
return u.Update(func(s *UserUpsert) {
|
||||
|
||||
@@ -197,6 +197,26 @@ func (_u *UserUpdate) ClearLastLoginAt() *UserUpdate {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetActiveToken sets the "active_token" field.
|
||||
func (_u *UserUpdate) SetActiveToken(v string) *UserUpdate {
|
||||
_u.mutation.SetActiveToken(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableActiveToken sets the "active_token" field if the given value is not nil.
|
||||
func (_u *UserUpdate) SetNillableActiveToken(v *string) *UserUpdate {
|
||||
if v != nil {
|
||||
_u.SetActiveToken(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearActiveToken clears the value of the "active_token" field.
|
||||
func (_u *UserUpdate) ClearActiveToken() *UserUpdate {
|
||||
_u.mutation.ClearActiveToken()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (_u *UserUpdate) SetCreatedAt(v int64) *UserUpdate {
|
||||
_u.mutation.ResetCreatedAt()
|
||||
@@ -328,6 +348,12 @@ func (_u *UserUpdate) sqlSave(ctx context.Context) (_node int, err error) {
|
||||
if _u.mutation.LastLoginAtCleared() {
|
||||
_spec.ClearField(user.FieldLastLoginAt, field.TypeInt64)
|
||||
}
|
||||
if value, ok := _u.mutation.ActiveToken(); ok {
|
||||
_spec.SetField(user.FieldActiveToken, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.ActiveTokenCleared() {
|
||||
_spec.ClearField(user.FieldActiveToken, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(user.FieldCreatedAt, field.TypeInt64, value)
|
||||
}
|
||||
@@ -530,6 +556,26 @@ func (_u *UserUpdateOne) ClearLastLoginAt() *UserUpdateOne {
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetActiveToken sets the "active_token" field.
|
||||
func (_u *UserUpdateOne) SetActiveToken(v string) *UserUpdateOne {
|
||||
_u.mutation.SetActiveToken(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableActiveToken sets the "active_token" field if the given value is not nil.
|
||||
func (_u *UserUpdateOne) SetNillableActiveToken(v *string) *UserUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetActiveToken(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearActiveToken clears the value of the "active_token" field.
|
||||
func (_u *UserUpdateOne) ClearActiveToken() *UserUpdateOne {
|
||||
_u.mutation.ClearActiveToken()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (_u *UserUpdateOne) SetCreatedAt(v int64) *UserUpdateOne {
|
||||
_u.mutation.ResetCreatedAt()
|
||||
@@ -691,6 +737,12 @@ func (_u *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) {
|
||||
if _u.mutation.LastLoginAtCleared() {
|
||||
_spec.ClearField(user.FieldLastLoginAt, field.TypeInt64)
|
||||
}
|
||||
if value, ok := _u.mutation.ActiveToken(); ok {
|
||||
_spec.SetField(user.FieldActiveToken, field.TypeString, value)
|
||||
}
|
||||
if _u.mutation.ActiveTokenCleared() {
|
||||
_spec.ClearField(user.FieldActiveToken, field.TypeString)
|
||||
}
|
||||
if value, ok := _u.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(user.FieldCreatedAt, field.TypeInt64, value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user