fix: Change UpdatedAt data type to allow nullable values
This commit is contained in:
@@ -173,6 +173,7 @@ func getAllTasks() ([]models.Task, error) {
|
||||
SELECT id, text, completed, created_at, updated_at
|
||||
FROM tasks
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 1000
|
||||
`
|
||||
|
||||
rows, err := pool.Query(ctx, sql)
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
// "github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
type Task struct {
|
||||
Id int `json:"id"`
|
||||
Text string `json:"text"`
|
||||
Completed bool `json:"completed"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
Id int `json:"id"`
|
||||
Text string `json:"text"`
|
||||
Completed bool `json:"completed"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
// UpdatedAt pgtype.Timestamptz `json:"updated_at"` /* evaluar la posibilidad de utilizarlo */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user