{"id":17159155,"url":"https://github.com/scull7/bs-mysql2","last_synced_at":"2025-10-29T14:44:46.316Z","repository":{"id":38291133,"uuid":"119230065","full_name":"scull7/bs-mysql2","owner":"scull7","description":"Bindings to the mysql2 library","archived":false,"fork":false,"pushed_at":"2023-01-04T19:32:39.000Z","size":37966,"stargazers_count":8,"open_issues_count":11,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-16T18:31:08.311Z","etag":null,"topics":["bucklescript","bucklescript-bindings","mariadb","mysql","node-mysql2","reasonml"],"latest_commit_sha":null,"homepage":null,"language":"Reason","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/scull7.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-01-28T05:16:29.000Z","updated_at":"2022-02-22T00:23:23.000Z","dependencies_parsed_at":"2023-02-02T20:15:47.413Z","dependency_job_id":null,"html_url":"https://github.com/scull7/bs-mysql2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/scull7/bs-mysql2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Fbs-mysql2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Fbs-mysql2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Fbs-mysql2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Fbs-mysql2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scull7","download_url":"https://codeload.github.com/scull7/bs-mysql2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scull7%2Fbs-mysql2/sbom","scorecard":{"id":806683,"data":{"date":"2025-08-11","repo":{"name":"github.com/scull7/bs-mysql2","commit":"041830becb2c245b8ad92e0ac7002ce4a0a362ea"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"40 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-mqr2-w7wj-jjgr","Warn: Project is vulnerable to: GHSA-49j4-86m8-q2jw","Warn: Project is vulnerable to: GHSA-fpw7-j2hg-69v5","Warn: Project is vulnerable to: GHSA-4rch-2fh8-94vw","Warn: Project is vulnerable to: GHSA-pmh2-wpjm-fj45","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-6fw4-hr69-g3rv","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-3f95-r44v-8mrg","Warn: Project is vulnerable to: GHSA-28xr-mwxg-3qc8","Warn: Project is vulnerable to: GHSA-9p95-fxvg-qgq2","Warn: Project is vulnerable to: GHSA-9w5j-4mwv-2wj8","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T11:58:41.031Z","repository_id":38291133,"created_at":"2025-08-23T11:58:41.031Z","updated_at":"2025-08-23T11:58:41.031Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273853614,"owners_count":25179882,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"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":["bucklescript","bucklescript-bindings","mariadb","mysql","node-mysql2","reasonml"],"created_at":"2024-10-14T22:13:29.552Z","updated_at":"2025-10-29T14:44:41.257Z","avatar_url":"https://github.com/scull7.png","language":"Reason","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM](https://nodei.co/npm/bs-mysql2.png)](https://nodei.co/npm/bs-mysql2/)\n[![Build Status](https://travis-ci.org/scull7/bs-mysql2.svg?branch=master)](https://travis-ci.org/scull7/bs-mysql2)\n[![Coverage Status](https://coveralls.io/repos/github/scull7/bs-mysql2/badge.svg)](https://coveralls.io/github/scull7/bs-mysql2)\n\n# bs-mysql2\n\nReasonML bindings to the [mysql2] library.\n\nThis is a very rough implementation that will enable very simple use cases.\n\nInitially this was just a copy of [bs-mysql].\n\n## Why?\n\nThe main difference between these bindings and the [bs-mysql] bindings is the\nuse of the [mysql2] library / driver over the [mysql] (version 1) driver. You\ncan see the reasoning behind the new [mysql2] driver here:\n[History and Why MySQL2][mysql2-features]\n\n### Version 2\n\nVersion 2 of this driver removed most of the API surface area. This is now\nintended as a module which better interfaces are built on top of, yet it still\nquite usable.\n\nHowever, if you are looking for a higher level interface then you should look\nat the [bs-sql-common] library. This library can be used along side\n[bs-sql-common] as a data provider.\n\n## Status\n\nNot all of the [mysql2] library [features][mysql2-features] are implemented but\nthere is a usable implementation of the [Promise based wrapper](#promise-interface)\nand [Named Placeholders](#named-placeholders).\n\n- [x] Faster / Better Performance (_kind of get this for free_)\n- [x] [Prepared Statements][mysql2-prepared-statements] - [examples](#prepared-statements)\n- [ ] MySQL Binary Log Protocol\n- [ ] [MySQL Server][mysql2-server]\n- [ ] Extended support for Encoding and Collation\n- [ ] [Promise Wrapper][mysql2-promise] - [examples](#promise-interface)\n- [ ] Compression\n- [ ] SSL and [Authentication Switch][mysql2-auth-switch]\n- [ ] [Custom Streams][mysql2-custom-streams]\n- [ ] Pooling\n\n**_NOTE:_** If you're trying to run the tests on macOS then you will need to:\n` brew install watchman`\n\n## Usage\n\n### Standard Callback Interface\n\n#### Standard Query Method\n\n```reason\nlet conn\n  = MySql2.Connection.connect(~host=127.0.0.1, ~port=3306, ~user=\"root\", ());\n\nMySql2.execute(conn, \"SHOW DATABASES\", None, res =\u003e {\n    switch res {\n    | `Error(e) =\u003e Js.log2(\"ERROR: \", e)\n    | `Select(select) =\u003e Js.log2(\"SELECT: \", select)\n    | `Mutation(mutation) =\u003e Js.log2(\"MUTATION: \", mutation)\n    }\n  MySql2.close(conn);\n});\n\n```\n\n#### Prepared Statements\n\n##### Named Placeholders\n\n```reason\nlet conn\n  = MySql2.Connect.connect(~host=127.0.0.1, ~port=3306, ~user=\"root\", ());\n\nlet named = MySql2.Params.named(\n  Json.Encode.object_([\n    (\"x\", Json.Encode.int(1)),\n    (\"y\", Json.Encode.int(2)),\n  ])\n);\n\nMySql2.execute(conn, \"SELECT :x + :y AS result\", Some(named), res =\u003e {\n    switch res {\n    | `Error(e) =\u003e Js.log2(\"ERROR: \", e)\n    | `Select(select) =\u003e Js.log2(\"SELECT: \", select)\n    | `Mutation(mutation) =\u003e Js.log2(\"MUTATION: \", mutation)\n    }\n  }\n  MySql2.close(conn);\n});\n```\n\n##### Unnamed Placeholders\n\n```reason\nlet conn\n  = MySql2.Connection.connect(~host=127.0.0.1, ~port=3306, ~user=\"root\", ());\n\nlet positional = MySql2.Params.positional(\n  Belt_Array.map([|5, 6|], Json.Encode.int) |\u003e Json.Encode.jsonArray\n);\n\nMySql2.execute(conn, \"SELECT 1 + ? + ? AS result\", Some(positional), res =\u003e {\n    switch res {\n    | `Error(e) =\u003e Js.log2(\"ERROR: \", e)\n    | `Select(rows, meta) =\u003e Js.log2(\"SELECT: \", rows, meta)\n    | `Mutation(count, id) =\u003e Js.log2(\"MUTATION: \", count, id)\n    }\n  }\n  MySql2.close(conn);\n});\n```\n\n## How do I install it?\n\nInside of a BuckleScript project:\n\n```shell\nyarn install --save bs-mysql2 @glennsl/bs-json\n```\n\nThen add `bs-mysql2` and `@glennsl/bs-json` to your `bs-dependencies` in `bsconfig.json`:\n\n```json\n{\n  \"bs-dependencies\": [\"bs-mysql2\", \"@glennsl/bs-json\"]\n}\n```\n\n## How do I use it?\n\n`bs-mysql2` examples assume that there is:\n\n- a datatabase named test inside mysql: create it by running `create database test`\n- you are using `mysql_native_password` as authentication for the root user\n  - see https://stackoverflow.com/questions/50093144/mysql-8-0-client-does-not-support-authentication-protocol-requested-by-server\n\n### Use it in your project\n\nSee the [Usage](#usage) section above...\n\n### Run the examples\n\n```shell\nyarn run examples:simple\n```\n\n```shell\nyarn run examples:prepared-statements\n```\n\n## What's missing?\n\nMostly everything...\n\n[bs-mysql]: https://github.com/davidgomes/bs-mysql\n[bs-sql-common]: https://github.com/scull7/bs-sql-common\n[mysql]: https://www.npmjs.com/package/mysql\n[mysql2]: https://www.npmjs.com/package/mysql2\n[mysql2-features]: https://github.com/sidorares/node-mysql2#history-and-why-mysql2\n[mysql2-prepared-statements]: https://github.com/sidorares/node-mysql2/tree/master/documentation/Prepared-Statements.md\n[mysql2-server]: https://github.com/sidorares/node-mysql2/tree/master/documentation/MySQL-Server.md\n[mysql2-promise]: https://github.com/sidorares/node-mysql2/tree/master/documentation/Promise-Wrapper.md\n[mysql2-auth-switch]: https://github.com/sidorares/node-mysql2/tree/master/documentation/Authentication-Switch.md\n[mysql2-custom-streams]: https://github.com/sidorares/node-mysql2/tree/master/documentation/Extras.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscull7%2Fbs-mysql2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscull7%2Fbs-mysql2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscull7%2Fbs-mysql2/lists"}