From 9c15f6eddc90530397b5fa48b2d0caa82a6a6306 Mon Sep 17 00:00:00 2001 From: "vilet.yy" Date: Tue, 6 Apr 2021 10:35:28 +0800 Subject: [PATCH] fix fix --- README.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++- utils/response.go | 6 ++++- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f1cb3a..d4a62ad 100644 --- a/README.md +++ b/README.md @@ -1 +1,58 @@ -# potato \ No newline at end of file + +# Potato + +[![viletyy potato](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/viletyy/potato) + +Go项目脚手架 + +基于gin、gorm、zap的脚手架 + +本脚手架包含以下内容: + +1. mvc结构。 +2. swagger接口文档。 +3. 配置、数据库、redis、日志、工具库封装。 +4. 单点登陆(jwt)。 + +## 内容列表 + +- [安装](#安装) +- [使用说明](#使用说明) +- [相关仓库](#相关仓库) +- [如何贡献](#如何贡献) +- [使用许可](#使用许可) + +## 安装 + +这个项目使用 [go](https://golang.org/) 和 [swag](https://github.com/swaggo/swag)。请确保你本地安装了它们。 + +```sh +$ tar -C /usr/local -xzf go1.4.linux-amd64.tar.gz +$ export PATH=$PATH:/usr/local/go/bin +``` + +## 使用说明 + +```sh +$ go build -o potato main.go +$ ./potato +``` + +## 相关仓库 + +- [Gin](https://github.com/gin-gonic/gin) — Web Framework +- [Gorm](https://github.com/jinzhu/gorm) — ORM + +## 如何贡献 + +非常欢迎你的加入![提一个 Issue](https://github.com/viletyy/potato/issues/new) 或者提交一个 Pull Request。 + + +## 使用许可 + +[MIT](LICENSE) © Viletyy diff --git a/utils/response.go b/utils/response.go index 6cdf7f1..ba43cd0 100644 --- a/utils/response.go +++ b/utils/response.go @@ -1,7 +1,7 @@ /* * @Date: 2021-03-22 18:51:29 * @LastEditors: viletyy - * @LastEditTime: 2021-03-22 18:54:59 + * @LastEditTime: 2021-04-06 09:36:05 * @FilePath: /potato/utils/response.go */ package utils @@ -55,6 +55,10 @@ func FailWithMessage(message string, c *gin.Context) { Result(ERROR, map[string]interface{}{}, message, c) } +func FailWithData(data interface{}, c *gin.Context) { + Result(ERROR, data, "操作失败", c) +} + func FailWithDetailed(data interface{}, message string, c *gin.Context) { Result(ERROR, data, message, c) }