Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Conn *gorm.DB
定义全局 DB 连接
Functions ¶
func UpdateVoteCount ¶
UpdateVoteCount 更新 VoteOpt 表计数器
Types ¶
type User ¶
type User struct { Id int64 `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL" form:"id" json:"id"` Name string `gorm:"column:name;default:NULL" form:"name" json:"name"` Password string `gorm:"column:password;default:NULL" form:"password" json:"password"` CreatedTime time.Time `gorm:"column:created_time;default:NULL" form:"createdTime" json:"createdTime"` UpdatedTime time.Time `gorm:"column:updated_time;default:NULL" form:"updatedTime" json:"updatedTime"` }
func GetUser ¶
GetUser 查询用户数据 https://gorm.io/docs/query.html
type Vote ¶
type Vote struct { Id int64 `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"` Title string `gorm:"column:title;default:NULL"` Type int32 `gorm:"column:type;default:NULL;comment:'0 for single, 1 for multiple choice'"` Status int32 `gorm:"column:status;default:NULL;comment:'0 for normal, 1 for expired'"` UserId int64 `gorm:"column:user_id;default:NULL;comment:'who created'"` ExpiredIn int64 `gorm:"column:expired_in;default:NULL"` CreatedTime time.Time `gorm:"column:created_time;default:NULL"` UpdatedTime time.Time `gorm:"column:updated_time;default:NULL"` }
type VoteOpt ¶
type VoteOpt struct { Id int64 `gorm:"column:id;primary_key;AUTO_INCREMENT;NOT NULL"` Name string `gorm:"column:name;default:NULL;comment:'选项名称'"` Count int32 `gorm:"column:count;default:NULL;comment:'选项投票计数器'"` VoteId int64 `gorm:"column:vote_id;default:NULL;comment:'绑定到的投票单'"` CreatedTime time.Time `gorm:"column:created_time;default:NULL"` UpdatedTime time.Time `gorm:"column:updated_time;default:NULL"` }
func GetVoteOptsByVoteId ¶
GetVoteOptsByVoteId 根据投票 ID 查询选项
type VoteOptUser ¶
type VoteOptUser struct { Id int64 `gorm:"column:id;primary_key;NOT NULL"` VoteId int64 `gorm:"column:vote_id;default:NULL;comment:'表单ID'"` UserId int64 `gorm:"column:user_id;default:NULL;comment:'投票用户ID'"` VoteOptId int64 `gorm:"column:vote_opt_id;default:NULL;comment:'选项ID'"` CreatedTime time.Time `gorm:"column:created_time;default:NULL"` UpdatedTime time.Time `gorm:"column:updated_time;default:NULL"` }
func (*VoteOptUser) TableName ¶
func (v *VoteOptUser) TableName() string
Click to show internal directories.
Click to hide internal directories.