{"id":31703582,"url":"https://github.com/eairp/mybatis","last_synced_at":"2025-10-27T10:15:19.681Z","repository":{"id":36974177,"uuid":"348009366","full_name":"eairp/mybatis","owner":"eairp","description":"Object relational mapping SQL framework for Rust","archived":false,"fork":false,"pushed_at":"2024-08-26T02:02:18.000Z","size":7119,"stargazers_count":83,"open_issues_count":3,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-21T08:19:42.814Z","etag":null,"topics":["cargo","mapper","mybatis","mybatis-plus","mysql","orm","rust","sqlserver"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eairp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2021-03-15T14:49:21.000Z","updated_at":"2025-05-25T07:22:08.000Z","dependencies_parsed_at":"2023-08-19T11:39:45.861Z","dependency_job_id":"cdf18628-24b0-4398-ab10-284a4a70e1d1","html_url":"https://github.com/eairp/mybatis","commit_stats":null,"previous_names":["summer-rust/summer-mybatis","wansenai/summer-mybatis","wansenai/mybatis","eairps/mybatis","summer-os/summer-mybatis","eairp/mybatis"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/eairp/mybatis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eairp%2Fmybatis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eairp%2Fmybatis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eairp%2Fmybatis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eairp%2Fmybatis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eairp","download_url":"https://codeload.github.com/eairp/mybatis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eairp%2Fmybatis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000684,"owners_count":26082837,"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-10-08T02:00:06.501Z","response_time":56,"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":["cargo","mapper","mybatis","mybatis-plus","mysql","orm","rust","sqlserver"],"created_at":"2025-10-08T22:04:58.328Z","updated_at":"2025-10-08T22:05:01.544Z","avatar_url":"https://github.com/eairp.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MyBatis Rust\n\n![Build Status](https://github.com/rust-lang/book/workflows/CI/badge.svg)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsummer-os%2Fsummer-mybatis.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsummer-os%2Fsummer-mybatis?ref=badge_shield)\n\n\nSummer MyBatis is an ORM framework based on rust language and mybatis framework. It is used to simplify development. Developers do not need to pay attention to complex SQL. They can carry out business development through dynamic SQL dialect. It can save your time. Use \n[sqlx-core crate](https://crates.io/crates/sqlx-core)、\n[tokio crate](https://crates.io/crates/tokio)、\n[rbatis crate](https://crates.io/crates/rbatis)、\n[bson crate](https://crates.io/crates/bson) \nis used for secondary packaging development. \n\nIn addition, its speed is very fast.\n\n\n## Features:\n\n* Cross platform support (linux, macos, windows)\n* No Runtimes，No Garbage Collection\n* Powerful and flexible where conditional wrapper.\n* Support multiple database drivers (mssql, mysql, postgres, sqlite).\n* Support asynchronous operation with tokio.\n* Structure automatic serialization and deserialization.\n\n\n## Getting Started\n\n* Add mybatis dependency\n    \n    ```rust\n    mybatis = { version = \"2.0.4\"}\n    ```\n\n* Example\n    \n    \u003cdetails open=“open”\u003e\n    \u003csummary\u003e Use #[mybatis_plus] macro data table mapping \u003c/summary\u003e\n    \n    ```rust\n    use serde::{Serialize, Deserialize};\n\n    #[mybatis_plus]\n    #[derive(Debug, Serialize, Deserialize)]\n    pub struct Books {\n        pub id: Option\u003cString\u003e,\n        pub name: Option\u003cString\u003e,\n        pub types: Option\u003cString\u003e\n    }\n\n\n    #[cfg(test)]\n    mod tests {\n        use super::*;\n        use mybatis::mybatis::Mybatis;\n        use mybatis::snowflake::SNOWFLAKE;\n        use mybatis::plus::Mapping;\n\n        #[tokio::test]\n        async fn save_books() {\n            let mybatis = Mybatis::new();\n\n            mybatis.link(\"mysql://root:passw0rd@localhost:3306/test\").await.unwrap();\n\n            let id = SNOWFLAKE.generate();\n            let cat = Books {\n                id: Some(id.to_string()),\n                name: Some(\"《Daughter of the sea》\".to_string()),\n                types: Some(\"Fairy Tales\".to_string()),\n            };\n    \n            mybatis.save(\u0026cat,\u0026[]).await;\n        }\n    }\n    ```\n    \u003c/details\u003e\n\n    \u003cdetails\u003e\n    \u003csummary\u003eIf you don't want to use macros, you can create a structure corresponding to the database table and map the method \u003c/summary\u003e\n        \n    ```rust\n    use mybatis::mybatis_sql::string_util::to_snake_name;\n    use mybatis::plus::MybatisPlus;\n    use serde::{Serialize, Deserialize};\n    \n    #[derive(Debug, Serialize, Deserialize)]\n    pub struct Pets {\n      pub id: Option\u003cString\u003e,\n      pub name: Option\u003cString\u003e,\n      pub birthday: Option\u003cmybatis::DateTimeNative\u003e,\n      pub delete_flag: Option\u003ci32\u003e,\n    }\n    \n    impl MybatisPlus for Pets {\n\n      fn table_name() -\u003e String {\n          let type_name = std::any::type_name::\u003cSelf\u003e();\n          let mut name = type_name.to_string();\n          let names: Vec\u003c\u0026str\u003e = name.split(\"::\").collect();\n          name = names.get(names.len() - 1).unwrap_or(\u0026\"\").to_string();\n\n          to_snake_name(\u0026name)\n      }\n\n      fn table_columns() -\u003e String {\n          String::from(\"id,name,birthday,delete_flag\")\n      }\n      \n    }\n    \n    #[cfg(test)]\n    mod tests {\n        use super::*;\n        use mybatis::mybatis::Mybatis;\n        use mybatis::snowflake::SNOWFLAKE;\n        use mybatis::plus::{Skip, Mapping};\n\n        ///\n        /// Save a single object \n        ///\n        #[tokio::test]\n        async fn save_pets() {\n            let mybatis = Mybatis::new();\n\n            mybatis.link(\"mysql://root:passw0rd@localhost:3306/test\").await.unwrap();\n\n            let id = SNOWFLAKE.generate();\n            let cat = Pets {\n                id: Some(id.to_string()),\n                name: Some(\"Cindy\".to_string()),\n                birthday: Some(mybatis::DateTimeNative::now()),\n                delete_flag: Some(0),\n            };\n    \n            mybatis.save(\u0026cat,\u0026[]).await;\n        }\n\n        ///\n        /// Query a single object according to the specified field and return Option\u003cObject\u003e\n        ///\n        #[tokio::test]\n        async fn query_pet_by_name() {\n            let mybatis = Mybatis::new();\n\n            mybatis.link(\"mysql://root:passw0rd@localhost:3306/test\").await.unwrap();\n\n            let result: Option\u003cPets\u003e = mybatis.fetch_by_column(\"name\", \u0026\"Cindy\").await.unwrap();\n            println!(\"result: {:?}\", result);\n        }\n    }\n    ```\n    \u003c/details\u003e\n\n## Community\nIf you have any use questions, you can ask questions in [mybatis discussions](https://github.com/summer-rust/summer-mybatis/discussions) or submit an issue.\n        \n## License\n\nLicensed under either of\n\n * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsummer-os%2Fsummer-mybatis.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsummer-os%2Fsummer-mybatis?ref=badge_large)\n \n## Contribution\n\nSo far, we have only implemented some flexible conditional wrappers for summer-mybatis. We are developing the mapping of XML files and supporting Oracle database driver. If you have any interests and ideas, please submit to PR or contact me.\n\nWe looking for various contributions. Look forward to your contributions!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feairp%2Fmybatis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feairp%2Fmybatis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feairp%2Fmybatis/lists"}