{"id":18464883,"url":"https://github.com/neondatabase/semicolons","last_synced_at":"2025-04-08T08:31:31.471Z","repository":{"id":210745037,"uuid":"727351145","full_name":"neondatabase/semicolons","owner":"neondatabase","description":"Take a string with multiple Postgres SQL statements, separated by semicolons, and split it into its constituent statements","archived":false,"fork":false,"pushed_at":"2024-05-08T12:17:03.000Z","size":143,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-19T04:36:27.306Z","etag":null,"topics":["comments","parse","postgres","postgresql","semicolons","split","sql"],"latest_commit_sha":null,"homepage":"https://neon.tech/blog/bringing-psqls-d-to-your-web-browser","language":"TypeScript","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/neondatabase.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":"2023-12-04T17:32:58.000Z","updated_at":"2024-07-15T15:18:14.000Z","dependencies_parsed_at":"2023-12-12T19:42:28.590Z","dependency_job_id":"674aef10-21c7-4bfe-b460-6cc58608fc11","html_url":"https://github.com/neondatabase/semicolons","commit_stats":null,"previous_names":["jawj/semicolons","neondatabase/semicolons"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neondatabase%2Fsemicolons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neondatabase%2Fsemicolons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neondatabase%2Fsemicolons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neondatabase%2Fsemicolons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neondatabase","download_url":"https://codeload.github.com/neondatabase/semicolons/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247804472,"owners_count":20998990,"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":["comments","parse","postgres","postgresql","semicolons","split","sql"],"created_at":"2024-11-06T09:11:25.153Z","updated_at":"2025-04-08T08:31:31.145Z","avatar_url":"https://github.com/neondatabase.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## semicolons\n\nThis package exists to take a string containing multiple Postgres SQL statements, separated by semicolons, and split it into its constituent statements.\n\nThis isn't trivial, because semicolons may occur in double-quoted identifiers, ordinary strings, 'escape' strings, continuation strings, dollar-quoted strings, single-line comments, and (nestable) multi-line comments, and in all these cases they do not separate statements.\n\nSticky RegExps are used liberally.\n\nDeveloped for and [used by Neon's SQL Editor](https://neon.tech/blog/bringing-psqls-d-to-your-web-browser). Kick the tyres there or at https://semicolons.pages.dev/.\n\n### Installation\n\n```sh\nnpm install postgres-semicolons\n```\n\n### Usage\n\nThe exported functions have comprehensive [TSDoc](https://tsdoc.org/) comments in [`index.ts`](index.ts).\n\nAn example:\n\n```javascript\nimport * as semicolons from 'postgres-semicolons';\n\nconst sql = `BEGIN; /*/* SELECT 1; */ SELECT 2; */; SELECT ';'';'; SELECT $x$;$x$; -- COMMIT;`;\nconst standardConformingStrings = true; \nconst splits = semicolons.parseSplits(sql, standardConformingStrings);\nconst queries = semicolons.nonEmptyStatements(sql, splits.positions);\n\nconsole.log(queries);  // -\u003e [ 'BEGIN', \"SELECT ';'';'\", 'SELECT $x$;$x$' ]\n```\n\n### License\n\nThe code is [MIT licensed](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneondatabase%2Fsemicolons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneondatabase%2Fsemicolons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneondatabase%2Fsemicolons/lists"}