{"id":20673649,"url":"https://github.com/yiplee/sqlc","last_synced_at":"2025-04-19T19:55:51.294Z","repository":{"id":57695307,"uuid":"488670464","full_name":"yiplee/sqlc","owner":"yiplee","description":"sqlc: A simple dynamic query builer for [kyleconroy/sqlc](https://github.com/kyleconroy/sqlc)","archived":false,"fork":false,"pushed_at":"2022-08-26T08:52:35.000Z","size":10,"stargazers_count":30,"open_issues_count":3,"forks_count":11,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T12:35:06.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/yiplee.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}},"created_at":"2022-05-04T16:50:16.000Z","updated_at":"2025-03-15T08:56:16.000Z","dependencies_parsed_at":"2022-09-06T10:40:51.777Z","dependency_job_id":null,"html_url":"https://github.com/yiplee/sqlc","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiplee%2Fsqlc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiplee%2Fsqlc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiplee%2Fsqlc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiplee%2Fsqlc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiplee","download_url":"https://codeload.github.com/yiplee/sqlc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249787063,"owners_count":21325569,"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-11-16T20:42:10.006Z","updated_at":"2025-04-19T19:55:51.276Z","avatar_url":"https://github.com/yiplee.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqlc: A simple dynamic query builder for [kyleconroy/sqlc](https://github.com/kyleconroy/sqlc)\n\n## How to use\n\n```go\npackage sqlc_test\n\nimport (\n    \"context\"\n    \"database/sql\"\n    \"log\"\n\n    \"github.com/yiplee/sqlc\"\n    \"github.com/yiplee/sqlc/example\"\n)\n\nfunc Example_build() {\n    ctx := context.Background()\n\n    db, err := sql.Open(\"postgres\", \"dsn\")\n    if err != nil {\n        panic(err)\n    }\n    defer db.Close()\n\n    // Wrap the db in order to hook the query\n    query := example.New(sqlc.Wrap(db))\n\n    /*\n    the original query must be simple and not contain any WHERE/ORDER/LIMIT/OFFSET clause\n\n    -- name: ListAuthors :many\n    SELECT * FROM authors;\n    */\n\n    // customize the builder\n    authors, err := query.ListAuthors(sqlc.Build(ctx, func(b *sqlc.Builder) {\n        b.Where(\"age \u003e $1\", 10)\n        b.Where(\"name = $2\", \"foo\")\n        b.Order(\"age,name DESC\")\n        b.Limit(10)\n    }))\n\n    if err != nil {\n        log.Fatalln(\"ListAuthors\", err)\n    }\n\n    log.Printf(\"list %d authors\", len(authors))\n}\n```\n\n\nNot perfect, but enough for now.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiplee%2Fsqlc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiplee%2Fsqlc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiplee%2Fsqlc/lists"}