{"id":21831404,"url":"https://github.com/nodef/extra-sql","last_synced_at":"2025-07-19T02:04:58.105Z","repository":{"id":57368205,"uuid":"134552525","full_name":"nodef/extra-sql","owner":"nodef","description":"Generates SQL commands for creating tables, inserting data, and performing operations like text search and matching in PostgreSQL databases.","archived":false,"fork":false,"pushed_at":"2025-04-16T12:06:22.000Z","size":117,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-19T16:06:47.470Z","etag":null,"topics":["create","create-index","create-table","create-table-data","create-view","delete-data","exists","extra","index","insert","insert-into","into","match","select","setup","setup-table","sql","table","tsquery","view"],"latest_commit_sha":null,"homepage":"https://jsr.io/@nodef/extra-sql","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/nodef.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-05-23T10:20:59.000Z","updated_at":"2025-05-03T00:00:19.000Z","dependencies_parsed_at":"2022-08-23T20:11:03.669Z","dependency_job_id":null,"html_url":"https://github.com/nodef/extra-sql","commit_stats":null,"previous_names":["nodef/sql-extra"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nodef/extra-sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodef","download_url":"https://codeload.github.com/nodef/extra-sql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-sql/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265872374,"owners_count":23842165,"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":["create","create-index","create-table","create-table-data","create-view","delete-data","exists","extra","index","insert","insert-into","into","match","select","setup","setup-table","sql","table","tsquery","view"],"created_at":"2024-11-27T19:10:16.799Z","updated_at":"2025-07-19T02:04:58.095Z","avatar_url":"https://github.com/nodef.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[SQL] is designed for managing or stream processing data in an RDBMS. This package provides a set of functions to generate SQL commands for creating tables, inserting data, and performing various operations, including text search and matching, on SQL databases (PostgreSQL).\n\n▌\n📦 [JSR](https://jsr.io/@nodef/extra-sql),\n📰 [Docs](https://jsr.io/@nodef/extra-sql/doc),\n\n\u003cbr\u003e\n\n\n```javascript\nimport * as xsql from \"jsr:@nodef/extra-sql\";\n\nxsql.tableExists(\"food\");\n// → SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name='food');\n\nxsql.setupTable(\"food\", {code: \"TEXT\", name: \"TEXT\"},\n  [{code: \"F1\", name: \"Mango\"}, {code: \"F2\", name: \"Lychee\"}]);\n// → CREATE TABLE IF NOT EXISTS \"food\" (\"code\" TEXT, \"name\" TEXT);\n// → INSERT INTO \"food\" (\"code\", \"name\") VALUES\n// → ($$F1$$, $$Mango$$),\n// → ($$F2$$, $$Lychee$$);\n\n\nxsql.selectTsquery(\"columns\", \"total fat\");\n// → SELECT * FROM \"columns\" WHERE \"tsvector\" @@ plainto_tsquery('total fat');\n\nxsql.matchTsquery(\"columns\", [\"total\", \"fat\"]);\n// → SELECT *, '2'::INT AS \"matchTsquery\" FROM \"columns\" WHERE \"tsvector\" @@ plainto_tsquery('total fat') UNION ALL\n// → SELECT *, '1'::INT AS \"matchTsquery\" FROM \"columns\" WHERE \"tsvector\" @@ plainto_tsquery('total');\n```\n\n\n## Index\n\n| Name | Description |\n| ---- | ------ |\n| [createTable] | Generate SQL command for CREATE TABLE. |\n| [createIndex] | Generate SQL command for CREATE INDEX. |\n| [createView] | Generate SQL command for CREATE VIEW. |\n| [insertInto] | Generates SQL command for INSERT INTO using an array of values. |\n| [setupTable] | Generate SQL commands to set up a table (create, insert, index). |\n| [tableExists] | Generate SQL command to check if a table exists. |\n| [selectTsquery] | Generate SQL command for SELECT with tsquery. |\n| [matchTsquery] | Generate SQL query for matching words with tsquery. |\n| [insertIntoStream] | Generate SQL command for INSERT INTO using a stream of values. |\n| [setupTableIndex] | Generate SQL commands for setting up table indexes and views. |\n| [createTableData] | Generate SQL command for creating a table with data. |\n| [updateData] | Generate SQL command for updating data. |\n| [selectData] | Generate SQL command for selecting data. |\n| [insertIntoData] | Generate SQL command for inserting data. |\n| [deleteData] | Generate SQL command for deleting data. |\n| [OPERATORS] | Set of operators in SQL. {field} |\n| [OPERAND_COUNT] | Number of operands used with an SQL operator. {field} |\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n[![](https://raw.githubusercontent.com/qb40/designs/gh-pages/0/image/11.png)](https://wolfram77.github.io)\u003cbr\u003e\n[![ORG](https://img.shields.io/badge/org-nodef-green?logo=Org)](https://nodef.github.io)\n![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/extra-sql)\n\n\n[SQL]: https://en.wikipedia.org/wiki/SQL\n[createTable]: https://jsr.io/@nodef/extra-sql/doc/~/createTable\n[createIndex]: https://jsr.io/@nodef/extra-sql/doc/~/createIndex\n[createView]: https://jsr.io/@nodef/extra-sql/doc/~/createView\n[insertInto]: https://jsr.io/@nodef/extra-sql/doc/~/insertInto\n[setupTable]: https://jsr.io/@nodef/extra-sql/doc/~/setupTable\n[tableExists]: https://jsr.io/@nodef/extra-sql/doc/~/tableExists\n[selectTsquery]: https://jsr.io/@nodef/extra-sql/doc/~/selectTsquery\n[matchTsquery]: https://jsr.io/@nodef/extra-sql/doc/~/matchTsquery\n[OPERATORS]: https://jsr.io/@nodef/extra-sql/doc/~/OPERATORS\n[OPERAND_COUNT]: https://jsr.io/@nodef/extra-sql/doc/~/OPERAND_COUNT\n[insertIntoStream]: https://jsr.io/@nodef/extra-sql/doc/~/insertIntoStream\n[setupTableIndex]: https://jsr.io/@nodef/extra-sql/doc/~/setupTableIndex\n[createTableData]: https://jsr.io/@nodef/extra-sql/doc/~/createTableData\n[updateData]: https://jsr.io/@nodef/extra-sql/doc/~/updateData\n[selectData]: https://jsr.io/@nodef/extra-sql/doc/~/selectData\n[insertIntoData]: https://jsr.io/@nodef/extra-sql/doc/~/insertIntoData\n[deleteData]: https://jsr.io/@nodef/extra-sql/doc/~/deleteData\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodef%2Fextra-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-sql/lists"}