diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2024-02-22 22:59:53 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2024-02-22 23:15:41 +0100 |
commit | cd1a6cbd06d3b75adf708fcd2a7974bf94452248 (patch) | |
tree | e41f7bb1cbda499837943fcb5eedfa0f61b2adff /model/models.go | |
parent | 9a97638e0ddd7fbc135c63d7e9055529313ddb3c (diff) | |
download | gosten-cd1a6cbd06d3b75adf708fcd2a7974bf94452248.tar.gz gosten-cd1a6cbd06d3b75adf708fcd2a7974bf94452248.tar.bz2 gosten-cd1a6cbd06d3b75adf708fcd2a7974bf94452248.zip |
Switch from mysql to postgres
Diffstat (limited to 'model/models.go')
-rw-r--r-- | model/models.go | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/model/models.go b/model/models.go index be09076..eba1207 100644 --- a/model/models.go +++ b/model/models.go @@ -5,36 +5,35 @@ package model import ( - "database/sql" - "time" + "github.com/jackc/pgx/v5/pgtype" ) type Category struct { ID int32 Name string - ParentID sql.NullInt32 + ParentID pgtype.Int4 UserID int32 } type ConstExpense struct { ID int32 - Description sql.NullString - Expense string - Months uint8 - Start time.Time - End time.Time - PrevID sql.NullInt32 + Description pgtype.Text + Expense pgtype.Numeric + Months int16 + Start pgtype.Date + End pgtype.Date + PrevID pgtype.Int4 CategoryID int32 UserID int32 } type SingleExpense struct { - ID int32 - Description sql.NullString - Expense string - Year uint16 - Month uint8 - Day uint8 + ID int64 + Description pgtype.Text + Expense pgtype.Numeric + Year int16 + Month int16 + Day int16 CategoryID int32 UserID int32 } @@ -43,5 +42,5 @@ type User struct { ID int32 Name string Pwd string - Description sql.NullString + Description pgtype.Text } |