{"id":27044786,"url":"https://github.com/berkaroad/saashard","last_synced_at":"2025-08-16T23:46:56.787Z","repository":{"id":57528938,"uuid":"54751371","full_name":"berkaroad/saashard","owner":"berkaroad","description":"根据具体业务数据的划分，实现db级别的数据分片拆分。思路来源mycat和kingshard。","archived":false,"fork":false,"pushed_at":"2018-09-06T09:09:36.000Z","size":2936,"stargazers_count":31,"open_issues_count":6,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-06-20T10:13:32.747Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/berkaroad.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":"2016-03-25T22:35:44.000Z","updated_at":"2024-05-14T03:20:05.000Z","dependencies_parsed_at":"2022-09-10T17:11:20.801Z","dependency_job_id":null,"html_url":"https://github.com/berkaroad/saashard","commit_stats":null,"previous_names":["berkaroad/bdsharding"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berkaroad%2Fsaashard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berkaroad%2Fsaashard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berkaroad%2Fsaashard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berkaroad%2Fsaashard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berkaroad","download_url":"https://codeload.github.com/berkaroad/saashard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247293915,"owners_count":20915327,"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":[],"created_at":"2025-04-05T05:30:07.034Z","updated_at":"2025-04-05T05:30:07.722Z","avatar_url":"https://github.com/berkaroad.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SaaShard\r\n[中文版](README.zh-CN.md \"中文版\")\r\n\r\nSaaShard is a MySQL sharding solution, that based on SaaS application.\r\n\r\nSaaS application, use multi-tenancy technologyis.\r\nEach tenancy's data is isolated from db logically.For this feature, we can horizontal split data by the field 'tenant_id'.\r\nEach sql statement that related with special tenancy, is only located at single db. So, we can remain the query capability as soon as possible.\r\n\r\n## Compile and Run\r\n\r\n### Source\r\n```\r\ngo get github.com/berkaroad/saashard\r\ncd $GOPATH/src/github.com/berkaroad/saashard\r\n```\r\n\r\n### Binary Release\r\n[http://github.com/berkaroad/saashard-binary](http://github.com/berkaroad/saashard-binary \"SaaShard Binary\")\r\n\r\n[https://github.com/berkaroad/docker-images/tree/master/saashard](https://github.com/berkaroad/docker-images/tree/master/saashard \"SaaShard Dockerfile\")\r\n\r\n### Compile\r\n\r\n```\r\nmake # compile in current platform\r\nmake build-all # compile in windows, linux and darwin platform.\r\n```\r\n\r\n### Run\r\n\r\n```\r\nmake test # just for test\r\nmake dev # Run immediately, use dev.yaml config file.\r\nmake run # Run immediately, use ss.yaml config file.\r\n```\r\n\r\n## Features\r\n- Support multi-query and multi-result.\r\n- Support transaction.\r\n- Support hint /*!saashard master */ to force execute on master.\r\n- Support hint /*!saashard nodes=node1,node2 */ to force specify node list in DDL statement.\r\n- Support split read and write. (Read balance use polling algorithm.)\r\n- Support database sharding, supported algorithm is 'hash', 'mod'.\r\n- Support backend connection pool.\r\n- Support Stmt related command.(developing)\r\n\r\n## SQL Client Support \r\n- MySQL Workbench (tested version:6.3)\r\n- SQLyog (tested version:10.2)\r\n- ado.net\r\n- entity framework (EF6)\r\n\r\n## SQL Support\r\n\r\n- simple query, join query, sub query is supported.\r\n- DML statement\r\n- DDL that only support table struct and index.\r\n- VIEW is not supported, because it couldn't get shard key's value from those.\r\n- maintain FUNCTION, PROCEDURE or TRIGGER is not supported.\r\n\r\n```\r\n/* Not supported, but you can replace it to above */\r\nselect (case t1.f1 when '0' then 'hello' else 'world' end) f1 from t1;\r\n\r\n/* This is supported */\r\nselect (case when t1.f1='0' then 'hello' else 'world' end) f1 from t1;\r\n```\r\n\r\n```\r\n/* Not supported, because this is dml statement, and couldn't get shard key's value. */\r\nselect f1,f2,f3 into t2 from t1\r\n```\r\n\r\n## Logical Architecture\r\n\r\n![logical architecture](docs/images/logical_arch.png \"logical architecture\")\r\n\r\n![logical schema](docs/images/logical_schema.png \"logical schema\")\r\n\r\n## Contact Info\r\n\r\n1. QQ Group: SaaShard 487761803\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberkaroad%2Fsaashard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberkaroad%2Fsaashard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberkaroad%2Fsaashard/lists"}