seven-technologies-cloud / pythonrest

Creative Commons Zero v1.0 Universal
10 stars 4 forks source link

Add a count only query param #29

Open leo-viana opened 9 months ago

leo-viana commented 9 months ago

Goal

Create a count only param, which will return the total amount of entries on a given table.

Description

There are cases where returning the count of the entries of the table would be pretty useful, fetching a result like the below:

[
  {
    "id_user": 1,
    "username": "user1"
   },
  {
    "id_user": 2,
    "username": "user2"
  },
  {
    "id_user": 3,
    "username": "user3"
   },
  {
    "id_user": 4,
    "username": "user4"
  }
]

Requires that a code that consumes the API create a function to count all of those results, which would not be necessary with a count only param for that matter.