{"id":15533441,"url":"https://github.com/datek/gopaq","last_synced_at":"2026-05-13T02:12:32.736Z","repository":{"id":64646192,"uuid":"576924310","full_name":"DAtek/gopaq","owner":"DAtek","description":"Limit-offset pagination for GORM queries.","archived":false,"fork":false,"pushed_at":"2024-01-22T19:13:00.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T10:59:20.104Z","etag":null,"topics":["gorm","pagination","query"],"latest_commit_sha":null,"homepage":"","language":"Go","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/DAtek.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-11T12:41:25.000Z","updated_at":"2024-09-20T11:21:25.000Z","dependencies_parsed_at":"2024-06-20T04:17:51.921Z","dependency_job_id":"2c4263f1-97ad-46b6-8ebd-0ec1edf7e89f","html_url":"https://github.com/DAtek/gopaq","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAtek%2Fgopaq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAtek%2Fgopaq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAtek%2Fgopaq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DAtek%2Fgopaq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DAtek","download_url":"https://codeload.github.com/DAtek/gopaq/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241801194,"owners_count":20022383,"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":["gorm","pagination","query"],"created_at":"2024-10-02T11:37:01.303Z","updated_at":"2026-05-13T02:12:32.696Z","avatar_url":"https://github.com/DAtek.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![codecov](https://codecov.io/gh/DAtek/gopaq/graph/badge.svg?token=WWY2L6G56Y)](https://codecov.io/gh/DAtek/gopaq)\n\n# GOPAQ - Gorm Paginated Query\n\nLimit-offset pagination for [GORM](https://gorm.io/) queries.\n\n\n## Example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/DAtek/gopaq\"\n\t\"gorm.io/driver/postgres\"\n\t\"gorm.io/gorm\"\n\t\"gorm.io/gorm/schema\"\n)\n\n\ntype Plant struct {\n\tId   uint\n\tType string\n\tName string\n}\n\n// You have to implement this function\nfunc getSession() *gorm.DB {\n    return nil\n}\n\nfunc main() {\n\tsession := getSession()\n\n\tfor i := 0; i \u003c 10; i++ {\n\t\tsession.Create(\u0026Plant{})\n\t}\n\n\tplant1 := \u0026Plant{Name: \"Banana\"}\n\tsession.Create(plant1)\n\n\tplant2 := \u0026Plant{Name: \"Apple\"}\n\tsession.Create(plant2)\n\n\tquery := session.Model(\u0026Plant{}).Order(\"name DESC\")\n\tresult, _ := gopaq.FindWithPagination(query, []*Plant{}, 1, 2)\n\n\tfmt.Printf(\"plant1: %v\\n\", result.Items[0])\n\tfmt.Printf(\"plant2: %v\\n\", result.Items[1])\n\tfmt.Printf(\"returned items: %v\\n\", len(result.Items))\n\tfmt.Printf(\"total: %v\\n\", result.Total)\n}\n\n```\nOutput:\n```\nplant1: \u0026{11  Banana}\nplant2: \u0026{12  Apple}\nreturned items: 2\ntotal: 12\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatek%2Fgopaq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatek%2Fgopaq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatek%2Fgopaq/lists"}