{"id":51739936,"url":"https://github.com/btd1337/hadros","last_synced_at":"2026-07-18T11:42:07.877Z","repository":{"id":193421533,"uuid":"688759549","full_name":"btd1337/hadros","owner":"btd1337","description":"Postgres SQL Builder for Deno","archived":false,"fork":false,"pushed_at":"2023-09-09T00:34:58.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-22T00:52:20.931Z","etag":null,"topics":["deno","postgres","postgresql","sql","sql-builder"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/btd1337.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,"governance":null}},"created_at":"2023-09-08T03:38:27.000Z","updated_at":"2023-09-08T05:27:57.000Z","dependencies_parsed_at":"2023-09-08T05:27:59.517Z","dependency_job_id":null,"html_url":"https://github.com/btd1337/hadros","commit_stats":null,"previous_names":["btd1337/hadros"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/btd1337/hadros","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btd1337%2Fhadros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btd1337%2Fhadros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btd1337%2Fhadros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btd1337%2Fhadros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btd1337","download_url":"https://codeload.github.com/btd1337/hadros/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btd1337%2Fhadros/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35616737,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-18T02:00:07.223Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["deno","postgres","postgresql","sql","sql-builder"],"created_at":"2026-07-18T11:42:05.441Z","updated_at":"2026-07-18T11:42:07.864Z","avatar_url":"https://github.com/btd1337.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CI](https://github.com/btd1337/hadros/workflows/Deno-SQL-CI/badge.svg?branch=master)\n\n# Hadros\n\nHadros is a Postgres SQL builder for Deno based on @yourtion/deno-sql that is\nfocused on MySQL\n\n## Usage\n\n```typescript\nimport { expr, query, table } from \"https://deno.land/x/hadros/mod.ts\";\n\n// simple query\ntable(\"test\")\n  .select(\"a\", \"b\")\n  .where({ a: 1 })\n  .and(\"b=?\", [2])\n  .orderBy(\"b DESC\")\n  .offset(10)\n  .limit(5)\n  .build();\n// SELECT a, b FROM test WHERE a=1 AND b=2 ORDER BY b DESC LIMIT 10,5\n\n// join\ntable(\"hello\")\n  .select(\"*\")\n  .as(\"A\")\n  .leftJoin(\"world\")\n  .as(\"B\")\n  .on(\"A.id=B.id\")\n  .where(\"1\")\n  .and(\"2\")\n  .offset(2)\n  .limit(3)\n  .build();\n// SELECT \"A\".* FROM hello AS \"A\" LEFT JOIN world AS \"B\" ON A.id=B.id WHERE 1 AND 2 LIMIT 2,3\n\n// insert\ntable(\"test1\")\n  .insert({\n    a: 123,\n    b: 456,\n  })\n  .build();\n// INSERT INTO test1 (a, b) VALUES (123, 456);\n\n// batch insert\ntable(\"test1\")\n  .insert([\n    {\n      a: 123,\n      b: 456,\n    },\n    {\n      a: 789,\n      b: 110,\n    },\n  ])\n  .build();\n// INSERT INTO test1 (a, b) VALUES (123, 456),\n// (789, 110)\");\n\n// update\ntable(\"test1\")\n  .update({\n    a: 123,\n    b: 456,\n  })\n  .where({\n    b: 777,\n  })\n  .limit(12)\n  .build();\n// UPDATE test1 SET a=123, b=456 WHERE b=777 LIMIT 12\n\n// insert onDuplicateKeyUpdate\ntable(\"test1\")\n  .insert({ a: 123, b: 456 })\n  .onDuplicateKeyUpdate()\n  .set({ a: \"xxx\" })\n  .build();\n// INSERT INTO test1 (a, b) VALUES (123, 456) ON DUPLICATE KEY UPDATE a='xxx'\n\n// delete\ntable(\"test1\")\n  .delete()\n  .where({\n    b: 777,\n  })\n  .limit(12)\n  .build();\n// DELETE FROM test1 WHERE b=777 LIMIT 12\n\n// sub query\ntable(\"Test_2\")\n  .select(\"*\")\n  .where(\"a=? AND b IN ???\", [\n    123,\n    table(\"test3\")\n      .select(\"id\")\n      .where({ id: { $lt: 10 } })\n      .limit(100),\n  ])\n  .build();\n// SELECT * FROM \"Test_2\" WHERE a=123 AND b IN (SELECT id FROM test2 WHERE id\u003c10 LIMIT 100)\n\n// clone query\nconst q = table(\"test1\")\n  .select(\"*\")\n  .where({ a: 123 });\nq.clone()\n  .where({ b: 456 })\n  .offset(10)\n  .limit(20)\n  .build();\n// SELECT * FROM test1 WHERE a=123 AND b=456 LIMIT 10,20\nq.clone()\n  .where({ b: 789, c: 666 })\n  .orderBy(\"a DESC\")\n  .build();\n// SELECT * FROM test1 WHERE a=123 AND b=789 AND c=666 ORDER BY a DESC\n\n// query with expr\ntable(\"test\")\n  .select(\"*\")\n  .where(\n    expr()\n      .and(\"a=?\", [123])\n      .or({ b: 456 })\n      .and({ c: { $in: [789] } })\n      .or(\"d=:d\", { d: 666 }),\n  )\n  .build();\n// SELECT * FROM test WHERE (a=123 OR b=456 AND c IN (789) OR d=666)\n```\n\n## Usege with Postgres\n\n```ts\nimport { Client } from \"https://deno.land/x/postgres@v0.17.0/mod.ts\";\n\nconst client = new Client({\n  user: \"user\",\n  database: \"test\",\n  hostname: \"localhost\",\n  port: 5432,\n});\nawait client.connect();\n\nconst array_result = await client.queryArray(\n  table(\"People\").select(\"id\", \"name\").build(),\n);\nconsole.log(array_result.rows); // [[1, 'Carlos'], [2, 'John'], ...]\n\nconst object_result = await client.queryObject(\n  table(\"People\").select(\"id\", \"name\").build(),\n);\nconsole.log(object_result.rows); // [{id: 1, name: 'Carlos'}, {id: 2, name: 'John'}, ...]\n\nawait client.end();\n```\n\n## License\n\n```text\nMIT License\n\n- Copyright (c) 2018 Zongmin Lei \u003cleizongmin@gmail.com\u003e\n- Copyright (c) 2020 Yourtion Guo \u003cyourtion@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtd1337%2Fhadros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtd1337%2Fhadros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtd1337%2Fhadros/lists"}