# artisan **Repository Path**: code-emotion/artisan ## Basic Information - **Project Name**: artisan - **Description**: 项目工具 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2023-05-10 - **Last Updated**: 2024-03-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # artisan ### 生成 resource ```shell artisan make resource 资源名 --action="show,update,destroy,list,create" --type=0 ``` #### 生成 repository ```shell artisan make resource 资源名 ``` #### 生成 model ```shell artisan make resource 资源名 ``` #### 生成 logic ```shell artisan make resource 资源名 --action="show,update,destroy,list,create" --type=0 ``` #### 生成 handler ```shell artisan make handler 资源名 --action="show,update,destroy,list,create" --type=0 ``` #### 生成 router ```shell artisan make router 资源名 --action="show,update,destroy,list,create" --type=0 ``` #### 配置:config.yaml `UserHomeDir/.artisan/config.yaml` 或者 当前目录下配置 `./config.yaml` ```yaml Root: . HandlerDir: api/internal/handler LogicDir: api/internal/logic RouterDir: api/internal/router ModelDir: model RepositoryDir: repository DSN: "saas:123456@tcp(192.168.1.211:3306)/saas_kd_tenant?charset=utf8mb4&parseTime=True&loc=Local" Actions: - show - list - update - destroy - create ``` #### 参数说明: > `--type` 缩写 `-t` 。可选值:`0`和`1`。 > 0: 只生成 `action` 选项内填写的 操作。 > 1:排除 `action` 选项的内容。 > `--action` 缩写 `-a`: > 可选值: `destroy`, `show`, `update`, `create`, `list`。 > 默认不填写,则生成所有的 actions。 ### todo 1. repository 支持 search 简单生成规则 name => like phone=>eq mobile => equal status => eq type => eq *_name => like *_id => eq pid => eq 2. model 层支持自定义合并规则 id, created_at, updated_at, deleted_at => database.Model 3. handler 的 request 结构体, * **唯一键**验证 * **存在性**验证 4. handler 支持 filter 生成 name => like phone=>eq mobile => equal status => eq type => eq *_id => eq pid => eq