{"id":24926922,"url":"https://github.com/divedylan/sandfish","last_synced_at":"2025-06-12T04:35:50.073Z","repository":{"id":106197745,"uuid":"374923796","full_name":"diveDylan/sandfish","owner":"diveDylan","description":"tools connected table(antd) and mysql, enums","archived":false,"fork":false,"pushed_at":"2021-07-01T14:58:10.000Z","size":199,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T07:58:55.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/diveDylan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","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":"2021-06-08T07:38:47.000Z","updated_at":"2023-03-07T07:14:06.000Z","dependencies_parsed_at":"2023-04-29T13:00:34.051Z","dependency_job_id":null,"html_url":"https://github.com/diveDylan/sandfish","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/diveDylan/sandfish","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diveDylan%2Fsandfish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diveDylan%2Fsandfish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diveDylan%2Fsandfish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diveDylan%2Fsandfish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diveDylan","download_url":"https://codeload.github.com/diveDylan/sandfish/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diveDylan%2Fsandfish/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259398671,"owners_count":22851479,"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-02-02T12:53:57.793Z","updated_at":"2025-06-12T04:35:50.030Z","avatar_url":"https://github.com/diveDylan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sandfish\n\n这是一个根据`mysql`数据库自动生成 antd 的表格列配置、表单配置以及一个枚举自动化创建文件的脚本\n\n\u003e 字典和权限脚本已经单独拆开: [enum-maker](https://github.com/diveDylan/enum-maker)\n\n\u003cimg src=\"https://img.shields.io/travis/com/diveDylan/sandfish?style=plastic\"/\u003e\n\u003cimg src=\"https://img.shields.io/codecov/c/github/diveDylan/sandfish?style=plastic\"/\u003e\n\n### Install\n\n```bash\nnpm install sandfish\n## or\nyarn add sandfish\n\n```\n\n### Usage\n\n\u003e 我们认为用数字命名枚举是不合法且毫无可读性可言的行为，会使系统陷入迭代维护困境。插件会自动为你过滤用数字命名的枚举，\n\n\u003e 如果提示 `Cannot find module 'mysql'`，请安装一下该依赖，因为这个库引用了 `readable-stream` 还有一个暂未关闭的[Circular dependencies](https://github.com/nodejs/readable-stream/issues/348#)，暂时没有将该包打包进去\n\n```js\nconst { generateColumns } = require('sandfish');\nconst config = {\n  connectionConfig: {\n    host: 'localhost',\n    user: 'root',\n    password: '949440946',\n  },\n  dataBaseNames: ['DYLAN'], // 数据库名字\n  outputPath: './tests/.output', // 输出目录\n  ignoreTableNames: ['database_history'], // 不生成表格表单配置的黑名单\n  needFormConfig: true, // 是否需要生成表单配置， 默认关闭\n};\ngenerateColumns(config);\n```\n\n### Columns\n\n在日常表格开发中，我们经常需要根据数据库的列配置书写本地表格的列配置，然后传入我们的`antd/table`组件\n\n```ts\n// code examples\n/**\n * @description 用户名称\n */\nexport const username: ColumnType\u003cstring\u003e = {\n  title: '用户名称',\n  dataIndex: 'username',\n};\n```\n\n### Form\n\n关于表单我们先同步一个概念，表单组件颗粒的定义，如下`UserFormItem`就是一个表单组件颗粒\n\n```typescript\nconst UserFormItem = (\n  \u003cItem name=\"user\" label=\"用户名称\" {...itemProps}\u003e\n    \u003cActionInputComponents\u003e\n  \u003c/Item\u003e\n)\n\n```\n\n如果选用组件开发，颗粒的属性`[name, label]`都可以复用，所以我们会自动生成这部分复用`json`，这时候可能复用率还不够明显。\n如果你是用`formily`，这个配置在`schema json`的复用率会有明显的提升\n\n```typescript\n/**\n * @description 用户名称\n */\nexport const usernameFormConfig: FormConfig = {\n  label: '用户名称',\n  name: 'username',\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivedylan%2Fsandfish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivedylan%2Fsandfish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivedylan%2Fsandfish/lists"}