From cd1a6cbd06d3b75adf708fcd2a7974bf94452248 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 22 Feb 2024 22:59:53 +0100 Subject: Switch from mysql to postgres --- model/models.go | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'model/models.go') 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 } -- cgit v1.2.3-70-g09d2