This commit is contained in:
新亮
2021-06-12 16:19:29 +08:00
parent 6d9a07f5dd
commit a3607106d3
20 changed files with 84 additions and 46 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
package code
// 错误时返回结构
// Failure 错误时返回结构
type Failure struct {
Code int `json:"code"` // 业务码
Message string `json:"message"` // 描述信息
+1 -2
View File
@@ -4,8 +4,7 @@ import (
"context"
"github.com/xinliangnote/go-gin-api/internal/graph/model"
"github.com/pkg/errors"
"github.com/xinliangnote/go-gin-api/pkg/errors"
)
func (r *queryResolver) BySex(ctx context.Context, sex string) ([]*model.User, error) {
+1 -1
View File
@@ -14,11 +14,11 @@ import (
"github.com/xinliangnote/go-gin-api/pkg/color"
"github.com/xinliangnote/go-gin-api/pkg/env"
"github.com/xinliangnote/go-gin-api/pkg/errno"
"github.com/xinliangnote/go-gin-api/pkg/errors"
"github.com/xinliangnote/go-gin-api/pkg/trace"
"github.com/gin-contrib/pprof"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus/promhttp"
cors "github.com/rs/cors/wrapper/gin"
ginSwagger "github.com/swaggo/gin-swagger"
+1 -1
View File
@@ -5,8 +5,8 @@ import (
"time"
"github.com/xinliangnote/go-gin-api/configs"
"github.com/xinliangnote/go-gin-api/pkg/errors"
"github.com/pkg/errors"
"gorm.io/driver/mysql"
"gorm.io/gorm"
"gorm.io/gorm/schema"
@@ -9,9 +9,8 @@ import (
"github.com/xinliangnote/go-gin-api/internal/pkg/cache"
"github.com/xinliangnote/go-gin-api/internal/pkg/core"
"github.com/xinliangnote/go-gin-api/pkg/errno"
"github.com/xinliangnote/go-gin-api/pkg/errors"
"github.com/xinliangnote/go-gin-api/pkg/token"
"github.com/pkg/errors"
)
const reSubmitMark = "1"
@@ -27,11 +27,13 @@ func (h *handler) GormExecute() core.HandlerFunc {
mysqlConf := configs.Get().MySQL.Read
shellPath := fmt.Sprintf("%s %s %s %s %s %s", gormgenSh, mysqlConf.Addr, mysqlConf.User, mysqlConf.Pass, mysqlConf.Name, req.Tables)
// runtime.GOOS = linux or darwin
command := exec.Command("/bin/bash", "-c", shellPath)
command := new (exec.Cmd)
if runtime.GOOS == "windows" {
command = exec.Command("cmd", "/C", shellPath)
} else {
// runtime.GOOS = linux or darwin
command = exec.Command("/bin/bash", "-c", shellPath)
}
var stderr bytes.Buffer
@@ -25,11 +25,13 @@ func (h *handler) HandlerExecute() core.HandlerFunc {
shellPath := fmt.Sprintf("%s %s", handlergenSh, req.Name)
// runtime.GOOS = linux or darwin
command := exec.Command("/bin/bash", "-c", shellPath)
command := new (exec.Cmd)
if runtime.GOOS == "windows" {
command = exec.Command("cmd", "/C", shellPath)
} else {
// runtime.GOOS = linux or darwin
command = exec.Command("/bin/bash", "-c", shellPath)
}
var stderr bytes.Buffer
@@ -12,11 +12,13 @@ func (h *handler) Restart() core.HandlerFunc {
return func(c core.Context) {
shellPath := "./scripts/restart.sh"
// runtime.GOOS = linux or darwin
command := exec.Command("/bin/bash", "-c", shellPath)
command := new (exec.Cmd)
if runtime.GOOS == "windows" {
command = exec.Command("cmd", "/C", shellPath)
} else {
// runtime.GOOS = linux or darwin
command = exec.Command("/bin/bash", "-c", shellPath)
}
var stderr bytes.Buffer