{"id":15266396,"url":"https://github.com/neverstew/cypher-template-strings","last_synced_at":"2026-01-25T05:00:40.973Z","repository":{"id":41801165,"uuid":"509964221","full_name":"neverstew/cypher-template-strings","owner":"neverstew","description":"ES6 tagged template strings for prepared statements with neo4j","archived":false,"fork":false,"pushed_at":"2023-06-17T21:33:40.000Z","size":545,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-30T07:52:08.602Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/neverstew.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-03T08:24:55.000Z","updated_at":"2023-06-22T09:29:59.000Z","dependencies_parsed_at":"2024-11-28T14:28:08.607Z","dependency_job_id":"b5955b15-4354-4178-9647-8f3acd03696d","html_url":"https://github.com/neverstew/cypher-template-strings","commit_stats":null,"previous_names":["neverstew/cypher-template-strings","matt-l-w/cypher-template-strings"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/neverstew/cypher-template-strings","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neverstew%2Fcypher-template-strings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neverstew%2Fcypher-template-strings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neverstew%2Fcypher-template-strings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neverstew%2Fcypher-template-strings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neverstew","download_url":"https://codeload.github.com/neverstew/cypher-template-strings/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neverstew%2Fcypher-template-strings/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28744418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T02:46:29.005Z","status":"ssl_error","status_checked_at":"2026-01-25T02:44:29.968Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-09-30T05:08:56.843Z","updated_at":"2026-01-25T05:00:40.888Z","avatar_url":"https://github.com/neverstew.png","language":"TypeScript","readme":"# Cypher Template Strings\n\nAn easy way to use tagged template strings to construct cypher queries for the official [neo4j-javascript-driver](https://github.com/neo4j/neo4j-javascript-driver).\n\n## Importing\n```js\n// with ES6\nimport cypher from 'cypher-template-strings'\nimport { cypher } from 'cypher-template-strings'\n\n// with CommonJS\nconst { cypher } = require('cypher-template-strings');\nconst cypher = require('cypher-template-strings').default;\n```\n\n## Examples\n\n```js\n// simple substitution\nlet id = 1234;\ndriver.run(cypher`MATCH (person:Person { id: ${id} }) RETURN person`)\n\n// skips undefined or null expressions\n// the following expression is equivalent to the first\nlet u = undefined;\nlet n = null;\ndriver.run(cypher`\n  MATCH (person:Person { id: ${id} })\n  ${u \u0026\u0026 'WHERE person.firstname = \"Barney\"'}\n  ${n \u0026\u0026 'ORDER BY person.id'}\n  RETURN person\n`)\n\n// supports infinitely nestable templates\nlet brother = 2345\ndriver.run(cypher`\n  MATCH (person:Person)\n  WHERE person.id = ${id}\n  ${brother \u0026\u0026 cypher`\n    AND EXISTS {\n      MATCH (person)-[:BROTHER]-\u003e(:Person { id: ${brother} })\n    }\n  `}\n  RETURN person\n`)\n```\n\n## How it works\n\nThe `query` and `params` objects passed to the driver are constructed by converting values in the tagged template into parameter keys e.g. `p_1`, `p_2` and adding those to the `params` object.\n\nUsing the example from earlier, we can see the corresponding output:\n\n```js\nlet id = 1234\nlet brother = 2345\ncypher`\n  MATCH (person:Person)\n  WHERE person.id = ${id}\n  ${brother \u0026\u0026 cypher`\n    AND EXISTS {\n      MATCH (person)-[:BROTHER]-\u003e(:Person { id: ${brother} })\n    }\n  `}\n  RETURN person\n`\n\n{\n  query: `\n    MATCH (person:Person)\n    WHERE person.id = $p_0\n    AND EXISTS {\n      MATCH (person)-[:BROTHER]-\u003e(:Person { id: $p_1 })\n    }\n    RETURN person\n  `,\n  params: { p_0: 1234, p_1: 2345 }\n}\n```\n\n## Contributing\n\nFeel free! This is just getting started.\n\n## Improvements\n\n- [ ] Convert some js types into standard serializable types e.g. Date\n- [ ] Strongly type params for better inspection\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneverstew%2Fcypher-template-strings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneverstew%2Fcypher-template-strings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneverstew%2Fcypher-template-strings/lists"}