diff options
Diffstat (limited to 'xp/member.go')
| -rw-r--r-- | xp/member.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/xp/member.go b/xp/member.go index 578e533..280b9e0 100644 --- a/xp/member.go +++ b/xp/member.go @@ -10,13 +10,18 @@ import ( type Copaing struct { gorm.Model - DiscordID string - XP uint - GuildID string + DiscordID string `gorm:"not null"` + XP uint `gorm:"default:0"` + GuildID string `gorm:"not null"` } var r *redis.Client +func GetCopaing(discordID string, guildID string) *Copaing { + c := Copaing{DiscordID: discordID, GuildID: guildID} + return c.Load() +} + func (c *Copaing) Load() *Copaing { gokord.DB.Where("discord_id = ? and guild_id = ?", c.DiscordID, c.GuildID).FirstOrCreate(c) return c |
