{"id":15062173,"url":"https://github.com/lupennat/lupdo-mysql","last_synced_at":"2026-01-23T17:33:57.283Z","repository":{"id":65133157,"uuid":"581481881","full_name":"Lupennat/lupdo-mysql","owner":"Lupennat","description":"Lupdo driver for MySQL \u0026 MariaDB","archived":false,"fork":false,"pushed_at":"2024-09-27T13:12:08.000Z","size":252,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T00:23:22.891Z","etag":null,"topics":["abstraction-layer","database","lupdo","mariadb","mysql","mysql56","mysql57","mysql8","nodejs","pdo","transactions"],"latest_commit_sha":null,"homepage":"","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/Lupennat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-12-23T10:10:21.000Z","updated_at":"2024-09-27T13:12:12.000Z","dependencies_parsed_at":"2023-12-26T14:21:25.429Z","dependency_job_id":"2d69b41d-d534-4502-bf97-f800e8991b89","html_url":"https://github.com/Lupennat/lupdo-mysql","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"7482ba51c131c2d1e4d7fcc348a2f733964c0450"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lupennat%2Flupdo-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lupennat%2Flupdo-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lupennat%2Flupdo-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lupennat%2Flupdo-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lupennat","download_url":"https://codeload.github.com/Lupennat/lupdo-mysql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248198878,"owners_count":21063627,"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":["abstraction-layer","database","lupdo","mariadb","mysql","mysql56","mysql57","mysql8","nodejs","pdo","transactions"],"created_at":"2024-09-24T23:31:37.749Z","updated_at":"2026-01-23T17:33:57.241Z","avatar_url":"https://github.com/Lupennat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n \u003ca href=\"https://www.npmjs.com/package/lupdo-mysql\" target=\"__blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/v/lupdo-mysql?color=0476bc\u0026label=\" alt=\"NPM version\"\u003e\n    \u003c/a\u003e\n \u003ca href=\"https://www.npmjs.com/package/lupdo-mysql\" target=\"__blank\"\u003e\n        \u003cimg alt=\"NPM Downloads\" src=\"https://img.shields.io/npm/dm/lupdo-mysql?color=3890aa\u0026label=\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://app.codecov.io/github/Lupennat/lupdo-mysql\" target=\"__blank\"\u003e\n        \u003cimg src=\"https://codecov.io/github/Lupennat/lupdo-mysql/branch/main/graph/badge.svg?token=IOOU3AW039\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://snyk.io/test/github/lupennat/lupdo-mysql\" target=\"__blank\"\u003e\n        \u003cimg src=\"https://snyk.io/test/github/lupennat/lupdo-mysql/badge.svg\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n# Lupdo-mysql\n\n[Lupdo](https://www.npmjs.com/package/lupdo) Driver For Mysql.\\\n[Api](https://lupdo-mysql.lupennat.com/api/functions/createMysqlPdo.html)\n\n## Supported Databases\n\n- [mysql](https://www.mysql.com/) (v5.6, 5.7, 8)\n- [mariadb](https://mariadb.org/) (v10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11)\n\n## Third Party Library\n\nLupdo-mysql, under the hood, uses stable and performant npm packages:\n\n- [mysql2](https://github.com/sidorares/node-mysql2)\n\n## Usage\n\nBase Example\n\n```js\nconst { createMysqlPdo } = require('lupdo-mysql');\n// ES6 or Typescrypt\nimport { createMysqlPdo } from 'ludpo-mysql';\n\nconst pdo = createMysqlPdo(\n    {\n        host: 'localhost',\n        port: 3306,\n        user: 'user',\n        password: 'password',\n        database: 'database'\n    },\n    { min: 2, max: 3 }\n);\n\nconst run = async () =\u003e {\n    const statement = await pdo.query('SELECT 2');\n    const res = statement.fetchArray().all();\n    console.log(res);\n    await pdo.disconnect();\n};\n\nrun();\n```\n\n## Driver Options\n\n[https://github.com/mysqljs/mysql#connection-options](https://github.com/mysqljs/mysql#connection-options)\n\n\u003e **Note**\n\u003e The `host` option also accepts a list of `host:port` the pool will generate the connection using a random host from the list.\n\n## Mysql2 Overrides\n\nBy default Ludpo-mysql overrides user connection options with this:\n\n```ts\n{\n    rowsAsArray: true,\n    namedPlaceholders: true,\n    dateStrings: false,\n    supportBigNumbers: true,\n    bigNumberStrings: true,\n    decimalNumbers: false,\n    typeCast: typeCast,\n    timezone: 'Z',\n    stringifyObjects: true,\n    multipleStatements: false,\n    trace: false,\n    flags: [],\n    queryFormat: undefined,\n    debug: ${ATTR_DEBUG}\n}\n```\n\nLupdo-mysql has a custom type parser\n\n- `boolean` are returned as number 1 or 0.\n- `bigint` are returned as number or BigInt when necessary.\n- `binary` and `blob` are returned as Buffer.\n- `zerofill` numbers are returned as string.\n- all `geometry` are returned as json string, coordinates are identified as x,y.\n- all others types are always returned as string.\n\n## Parameters Binding\n\nLupdo-mysql ignore type definition of `TypeBinding` parameter.\\\nLupdo-mysql does not support array of parameters.\n\n## Mysql Named Parameter\n\nLupdo-mysql support named parameter with syntax `:name`, the support is guaranteed only if all placeholder have a binding.\\\n\n## Mysql Numeric Parameter\n\nLupdo-mysql support numeric parameter with syntax `?`.\n\n## Timezone and Charset\n\nLupdo-mysql default `charset` is `UTF8MB4_UNICODE_CI`, you can override through config.\n\nLupdo-mysql force `mysql2` timezone to `Z`, javascript `Date` bindings for timestamp will be converted in String using UTC timezone.\n\n\u003e **Warning**\n\u003e If you want to store an exact timestamp, you must bind a string or a UTC date like `new Date(Date.UTC(2023, 0, 1, 23, 22, 20, 123))`; using `new Date('2023-01-01 23:22:20.123')` will generate a UTC date based on OS timezone.\n\nYou can assign Mysql timezone through lupdo create callback in this way.\n\n```ts\nconst { createMysqlPdo } = require('lupdo-mysql');\n// ES6 or Typescrypt\nimport { createMysqlPdo } from 'ludpo-mysql';\n\nconst pdo = createMysqlPdo(\n    {\n        host: 'localhost',\n        port: 3306,\n        user: 'user',\n        password: 'password',\n        database: 'database'\n    },\n    {\n        min: 2,\n        max: 3,\n        created: async (uuid, connection) =\u003e {\n            await connection.query(\"SET time_zone='Europe/Rome';\");\n        }\n    }\n);\n```\n\n## Kill Connection\n\nLupdo-mysql support kill query.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flupennat%2Flupdo-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flupennat%2Flupdo-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flupennat%2Flupdo-mysql/lists"}