{"id":20269265,"url":"https://github.com/wroge/querify","last_synced_at":"2025-04-11T04:01:25.353Z","repository":{"id":136308767,"uuid":"463804692","full_name":"wroge/querify","owner":"wroge","description":"query json-compatible data using a SQL-like language","archived":false,"fork":false,"pushed_at":"2022-03-21T16:32:34.000Z","size":18,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T02:01:38.271Z","etag":null,"topics":["json","query","sql"],"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/wroge.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-26T09:06:07.000Z","updated_at":"2022-12-01T07:02:57.000Z","dependencies_parsed_at":"2023-07-24T08:05:44.657Z","dependency_job_id":null,"html_url":"https://github.com/wroge/querify","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroge%2Fquerify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroge%2Fquerify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroge%2Fquerify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wroge%2Fquerify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wroge","download_url":"https://codeload.github.com/wroge/querify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339256,"owners_count":21087214,"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":["json","query","sql"],"created_at":"2024-11-14T12:24:14.066Z","updated_at":"2025-04-11T04:01:25.272Z","avatar_url":"https://github.com/wroge.png","language":"Go","readme":"[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white)](https://pkg.go.dev/github.com/wroge/querify)\n[![Go Report Card](https://goreportcard.com/badge/github.com/wroge/querify)](https://goreportcard.com/report/github.com/wroge/querify)\n![golangci-lint](https://github.com/wroge/querify/workflows/golangci-lint/badge.svg)\n[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/wroge/querify.svg?style=social)](https://github.com/wroge/querify/tags)\n\n# querify\n\nQuery your data from and to any json compatible source.\nThe query language used is similar to SQL with Postgres dialect.\n\n```go\nhobbiesTable := []map[string]interface{}{\n    {\"id\": 1, \"name\": \"Football\"},\n    {\"id\": 2, \"name\": \"Basketball\"},\n    {\"id\": 3, \"name\": \"Hockey\"},\n}\n\nusersTable := []map[string]interface{}{\n    {\"id\": 1, \"name\": \"Max\"},\n    {\"id\": 2, \"name\": \"Tom\"},\n    {\"id\": 3, \"name\": \"Alex\"},\n}\n\nuserHobbiesTable := []map[string]interface{}{\n    {\"user_id\": 1, \"hobby_id\": 1},\n    {\"user_id\": 1, \"hobby_id\": 2},\n    {\"user_id\": 2, \"hobby_id\": 3},\n    {\"user_id\": 3, \"hobby_id\": 1},\n}\n\ntype User struct {\n    Name    string\n    Hobbies []string\n}\n\nvar users []User\n\nerr := querify.From(usersTable).As(\"users\").\n    Join(\n        querify.LeftJoin{\n            Right: querify.From(userHobbiesTable).As(\"user_hobbies\"),\n            On:    querify.Equals{querify.Ident(\"users.id\"), querify.Ident(\"user_hobbies.user_id\")},\n        },\n        querify.LeftJoin{\n            Right: querify.From(hobbiesTable).As(\"hobbies\"),\n            On:    querify.Equals{querify.Ident(\"hobbies.id\"), querify.Ident(\"user_hobbies.hobby_id\")},\n        },\n    ).\n    GroupBy(querify.Ident(\"users.name\")).\n    Select(\n        querify.As{\n            Name:       \"name\",\n            Expression: querify.Ident(\"users.name\"),\n        },\n        querify.As{\n            Name: \"hobbies\",\n            Expression: querify.ArrayAgg{\n                Expression: querify.Ident(\"hobbies.name\"),\n            },\n        },\n    ).Scan(\u0026users)\nif err != nil {\n    panic(err)\n}\n\nfmt.Println(users)\n// [{Max [Football Basketball]} {Tom [Hockey]} {Alex [Football]}]\n```\n\n## Features\n\n- Expression:\n  - Literal\n  - Ident\n  - ArrayAgg\n  - Concat\n  - CountAll\n  - Count\n  - As\n- GroupBy:\n  - Ident\n  - Cube\n  - GroupingSets\n- Condition:\n  - And\n  - Or\n  - Equals\n  - Greater\n  - Less\n- OrderBy:\n  - Asc\n  - Desc\n- Join:\n  - LeftJoin\n- Limit\n- Offset\n\nYour required SQL feature isn't yet supported?\nImplement these [interfaces](https://github.com/wroge/querify/blob/master/interface.go) and create a merge request!\n\n## Dependencies\n\n- [tidwall/gjson](https://github.com/tidwall/gjson)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwroge%2Fquerify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwroge%2Fquerify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwroge%2Fquerify/lists"}