65 lines
2.7 KiB
Go
65 lines
2.7 KiB
Go
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
|
|
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
|
|
// Code generated by go.ipao.vip/gen. DO NOT EDIT.
|
|
|
|
package models
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"go.ipao.vip/gen"
|
|
)
|
|
|
|
const TableNameTenantJoinRequest = "tenant_join_requests"
|
|
|
|
// TenantJoinRequest mapped from table <tenant_join_requests>
|
|
type TenantJoinRequest struct {
|
|
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
|
|
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null" json:"tenant_id"`
|
|
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
|
|
Status string `gorm:"column:status;type:character varying(32);default:pending" json:"status"`
|
|
Reason string `gorm:"column:reason;type:character varying(255);not null" json:"reason"`
|
|
DecidedAt time.Time `gorm:"column:decided_at;type:timestamp with time zone" json:"decided_at"`
|
|
DecidedOperatorUserID int64 `gorm:"column:decided_operator_user_id;type:bigint" json:"decided_operator_user_id"`
|
|
DecidedReason string `gorm:"column:decided_reason;type:character varying(255)" json:"decided_reason"`
|
|
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;default:now()" json:"updated_at"`
|
|
}
|
|
|
|
// Quick operations without importing query package
|
|
// Update applies changed fields to the database using the default DB.
|
|
func (m *TenantJoinRequest) Update(ctx context.Context) (gen.ResultInfo, error) {
|
|
return Q.TenantJoinRequest.WithContext(ctx).Updates(m)
|
|
}
|
|
|
|
// Save upserts the model using the default DB.
|
|
func (m *TenantJoinRequest) Save(ctx context.Context) error {
|
|
return Q.TenantJoinRequest.WithContext(ctx).Save(m)
|
|
}
|
|
|
|
// Create inserts the model using the default DB.
|
|
func (m *TenantJoinRequest) Create(ctx context.Context) error {
|
|
return Q.TenantJoinRequest.WithContext(ctx).Create(m)
|
|
}
|
|
|
|
// Delete removes the row represented by the model using the default DB.
|
|
func (m *TenantJoinRequest) Delete(ctx context.Context) (gen.ResultInfo, error) {
|
|
return Q.TenantJoinRequest.WithContext(ctx).Delete(m)
|
|
}
|
|
|
|
// ForceDelete permanently deletes the row (ignores soft delete) using the default DB.
|
|
func (m *TenantJoinRequest) ForceDelete(ctx context.Context) (gen.ResultInfo, error) {
|
|
return Q.TenantJoinRequest.WithContext(ctx).Unscoped().Delete(m)
|
|
}
|
|
|
|
// Reload reloads the model from database by its primary key and overwrites current fields.
|
|
func (m *TenantJoinRequest) Reload(ctx context.Context) error {
|
|
fresh, err := Q.TenantJoinRequest.WithContext(ctx).GetByID(m.ID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*m = *fresh
|
|
return nil
|
|
}
|