{"id":17462106,"url":"https://github.com/arthurpaulino/leanmysql","last_synced_at":"2025-04-19T19:03:21.340Z","repository":{"id":43256674,"uuid":"430957247","full_name":"arthurpaulino/LeanMySQL","owner":"arthurpaulino","description":"A MySQL API for Lean 4","archived":false,"fork":false,"pushed_at":"2022-03-11T16:58:44.000Z","size":115,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T12:02:56.285Z","etag":null,"topics":["lean4","mysql"],"latest_commit_sha":null,"homepage":"","language":"Lean","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arthurpaulino.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":"2021-11-23T04:23:45.000Z","updated_at":"2024-03-18T16:08:09.000Z","dependencies_parsed_at":"2022-09-08T06:41:18.872Z","dependency_job_id":null,"html_url":"https://github.com/arthurpaulino/LeanMySQL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurpaulino%2FLeanMySQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurpaulino%2FLeanMySQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurpaulino%2FLeanMySQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurpaulino%2FLeanMySQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arthurpaulino","download_url":"https://codeload.github.com/arthurpaulino/LeanMySQL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249239307,"owners_count":21235838,"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":["lean4","mysql"],"created_at":"2024-10-18T07:42:13.521Z","updated_at":"2025-04-16T12:31:00.855Z","avatar_url":"https://github.com/arthurpaulino.png","language":"Lean","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LeanMySQL\n\nThis Lean 4 package provides an API for the MySQL database.\n\nUsage example:\n\n```lean\nimport LeanMySQL\n\ndef main : IO Unit := do\n  let mysql ← MySQL.mk\n  IO.println $ mysql.version\n  mysql.login \"localhost\" \"root\" \"root\"\n  mysql.createDB \"test_db\"\n  mysql.useDB \"test_db\"\n\n  mysql.createTable \"job\" [\n    (\"id\", \"INT PRIMARY KEY\"),\n    (\"job_name\", \"VARCHAR(255)\")\n  ]\n  mysql.insertIntoTable \"job\" [1, \"Computer Scientist\"]\n  mysql.insertIntoTable \"job\" [2, \"Mathematician\"]\n\n  mysql.createTable \"person\" [\n      (\"id\", \"INT PRIMARY KEY\"),\n      (\"name\", \"VARCHAR(255)\"),\n      (\"age\", \"INT\"),\n      (\"height\", \"FLOAT\"),\n      (\"job_id\", \"INT\"),\n      (\"country_id\", \"INT\")\n    ]\n  mysql.insertIntoTable \"person\" [1, \"Alice\", 20, 1.72, 1, 1]\n  mysql.insertIntoTable \"person\" [2, \"Bob\", 21, 1.64, 2, 3]\n  mysql.insertIntoTable \"person\" [3, \"Craig\", 22, 1.76, NULL, 2]\n\n  let df ← mysql.query $\n    SELECT name, age, height, job_name\n    FROM person LEFT JOIN job ON person.job_id = job.id\n    WHERE person.age \u003e 20\n\n  IO.println $ df\n\n  mysql.close\n```\n\nThe example above prints out:\n\n```\n8.0.28\n|   name|age|height|       job_name|\n|-------|---|------|---------------|\n|  'Bob'| 21|  1.64|'Mathematician'|\n|'Craig'| 22|  1.76|           NULL|\n```\n\n## What's next?\n\n* Allow queries on the `FROM` clause (nested queries)\n* Expand the implicit join so it can accept multiple sources, not just two\n\nFeel free to contribute! :D\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurpaulino%2Fleanmysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farthurpaulino%2Fleanmysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurpaulino%2Fleanmysql/lists"}