# filesMan **Repository Path**: chonger0819/files-man ## Basic Information - **Project Name**: filesMan - **Description**: No description available - **Primary Language**: Go - **License**: 0BSD - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-05-10 - **Last Updated**: 2026-01-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # filesMan 生成注释: ``` // GetUser godoc // @Summary 获取用户信息 // @Description 获取指定ID的用户信息 // @Tags user // @Accept json // @Produce json // @Param id path int true "用户ID" // @Success 200 {object} User "成功获取用户信息" // @Router /user/{id} [get] func GetUser(c *gin.Context) { id := c.Param("id") // 你的逻辑代码... } 更新参数信息: swag init --parseDependency --parseInternal --generalInfo ./main.go ``` ## 1、接口访问说明: ``` http://127.0.0.1:8080/swagger/index.html ``` ## 2、查看文件列表: ``` http://127.0.0.1:8080/ http://127.0.0.1:8080/browse ``` ## 3、上传文件: 参考examples中的实现: ``` url = 'http://127.0.0.1:8080/upload' file_path = 'D:\\work\\gosrc\\files-man\\uploads\\3.jpg' data = { 'formData': '{"data":"test_python"}', } files = { 'file': (file_path, open(file_path, 'rb')) } response = requests.post(url, data=data, files=files) print(f"resp data:{response.text}") ``` ## 4、下载文件访问接口 下载文件如:http://127.0.0.1:8080/v1/ng/test.txt 后续文件只需要添加该后缀即可 > router.GET("/ng/*path", man.download3) ## gentool 使用 如果没有该工具则需要首先安装该工具 go install gorm.io/gen/tools/gentool@latest ``` gentool -c file_man_gen.yml ``` ``` --help Usage of gentool: -c string is path for gen.yml -db string input mysql|postgres|sqlite|sqlserver|clickhouse. consult[https://gorm.io/docs/connecting_to_the_database.html] (default "mysql") -dsn string consult[https://gorm.io/docs/connecting_to_the_database.html] -fieldCoverable generate with pointer when field has default value -fieldNullable generate with pointer when field is nullable -fieldSignable detect integer field's unsigned type, adjust generated data type -fieldWithIndexTag generate field with gorm index tag -fieldWithTypeTag generate field with gorm column type tag -modelPkgName string generated model code's package name -onlyModel only generate models (without query file) -outFile string query code file name, default: gen.go -outPath string specify a directory for output (default "./dao/query") -tables string enter the required data table or leave it blank -withUnitTest generate unit test for query code ```