{"id":15663702,"url":"https://github.com/code-hex/sqb","last_synced_at":"2025-07-10T00:37:37.434Z","repository":{"id":71655114,"uuid":"219186571","full_name":"Code-Hex/sqb","owner":"Code-Hex","description":"⚡Blazing fast, Flexible, SQL Query Builder for Go","archived":false,"fork":false,"pushed_at":"2021-05-17T06:12:56.000Z","size":80,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-06T19:05:18.892Z","etag":null,"topics":[],"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/Code-Hex.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}},"created_at":"2019-11-02T17:08:52.000Z","updated_at":"2022-03-15T22:34:46.000Z","dependencies_parsed_at":"2023-06-08T09:00:41.342Z","dependency_job_id":null,"html_url":"https://github.com/Code-Hex/sqb","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Code-Hex/sqb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Hex%2Fsqb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Hex%2Fsqb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Hex%2Fsqb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Hex%2Fsqb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Code-Hex","download_url":"https://codeload.github.com/Code-Hex/sqb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Code-Hex%2Fsqb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264506265,"owners_count":23619005,"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":[],"created_at":"2024-10-03T13:39:27.862Z","updated_at":"2025-07-10T00:37:37.395Z","avatar_url":"https://github.com/Code-Hex.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqb - SQL Query Builder\n\n\u003e ⚡ Blazing fast, Flexible, SQL Query Builder for Go\n\n[![GoDoc](https://godoc.org/github.com/Code-Hex/sqb?status.svg)](https://godoc.org/github.com/Code-Hex/sqb) [![CircleCI](https://circleci.com/gh/Code-Hex/sqb.svg?style=svg\u0026circle-token=0ff0570576e90eb3a10e017f7ca1279748565daf)](https://circleci.com/gh/Code-Hex/sqb) [![codecov](https://codecov.io/gh/Code-Hex/sqb/branch/master/graph/badge.svg?token=xjioT8q5f5)](https://codecov.io/gh/Code-Hex/sqb) [![Go Report Card](https://goreportcard.com/badge/github.com/Code-Hex/sqb)](https://goreportcard.com/report/github.com/Code-Hex/sqb)\n\n## Features\n\n- High performance.\n- Easy to use.\n- Powerful, Flexible. You can define stmt for yourself.\n- Supported MySQL, PostgreSQL, Spanner statement.\n\n## Synopsis\n\nWhen used normally\n\n```go\nconst sqlstr = \"SELECT * FROM tables WHERE ?\"\nbuilder := sqb.New(sqlstr).Bind(sqb.Eq(\"category\", 1))\nquery, args, err := builder.Build()\n// query =\u003e \"SELECT * FROM tables WHERE category = ?\",\n// args  =\u003e []interface{}{1}\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eWhen you want to use build cache\u003c/summary\u003e\n\n\n```go\nconst sqlstr = \"SELECT * FROM tables WHERE ? AND ?\"\ncached := sqb.New(sqlstr).Bind(sqb.Eq(\"category\", 1))\n\nfor _, col := range columns {\n    builder := cached.Bind(sqb.Eq(col, \"value\"))\n    query, args, err  := builder.Build()\n    // query =\u003e \"SELECT * FROM tables WHERE category = ? AND \" + col + \" = ?\",\n    // args  =\u003e []interface{}{1, \"value\"}\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eError case\u003c/summary\u003e\n\n\n```go\nconst sqlstr = \"SELECT * FROM tables WHERE ? OR ?\"\nbuilder := sqb.New(sqlstr).Bind(sqb.Eq(\"category\", 1))\nquery, args, err  := builder.Build()\n// query =\u003e \"\",\n// args  =\u003e nil\n// err   =\u003e \"number of bindVars exceeds replaceable statements\"\n```\n\u003c/details\u003e\n\n## Install\n\nUse `go get` to install this package.\n\n    go get -u github.com/Code-Hex/sqb\n\n## Performance\n\nsqb is the fastest and least-memory used among currently known SQL Query builder in the benchmark. The data of chart using simple [benchmark](https://github.com/Code-Hex/sqb/blob/a3e54e8ed6bf41df28cac174e503b15d03c76b4b/benchmark/benchmark_test.go).\n\n![time](https://user-images.githubusercontent.com/6500104/71240191-d7e74a00-234b-11ea-8070-03ffaa8f849f.png)\n\n![benchmark](https://user-images.githubusercontent.com/6500104/71240411-62c84480-234c-11ea-926b-d31418148d26.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-hex%2Fsqb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-hex%2Fsqb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-hex%2Fsqb/lists"}