Skip to content

Commit

Permalink
return empty slice instead of null when there is no activity
Browse files Browse the repository at this point in the history
  • Loading branch information
JLL32 committed Aug 13, 2024
1 parent 1c07206 commit 0de93ce
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion internal/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (db *DB) Query(ctx context.Context, statement string,
return err
}

var rows []interface{}
rows := []interface{}{}
for results.Next() {
var row interface{}
err := results.Row(&row)
Expand Down
3 changes: 0 additions & 3 deletions internal/user/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,6 @@ func (s service) Activities(ctx context.Context, id string, offset, limit int) (
if err != nil {
return nil, err
}
// if len(result) == 0 {
// return make([]interface{}, 0), nil
// }
return result, nil
}

Expand Down

0 comments on commit 0de93ce

Please sign in to comment.