From f71a43e1a4cf2fba8a479842d0a61e24017cd87b Mon Sep 17 00:00:00 2001 From: GrailFinder Date: Sun, 14 Apr 2024 09:11:15 +0300 Subject: Feat: db methods and their usage --- internal/models/models.go | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'internal/models') diff --git a/internal/models/models.go b/internal/models/models.go index a2b3628..bd38eaf 100644 --- a/internal/models/models.go +++ b/internal/models/models.go @@ -11,19 +11,22 @@ const ( type ( UserScore struct { - Username string - Actions []*Action - BurnTime time.Time - Score int8 + ID uint32 `db:"id"` + Username string `db:"username"` + Actions []Action + BurnTime time.Time `db:"burn_time"` + Score int8 `db:"score"` + CreatedAt time.Time `db:"created_at"` } Action struct { - ID uint32 - Name string - Magnitude uint8 - Repeatable bool - Type ActionType - Done bool - Username string + ID uint32 `db:"id"` + Name string `db:"name"` + Magnitude uint8 `db:"magnitude"` + Repeatable bool `db:"repeatable"` + Type ActionType `db:"type"` + Done bool `db:"done"` + Username string `db:"username"` + CreatedAt time.Time `db:"created_at"` } ) -- cgit v1.2.3