39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
|
|
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.hlsq.asia/mmorpg/service-common/utils"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
const TableNamePointCard = "point_card"
|
|
|
|
// PointCard mapped from table <point_card>
|
|
type PointCard struct {
|
|
ID uint64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
|
Sn int64 `gorm:"column:sn;not null;comment:业务唯一编号" json:"sn"` // 业务唯一编号
|
|
UserSn int64 `gorm:"column:user_sn;not null;comment:用户-唯一编号" json:"user_sn"` // 用户-唯一编号
|
|
Point int64 `gorm:"column:point;not null;comment:积分" json:"point"` // 积分
|
|
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
|
}
|
|
|
|
// TableName PointCard's table name
|
|
func (*PointCard) TableName() string {
|
|
return TableNamePointCard
|
|
}
|
|
|
|
// Auto sn
|
|
func (m *PointCard) BeforeCreate(_ *gorm.DB) error {
|
|
if m.Sn == 0 {
|
|
m.Sn = utils.SnowflakeInstance().Generate().Int64()
|
|
}
|
|
return nil
|
|
}
|