{"id":27209549,"url":"https://github.com/worldline-go/query","last_synced_at":"2025-04-10T00:57:27.539Z","repository":{"id":285757609,"uuid":"959163732","full_name":"worldline-go/query","owner":"worldline-go","description":"query parser statements","archived":false,"fork":false,"pushed_at":"2025-04-07T03:36:08.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-10T00:57:20.817Z","etag":null,"topics":["goqu","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/worldline-go.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":"2025-04-02T11:18:51.000Z","updated_at":"2025-04-07T03:35:58.000Z","dependencies_parsed_at":"2025-04-02T14:49:38.764Z","dependency_job_id":null,"html_url":"https://github.com/worldline-go/query","commit_stats":null,"previous_names":["worldline-go/query"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldline-go%2Fquery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldline-go%2Fquery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldline-go%2Fquery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/worldline-go%2Fquery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/worldline-go","download_url":"https://codeload.github.com/worldline-go/query/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137974,"owners_count":21053775,"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":["goqu","query"],"created_at":"2025-04-10T00:57:27.028Z","updated_at":"2025-04-10T00:57:27.518Z","avatar_url":"https://github.com/worldline-go.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Query\n\n[![License](https://img.shields.io/github/license/worldline-go/query?color=red\u0026style=flat-square)](https://raw.githubusercontent.com/worldline-go/query/main/LICENSE)\n[![Coverage](https://img.shields.io/sonar/coverage/worldline-go_query?logo=sonarcloud\u0026server=https%3A%2F%2Fsonarcloud.io\u0026style=flat-square)](https://sonarcloud.io/summary/overall?id=worldline-go_query)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/worldline-go/query/test.yml?branch=main\u0026logo=github\u0026style=flat-square\u0026label=ci)](https://github.com/worldline-go/query/actions)\n[![Go Report Card](https://goreportcard.com/badge/github.com/worldline-go/query?style=flat-square)](https://goreportcard.com/report/github.com/worldline-go/query)\n[![Go PKG](https://raw.githubusercontent.com/worldline-go/guide/main/badge/custom/reference.svg)](https://pkg.go.dev/github.com/worldline-go/query)\n\nQuery is an adaptor of http query to expressions. Check adapters to convert it to sql or other expressions.\n\n```sh\ngo get github.com/worldline-go/query\n```\n\n## Usage\n\nParse url and extract query parameters with RAW, give to `query.Parse` to convert it to expression.  \nUse an adapter to convert it to sql or other expressions.\n\n```go\nurlStr := \"http://example.com?name=foo,bar|nick=bar\u0026age[lt]=1\u0026sort=-age\u0026limit=10\u0026offset=5\u0026fields=id,name\"\nparsedURL, err := url.Parse(urlStr)\n// ...\nquery, err := query.Parse(parsedURL.RawQuery)\n// ...\nsql, params, err := adaptergoqu.Select(query, goqu.From(\"test\")).ToSQL()\n// ...\n\n// SQL: SELECT \"id\", \"name\" FROM \"test\" WHERE (((\"name\" IN ('foo', 'bar')) OR (\"nick\" = 'bar')) AND (\"age\" \u003c '1')) ORDER BY \"age\" DESC LIMIT 10 OFFSET 5\n// Params: []\n```\n\nIf some value separated by `,` it will be converted to `IN` operator.  \nThere are a list of `[ ]` operators that can be used in the query string:  \n`eq, ne, gt, lt, gte, lte, like, ilike, nlike, nilike, in, nin, is, not`\n\n### Validation\n\n```go\nvalidator := query.NewValidator(\n    WithValue(\"member\", WithRequired()),\n)\n\n// after that use it to validate\nerr := validator.Validate(query)\nif err != nil {\n    // handle error\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworldline-go%2Fquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworldline-go%2Fquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworldline-go%2Fquery/lists"}