This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
/
player_profile_card.go
50 lines (42 loc) · 1.86 KB
/
player_profile_card.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package models
import (
"database/sql"
d2pb "github.com/paralin/go-dota2/protocol"
nspb "github.com/13k/night-stalker/internal/protobuf/protocol"
nssql "github.com/13k/night-stalker/internal/sql"
)
var PlayerProfileCardModel Model = (*PlayerProfileCard)(nil)
type PlayerProfileCardID uint64
type PlayerProfileCard struct {
ID PlayerProfileCardID `gorm:"column:id;primary_key"`
AccountID nspb.AccountID `gorm:"column:account_id;unique_index;not null"`
BadgePoints uint32 `gorm:"column:badge_points"`
LeaderboardRank uint32 `gorm:"column:leaderboard_rank"`
RankTier uint32 `gorm:"column:rank_tier"`
RankTierScore uint32 `gorm:"column:rank_tier_score"`
RankTierMMRType uint32 `gorm:"column:rank_tier_mmr_type"`
PreviousRankTier uint32 `gorm:"column:previous_rank_tier"`
IsPlusSubscriber bool `gorm:"column:is_plus_subscriber"`
PlusStartAt sql.NullTime `gorm:"column:plus_start_at"`
EventID uint32 `gorm:"column:event_id"`
EventPoints uint32 `gorm:"column:event_points"`
Timestamps
}
func (*PlayerProfileCard) TableName() string {
return "player_profile_cards"
}
func PlayerProfileCardProto(pb *d2pb.CMsgDOTAProfileCard) *PlayerProfileCard {
return &PlayerProfileCard{
AccountID: nspb.AccountID(pb.GetAccountId()),
BadgePoints: pb.GetBadgePoints(),
EventPoints: pb.GetEventPoints(),
EventID: pb.GetEventId(),
RankTier: pb.GetRankTier(),
LeaderboardRank: pb.GetLeaderboardRank(),
RankTierScore: pb.GetRankTierScore(),
PreviousRankTier: pb.GetPreviousRankTier(),
RankTierMMRType: pb.GetRankTierMmrType(),
IsPlusSubscriber: pb.GetIsPlusSubscriber(),
PlusStartAt: nssql.NullTimeUnix(int64(pb.GetPlusOriginalStartDate())),
}
}