{"id":38740049,"url":"https://github.com/laoqiu/sqlx-builder","last_synced_at":"2026-01-17T11:37:38.171Z","repository":{"id":57485348,"uuid":"144694585","full_name":"laoqiu/sqlx-builder","owner":"laoqiu","description":"一个简单的sqlx的链式操作插件","archived":false,"fork":false,"pushed_at":"2020-11-11T05:42:24.000Z","size":58,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-14T09:42:47.128Z","etag":null,"topics":["database","golang","sqlx"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laoqiu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-14T08:54:46.000Z","updated_at":"2021-08-31T01:02:07.000Z","dependencies_parsed_at":"2022-09-02T00:02:28.347Z","dependency_job_id":null,"html_url":"https://github.com/laoqiu/sqlx-builder","commit_stats":null,"previous_names":["laoqiu/sqlxt"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/laoqiu/sqlx-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laoqiu%2Fsqlx-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laoqiu%2Fsqlx-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laoqiu%2Fsqlx-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laoqiu%2Fsqlx-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laoqiu","download_url":"https://codeload.github.com/laoqiu/sqlx-builder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laoqiu%2Fsqlx-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28507942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T10:25:30.148Z","status":"ssl_error","status_checked_at":"2026-01-17T10:25:29.718Z","response_time":85,"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","golang","sqlx"],"created_at":"2026-01-17T11:37:38.112Z","updated_at":"2026-01-17T11:37:38.164Z","avatar_url":"https://github.com/laoqiu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqlx-builder\n用于实现sqlx的链式操作\n\n## 安装\n```\ngo get github.com/laoqiu/sqlx-builder\n```\n\n### 初始化\n\n```\nimport (\n\tsqlxb \"github.com/laoqiu/sqlx-builder\"\n)\ndb, err := sqlxb.Connect()\nif err != nil {\n\treturn err\n}\n// 加载mapper\nbuilder.LoadMapper(db, sqlxb.DefaultMapper)\n```\n\n### 支持的链式操作\n```\ndest := \u0026Person{}\np := map[string]interface{}{\n    \"phone\": \"13012345678\",\n}\ndebug := true\nquery = sqlxb.Table(\"tablename\").Join(\"table2\", \"table2.id = table1.t_id\").\n    Where(\"name like ?\", \"%name%\").\n    Where(\"address = ?\", \"test\").\n    Where(\"phone = :phone\", p)\nerr := sqlxb.New(db, query, debug).First(dest)\nif err != nil {\n    log.Println(err) \n}\n```\n\n### 支持的函数及结构体\n* Builder\n```\nfunc New(*sqlx.DB, *Query, debug bool) *Builder\nfunc NewTx(*sqlx.Tx, *Query, debug bool) *Builder\nfunc (st *Builder) Insert(data interface{}) error\nfunc (st *Builder) Update(data interface{}) error\nfunc (st *Builder) Delete() error\nfunc (st *Builder) Get(dest interface{}) (sql.Result, error)\nfunc (st *Builder) All(dest interface{}) (sql.Result, error)\n```\n* Query\n```\nfunc Table(tablename) *Query\nfunc (q *Query) Distinct() *Query\nfunc (q *Query) Select(...fields) *Query\nfunc (q *Query) Join(table, condition, label) *Query\nfunc (q *Query) LeftJoin(table, condition, label) *Query\nfunc (q *Query) RightJoin(table, condition, label) *Query\nfunc (q *Query) UnionJoin(table, condition, label) *Query\nfunc (q *Query) Where(condition, ...args) *Query\nfunc (q *Query) Limit(n) *Query\nfunc (q *Query) Offset(n) *Query\n```\n* func Connect\n* func LoadMapper\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaoqiu%2Fsqlx-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaoqiu%2Fsqlx-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaoqiu%2Fsqlx-builder/lists"}