{"id":16617076,"url":"https://github.com/agnivade/sqlargs","last_synced_at":"2025-10-29T19:31:27.895Z","repository":{"id":57497192,"uuid":"163148396","full_name":"agnivade/sqlargs","owner":"agnivade","description":"A vet analyzer which checks sql queries for correctness","archived":false,"fork":false,"pushed_at":"2019-02-27T06:58:17.000Z","size":29,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-02T04:31:51.347Z","etag":null,"topics":["go","postgres","sql","vet"],"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/agnivade.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":"2018-12-26T07:07:30.000Z","updated_at":"2023-03-26T05:57:55.000Z","dependencies_parsed_at":"2022-09-03T23:51:18.921Z","dependency_job_id":null,"html_url":"https://github.com/agnivade/sqlargs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agnivade%2Fsqlargs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agnivade%2Fsqlargs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agnivade%2Fsqlargs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agnivade%2Fsqlargs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agnivade","download_url":"https://codeload.github.com/agnivade/sqlargs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238882269,"owners_count":19546472,"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","postgres","sql","vet"],"created_at":"2024-10-12T02:15:11.802Z","updated_at":"2025-10-29T19:31:22.595Z","avatar_url":"https://github.com/agnivade.png","language":"Go","readme":"# sqlargs [![Build Status](https://travis-ci.org/agnivade/sqlargs.svg?branch=master)](https://travis-ci.org/agnivade/sqlargs)\nA vet analyzer which checks sql(only Postgres!) queries for correctness.\n\n### Background\n\nLet's assume you have a query like:\n\n`db.Exec(\"insert into table (c1, c2, c3, c4) values ($1, $2, $3, $4)\", p1, p2, p3, p4)`.\n\nIt's the middle of the night and you need to add a new column. You quickly change the query to -\n\n`db.Exec(\"insert into table (c1, c2, c3, c4, c5) values ($1, $2, $3, $4)\", p1, p2, p3, p4, p5)`.\n\nEverything compiles fine. Except it's not ! A `$5` is missing. It can even go the other way round; you add the `$5` but forget to add `c5`.\n\nThis is a semantic error which will eventually get caught while running the app. Not to mention, if there are tests. But sometimes I get lazy and don't write tests for _all_ my sql queries. :sweat_smile:\n\n`sqlargs` will statically check for semantic errors like these and flag them beforehand.\n\n### Quick start\n\nThis is written using the `go/analysis` API. So you can plug this directly into `go vet`, or you can run it as a standalone tool too.\n\nInstall:\n```\ngo get github.com/agnivade/sqlargs/cmd/sqlargs\n```\n\nAnd then run it on your repo:\n```\ngo vet -vettool $(which sqlargs) ./... # Has to be \u003e= 1.12\nOR\nsqlargs ./...\n```\n\n__P.S.: This only works for Postgres queries. So if your codebase has queries which do not match with the postgres query parser, it might flag incorrect errors.__\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagnivade%2Fsqlargs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagnivade%2Fsqlargs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagnivade%2Fsqlargs/lists"}