{"id":13412135,"url":"https://github.com/cristalhq/builq","last_synced_at":"2025-04-08T00:31:54.321Z","repository":{"id":42613853,"uuid":"502549278","full_name":"cristalhq/builq","owner":"cristalhq","description":"Easily build SQL queries in Go.","archived":false,"fork":false,"pushed_at":"2024-04-24T07:03:32.000Z","size":77,"stargazers_count":92,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T22:16:57.946Z","etag":null,"topics":["go","golang","query","query-builder","sql-builder"],"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/cristalhq.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-06-12T07:34:49.000Z","updated_at":"2025-03-18T21:49:02.000Z","dependencies_parsed_at":"2023-01-25T13:31:17.280Z","dependency_job_id":"f45e7709-ae7b-448a-aa38-ae37db34e443","html_url":"https://github.com/cristalhq/builq","commit_stats":null,"previous_names":["cristalhq/qder"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fbuilq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fbuilq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fbuilq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fbuilq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cristalhq","download_url":"https://codeload.github.com/cristalhq/builq/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755389,"owners_count":20990616,"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":["go","golang","query","query-builder","sql-builder"],"created_at":"2024-07-30T20:01:21.390Z","updated_at":"2025-04-08T00:31:53.946Z","avatar_url":"https://github.com/cristalhq.png","language":"Go","funding_links":[],"categories":["Database","数据库","Data Integration Frameworks"],"sub_categories":["SQL Query Builders","SQL查询生成器"],"readme":"# builq\n\n[![build-img]][build-url]\n[![pkg-img]][pkg-url]\n[![reportcard-img]][reportcard-url]\n[![coverage-img]][coverage-url]\n[![version-img]][version-url]\n\nEasily build queries in Go.\n\n## Rationale\n\nThe simplest way to represent SQL query is a string.\nBut the query arguments and their indexing (`$1`, `$2` etc) require additional attention.\nThis tiny library helps to build queries and handles parameter indexing.\n\n## Features\n\n* Simple and easy.\n* Safe and fast.\n* Tested.\n* Language-agnostic.\n* Dependency-free.\n\nSee [docs][pkg-url] or [GUIDE.md](GUIDE.md) for more details.\n\n## Install\n\nGo version 1.19+\n\n```\ngo get github.com/cristalhq/builq\n```\n\n## Example\n\n```go\ncols := builq.Columns{\"foo, bar\"}\n\nq := builq.New()\nq(\"SELECT %s FROM %s\", cols, \"users\")\nq(\"WHERE active IS TRUE\")\nq(\"AND user_id = %$ OR user = %$\", 42, \"root\")\n\nquery, args, err := q.Build()\nif err != nil {\n\tpanic(err)\n}\n\ndebug := q.DebugBuild()\n\nfmt.Println(\"query:\")\nfmt.Println(query)\nfmt.Println(\"\\nargs:\")\nfmt.Println(args)\nfmt.Println(\"\\ndebug:\")\nfmt.Println(debug)\n\n// query:\n// SELECT foo, bar FROM users\n// WHERE active IS TRUE\n// AND user_id = $1 OR user = $2\n//\n// args:\n// [42 root]\n//\n// debug:\n// SELECT foo, bar FROM 'users'\n// WHERE active IS TRUE\n// AND user_id = 42 OR user = 'root'\n```\n\nSee examples: [example_test.go](example_test.go).\n\n## License\n\n[MIT License](LICENSE).\n\n[build-img]: https://github.com/cristalhq/builq/workflows/build/badge.svg\n[build-url]: https://github.com/cristalhq/builq/actions\n[pkg-img]: https://pkg.go.dev/badge/cristalhq/builq\n[pkg-url]: https://pkg.go.dev/github.com/cristalhq/builq\n[reportcard-img]: https://goreportcard.com/badge/cristalhq/builq\n[reportcard-url]: https://goreportcard.com/report/cristalhq/builq\n[coverage-img]: https://codecov.io/gh/cristalhq/builq/branch/main/graph/badge.svg\n[coverage-url]: https://codecov.io/gh/cristalhq/builq\n[version-img]: https://img.shields.io/github/v/release/cristalhq/builq\n[version-url]: https://github.com/cristalhq/builq/releases\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristalhq%2Fbuilq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcristalhq%2Fbuilq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristalhq%2Fbuilq/lists"}