{"id":17002284,"url":"https://github.com/bxcodec/go-postgres-pagination-example","last_synced_at":"2025-06-13T11:08:11.910Z","repository":{"id":46299998,"uuid":"266020541","full_name":"bxcodec/go-postgres-pagination-example","owner":"bxcodec","description":"An example project for pagination in Postgres with Golang ","archived":false,"fork":false,"pushed_at":"2021-10-29T15:02:49.000Z","size":11371,"stargazers_count":69,"open_issues_count":1,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-27T09:11:41.615Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bxcodec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-22T04:47:53.000Z","updated_at":"2024-11-28T07:12:27.000Z","dependencies_parsed_at":"2022-09-06T15:10:49.635Z","dependency_job_id":null,"html_url":"https://github.com/bxcodec/go-postgres-pagination-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bxcodec%2Fgo-postgres-pagination-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bxcodec%2Fgo-postgres-pagination-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bxcodec%2Fgo-postgres-pagination-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bxcodec%2Fgo-postgres-pagination-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bxcodec","download_url":"https://codeload.github.com/bxcodec/go-postgres-pagination-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244931630,"owners_count":20534012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T04:27:32.581Z","updated_at":"2025-03-22T09:18:24.110Z","avatar_url":"https://github.com/bxcodec.png","language":"PLpgSQL","readme":"# go-postgres-pagination-example\nAn example project for pagination in Postgres with Golang \n\n\nThis repostiory based on this article https://medium.com/easyread/how-to-do-pagination-in-postgres-with-golang-in-4-common-ways-12365b9fb528\n\n### Pagination List \n \n - Offset based pagination\n    - [Using Page Number](/pagenumber)\n    - [Using Limit and Offset Query Param](/offsetlimit)\n - Cursor based pagination\n    - [Using auto-increment ID](/autoincrementid)\n    - [Using keyset, (uuid + created_time)](/uuidcreatedtime) \n\n\n### Run all the applications\n\n```bash\n$ make run\n\n$ docker ps\n# ensure all the API is running\nCONTAINER ID        IMAGE                                            COMMAND                  CREATED             STATUS                       PORTS                    NAMES\n0671922c90ab        postgres-pagination_offset-limit                 \"/bin/sh -c /app/ole…\"   14 minutes ago      Up 14 minutes                0.0.0.0:9092-\u003e9090/tcp   payment-with-offset-limit\n5ee034203ad1        postgres-pagination_page-number                  \"/bin/sh -c /app/pne…\"   14 minutes ago      Up 14 minutes                0.0.0.0:9094-\u003e9090/tcp   payment-with-page-number\n78a82fbc7815        postgres-pagination_uuid-created-time            \"/bin/sh -c /app/uce…\"   14 minutes ago      Up 14 minutes                0.0.0.0:9093-\u003e9090/tcp   payment-with-uuid-created-time\n4a83359ac88e        postgres-pagination_auto-increment               \"/bin/sh -c /app/aie…\"   14 minutes ago      Up 14 minutes                0.0.0.0:9091-\u003e9090/tcp   payment-with-auto-increment-id\ne46c1c6d299b        postgres-pagination_postgres-page-number         \"docker-entrypoint.s…\"   33 minutes ago      Up 33 minutes (healthy)      5432/tcp                 payment-with-page-number-db\nfea94d4b92ef        postgres-pagination_postgres-uuid-created-time   \"docker-entrypoint.s…\"   About an hour ago   Up About an hour (healthy)   5432/tcp                 payment-with-uuid-created-time-db\n9380e111c0eb        postgres-pagination_postgres-offset-limit        \"docker-entrypoint.s…\"   About an hour ago   Up About an hour (healthy)   5432/tcp                 payment-with-offset-limit-db\n68c90b610f54        postgres-pagination_postgres-auto-increment      \"docker-entrypoint.s…\"   About an hour ago   Up About an hour (healthy)   5432/tcp                 payment-with-auto-increment-id-db\n```\n\nCall the API based on the opened port,\n\n```bash\n$ curl locahost:9091/payments\n$ curl locahost:9092/payments\n$ curl locahost:9093/payments\n$ curl locahost:9094/payments\n```\n\n### Run Benchmark\n\nTo run benchmark for each pagination method, \n\n```bash\n$ cd to_each_directory\n\n$ make benchmark\n```\n\nExample,\n\n```bash\n$ cd pagenumber\n$ make benchmark\n```\n\n### Benchmark Result\n\n![Benchmark Result](./benchmark.png)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbxcodec%2Fgo-postgres-pagination-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbxcodec%2Fgo-postgres-pagination-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbxcodec%2Fgo-postgres-pagination-example/lists"}