make() lists and items, so having no lists and no items returns [] instead of nil #24

Merged
robin merged 1 commits from dev into main 2026-08-22 21:47:20 +02:00
Showing only changes of commit c677b71a7a - Show all commits
+2 -2
View File
@@ -81,7 +81,7 @@ func (r *ListRepo) GetLists(ctx context.Context, userID string) ([]domain.List,
}
defer rows.Close()
var lists []domain.List
lists := make([]domain.List, 0, 16)
for rows.Next() {
var l domain.List
err = rows.Scan(&l.ID, &l.Name, &l.CreatedAt, &l.ModifiedAt, &l.TotalItems, &l.CompletedItems)
@@ -206,7 +206,7 @@ func (r *ListRepo) GetListItems(ctx context.Context, listID string) ([]domain.Li
}
defer rows.Close()
var items []domain.ListItem
items := make([]domain.ListItem, 0, 32)
for rows.Next() {
var l domain.ListItem
err = rows.Scan(&l.ID, &l.Title, &l.IsCompleted, &l.CreatedAt, &l.ModifiedAt)