{"id":40078514,"url":"https://github.com/humweb/go-tables","last_synced_at":"2026-01-19T09:03:56.872Z","repository":{"id":219662138,"uuid":"749577562","full_name":"humweb/go-tables","owner":"humweb","description":"Companion backend written in go for inertia-vue-tables","archived":false,"fork":false,"pushed_at":"2024-06-17T13:32:08.000Z","size":704,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-21T16:57:47.951Z","etag":null,"topics":["database","inertiajs","tables","vue"],"latest_commit_sha":null,"homepage":"https://humweb.github.io/go-table-docs/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/humweb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2024-01-29T00:31:57.000Z","updated_at":"2024-06-03T17:54:29.000Z","dependencies_parsed_at":"2024-01-29T02:30:16.309Z","dependency_job_id":"f957cb71-4a2c-4628-ac8a-cd5bc3bdde42","html_url":"https://github.com/humweb/go-tables","commit_stats":null,"previous_names":["humweb/go-tables"],"tags_count":7,"template":false,"template_full_name":"golang-templates/seed","purl":"pkg:github/humweb/go-tables","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humweb%2Fgo-tables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humweb%2Fgo-tables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humweb%2Fgo-tables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humweb%2Fgo-tables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/humweb","download_url":"https://codeload.github.com/humweb/go-tables/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humweb%2Fgo-tables/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28565001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["database","inertiajs","tables","vue"],"created_at":"2026-01-19T09:03:56.792Z","updated_at":"2026-01-19T09:03:56.866Z","avatar_url":"https://github.com/humweb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Tables backend for Inertia Vue Table\n\n[![GitHub Release](https://img.shields.io/github/v/release/humweb/go-tables)](https://github.com/humweb/go-tables/releases)\n[![Go Reference](https://pkg.go.dev/badge/github.com/humweb/go-tables.svg)](https://pkg.go.dev/github.com/humweb/go-tables)\n[![go.mod](https://img.shields.io/github/go-mod/go-version/humweb/go-tables)](go.mod)\n[![LICENSE](https://img.shields.io/github/license/humweb/go-tables)](LICENSE)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/humweb/go-tables/build.yml?branch=main)](https://github.com/humweb/go-tables/actions?query=workflow%3Abuild+branch%3Amain)\n[![Go Report Card](https://goreportcard.com/badge/github.com/humweb/go-tables)](https://goreportcard.com/report/github.com/humweb/go-tables)\n[![Codecov](https://codecov.io/gh/humweb/go-tables/branch/main/graph/badge.svg)](https://codecov.io/gh/humweb/go-tables)\n\n⭐ `Star` this repository if you find it valuable and worth maintaining.\n\n👁 `Watch` this repository to get notified about new releases, issues, etc.\n\n## Description\n\nCompanion backend for [inertia-vue-tables](https://humweb.github.io/inertia-vue-table/guide/getting-started.html)\n\nExample App https://github.com/humweb/inertia-go-vue-example\n\n**Features**\n* Custom filters\n* Field Search\n* Global Search\n* Column Sorting\n* Eager load relationships\n* Length Aware Pagination\n* Record limit per page\n\n## Preview\n\u003cimg src=\".github/img/preview.png\"\u003e\n\n\u003cbr\u003e\n\n\n## Example Resource\n\n```go\npackage tables\n\nimport (\n\t\"gorm.io/gorm\"\n\t\"net/http\"\n\t\"strconv\"\n)\n\ntype UserResource struct {\n\tAbstractResource\n}\n\nfunc NewUserResource(db *gorm.DB, req *http.Request) *UserResource {\n    r := \u0026UserResource{\n            AbstractResource{\n            Db:              db,\n            Request:         req,\n            HasGlobalSearch: true,\n        },\n    }\n\n    r.Fields = r.GetFields()\n    r.Filters = r.GetFilters()\n    \n    return r\n}\n\nfunc (u *UserResource) GetModel() string {\n    return \"users\"\n}\n\nfunc (u *UserResource) GetFields() []*Field {\n    return []*Field{\n        NewField(\"ID\", WithSortable()),\n        NewField(\"First name\", WithSortable(), WithVisibility()),\n        NewField(\"Last name\", WithSortable(), WithSearchable()),\n        NewField(\"Email\", WithSortable()),\n        NewField(\"Username\", WithSortable()),\n        NewField(\"Last login\", WithSortable()),\n    }\n}\n\nfunc (u *UserResource) GetFilters() []*Filter {\n    return []*Filter{\n        NewFilter(\"ID\"),\n        NewFilter(\"Client ID\"),\n    }\n}\n\nfunc (u *UserResource) ApplyFilter(db *gorm.DB) {\n\n    if clientId := chi.URLParam(u.Request, \"client\"); clientId != \"\" {\n        db.Where(\"client_id = ?\", clientId)\n    }\n    \n    if siteId := chi.URLParam(u.Request, \"site\"); siteId != \"\" {\n        db.Joins(\"inner join sites_users ON sites_users.user_id = users.id\").Where(\"sites_users.site_id = ?\", siteId)\n    }\n}\n\nfunc (u *UserResource) WithGlobalSearch(db *gorm.DB, val string) {\n\n    if v, err := strconv.Atoi(val); err == nil {\n        db.Where(\"id = ?\", v)\n    } else {\n        val = \"%\" + val + \"%\"\n        db.Where(\n            db.Where(db.Where(\"first_name ilike ?\", val).\n                Or(\"last_name ilike ?\", val).\n                Or(\"email ilike ?\", val)),\n        )\n    }\n}\n\n```\n\n## HTTP Handler Example\n```go\nfunc (h UsersHandler) HandleGetUsers(w http.ResponseWriter, r *http.Request) {\n\n    resource := resources.NewUserResource(h.App.Db, r)\n\t\n    var clients []models.Client\n\n\t// Preload relationships\n    resource.Preloads = []*tables.Preload{{\n        Name: \"Owner\",\n        Extra: func(db *gorm.DB) *gorm.DB {\n            return db.Select(\"id\", \"email\")\n        }},\n    }\n\t\n    response, _ := resource.Paginate(resource, clients)\n\n\n    _ = h.App.Inertia.Render(w, r, \"Users\", response)\n}\n\n```\n\n## Contributing\n\nFeel free to create an issue or propose a pull request.\n\nFollow the [Code of Conduct](CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumweb%2Fgo-tables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhumweb%2Fgo-tables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumweb%2Fgo-tables/lists"}