feat: upgrade mod
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
vaalacat
2024-04-23 11:30:28 +00:00
parent 75944abbc2
commit e39db56969
7 changed files with 34 additions and 12 deletions

View File

@@ -9,9 +9,9 @@ import (
type User struct {
gorm.Model
TGID int64 `gorm:"unique"`
MCName string
Status int // 0: pending, 1: normal, 2: banned
TGID int64 `gorm:"column:tgid;NOT NULL;index"`
MCName string `gorm:"column:mc_name;NOT NULL;unique"`
Status int `gorm:"column:status;NOT NULL"` // 0: pending, 1: normal, 2: banned
}
func init() {
@@ -24,6 +24,13 @@ func (u *User) TableName() string {
return "users"
}
func GetUsersByTGID(tgID int64) (users []User, err error) {
err = database.GetDB().Where(
&User{TGID: tgID},
).Find(&users).Error
return
}
func GetUserByTGID(tgID int64) (user User, err error) {
err = database.GetDB().Where(
&User{TGID: tgID},