tangs před 4 roky
rodič
revize
3c26aa5e9f

+ 10 - 0
.gitignore

@@ -0,0 +1,10 @@
+# Created by .ignore support plugin (hsz.mobi)
+### Example user template template
+### Example user template
+
+# IntelliJ project files
+.idea
+*.iml
+out
+gen
+shopperthree_manage.yaml

+ 1 - 0
README.md

@@ -0,0 +1 @@
+# shopperthree_mamage_v2

+ 90 - 0
app/boot/cmd.go

@@ -0,0 +1,90 @@
+package boot
+
+import (
+	"fmt"
+	"net/http"
+
+	"github.com/gin-gonic/gin"
+	"github.com/gomodule/redigo/redis"
+	"github.com/spf13/viper"
+	"go.uber.org/zap"
+
+	"shopperthree_manage_v2/app/router"
+	"shopperthree_manage_v2/client/mysql"
+	"shopperthree_manage_v2/client/sredis"
+	"shopperthree_manage_v2/logger"
+)
+
+func Run() {
+	var err error
+	StoreInit()
+	err = InitModel()
+	if err != nil {
+		panic(err)
+	}
+	StartServer()
+}
+
+//初始化相关必要持久化服务
+func StoreInit() {
+	//连接mysql
+	var err error
+	// 连接数据库
+	_, err = mysql.Dial("mysql", viper.GetString("mysql.address"))
+	if err != nil {
+		panic(err)
+	}
+	//初始化redis
+	sredis.MasterPool = &redis.Pool{ //实例化一个连接池
+		MaxIdle: 16, //最初的连接数量
+		// MaxActive:1000000,    //最大连接数量
+		MaxActive:   0,   //连接池最大连接数量,不确定可以用0(0表示自动定义),按需分配
+		IdleTimeout: 300, //连接关闭时间 300秒 (300秒不使用自动关闭)
+		Dial: func() (redis.Conn, error) { //要连接的redis数据库
+			conn, err := redis.Dial("tcp", viper.GetString("redis.master.address"))
+			if err != nil {
+				return nil, err
+			}
+			if viper.GetString("redis.master.password") != "" {
+				_, err = conn.Do("AUTH", viper.GetString("redis.master.password"))
+				if err != nil {
+					return nil, err
+				}
+			}
+			return conn, err
+		},
+	}
+
+	sredis.SalvePool = &redis.Pool{ //实例化一个连接池
+		MaxIdle: 16, //最初的连接数量
+		// MaxActive:1000000,    //最大连接数量
+		MaxActive:   0,   //连接池最大连接数量,不确定可以用0(0表示自动定义),按需分配
+		IdleTimeout: 300, //连接关闭时间 300秒 (300秒不使用自动关闭)
+		Dial: func() (redis.Conn, error) { //要连接的redis数据库
+			conn, err := redis.Dial("tcp", viper.GetString("redis.slave.address"))
+			if err != nil {
+				return nil, err
+			}
+			if viper.GetString("redis.slave.password") != "" {
+
+				_, err = conn.Do("AUTH", viper.GetString("redis.slave.password"))
+				if err != nil {
+					return nil, err
+				}
+			}
+			return conn, err
+		},
+	}
+
+}
+
+//启动服务
+func StartServer() {
+	//
+	r := gin.Default()
+	router.StepRouters(r)
+	addr := fmt.Sprintf("%s:%d", viper.GetString("server.host"), viper.GetInt("server.port"))
+
+	logger.Info(fmt.Sprintf("Http Server has been started. http://%s", addr))
+	logger.Fatal("start http server", zap.Error(http.ListenAndServe(addr, r)))
+}

+ 15 - 0
app/boot/db.go

@@ -0,0 +1,15 @@
+package boot
+
+import (
+	"shopperthree_manage_v2/app/models"
+	"shopperthree_manage_v2/client/mysql"
+)
+
+func InitModel() error {
+	var err = mysql.Client.Master().Set("gorm:table_options", "ENGINE=InnoDB CHARSET=utf8mb4 auto_increment=1").
+		AutoMigrate(
+			&models.TAdmin{},
+			&models.File{},
+		).Error
+	return err
+}

+ 47 - 0
app/business/login.go

@@ -0,0 +1,47 @@
+package business
+
+import (
+	"time"
+
+	"github.com/jinzhu/gorm"
+	"github.com/spf13/viper"
+
+	"shopperthree_manage_v2/app/models"
+	"shopperthree_manage_v2/pkg/ierr"
+	"shopperthree_manage_v2/pkg/jwt"
+	"shopperthree_manage_v2/pkg/util"
+)
+
+func Login(req *models.LoginRequest) (*models.LoginReply, error) {
+	if req.Phone == "" || req.Password == "" {
+		return nil, ierr.NewIError(ierr.ParamErr, "missing key param")
+	}
+	tAdmin := new(models.TAdmin)
+	tAdmin.Phone = req.Phone
+	admin, err := tAdmin.ShowByPhone()
+	if err != nil {
+		if gorm.IsRecordNotFoundError(err) {
+			return nil, ierr.NewIError(ierr.PhoneNotExists, "phone not exists")
+		}
+		return nil, ierr.NewIError(ierr.QueryDataFail, err.Error())
+	}
+	if admin.Password != util.Sha256(req.Password) {
+		return nil, ierr.NewIError(ierr.PasswordErr, "password error")
+	}
+	//密码正确生成token
+	token, err := jwt.GenerateToken(&jwt.Playload{
+		UserId: admin.UserId,
+		Phone:  admin.Phone,
+		Expire: time.Now().Unix() + 86400*10,
+		Role:   admin.Role,
+	}, viper.GetString("token_secret"))
+	if err != nil {
+		return nil, ierr.NewIError(ierr.GenerateTokenFailed, err.Error())
+	}
+	return &models.LoginReply{
+		UserId: admin.UserId,
+		Phone:  admin.Phone,
+		Token:  token,
+		Role:   admin.Role,
+	}, nil
+}

+ 76 - 0
app/handlers/file.go

@@ -0,0 +1,76 @@
+package handlers
+
+import (
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/spf13/viper"
+	"go.uber.org/zap"
+	"path/filepath"
+	"shopperthree_manage_v2/app/models"
+	"shopperthree_manage_v2/logger"
+	"shopperthree_manage_v2/pkg/ierr"
+	"shopperthree_manage_v2/pkg/util"
+)
+
+/**
+* showdoc
+* @catalog 文件上传
+* @title 文件上传通用接口
+* @description 文件上传通用接口
+* @method POST
+* @url ~/v1/file/upload
+* @return {"code":0,"data":{"url":"/xRTZHWUsaD6H_715747502.mp4","name":"认真且怂.mp4","size":3409702,"ext":".mp4","user_id":"26640398931722340"}}
+* @return_param url string url地址
+* @return_param name string 文件名
+* @return_param size int 文件大小
+* @return_param ext string 文件扩展名
+* @return_param user_id string 用户id
+* @remark 无
+* @number 1
+ */
+func UploadFile(c *gin.Context) {
+	var userId = c.GetString("uid")
+	var f, err = c.FormFile("file")
+	if err != nil {
+		ResponseErr(c, ierr.NewIError(ierr.ReceiveRequestFileFail, err.Error()))
+		return
+	}
+
+	var saveDir = viper.GetString("file.path")
+	var host = viper.GetString("file.host")
+	var name = fmt.Sprintf("%s_%d", util.RandomString(12), util.Now13()%1e9) + filepath.Ext(f.Filename)
+	var path = filepath.Join(saveDir, name)
+	var fileModel = &models.File{
+		Url:    host + name,
+		Name:   f.Filename,
+		Path:   path,
+		Size:   f.Size,
+		Ext:    filepath.Ext(f.Filename),
+		UserId: "mock_user_id",
+	}
+	err = c.SaveUploadedFile(f, path)
+	if err != nil {
+		logger.Error("[UploadFile] save file to disk error",
+			zap.Any("file", fileModel),
+			zap.Error(err))
+		ResponseErr(c, err)
+		return
+	}
+	err = fileModel.Save()
+	if err != nil {
+		logger.Error("[UploadFile] save file info to db error",
+			zap.Any("file", fileModel),
+			zap.Error(err))
+		ResponseErr(c, err)
+		return
+	}
+
+	var resp = models.FileResponse{
+		Url:    fileModel.Url,
+		Name:   fileModel.Name,
+		Size:   fileModel.Size,
+		Ext:    fileModel.Ext,
+		UserId: userId,
+	}
+	ResponseSuccess(c, resp)
+}

+ 48 - 0
app/handlers/login.go

@@ -0,0 +1,48 @@
+package handlers
+
+import (
+	"github.com/gin-gonic/gin"
+	"shopperthree_manage_v2/app/business"
+	"shopperthree_manage_v2/app/models"
+	"shopperthree_manage_v2/logger"
+	"shopperthree_manage_v2/pkg/ierr"
+)
+
+/**
+* showdoc
+* @catalog 登录
+* @title 登录接口
+* @description 登录接口
+* @method POST
+* @url ~/v1/login
+* @param phone 必选 string 手机号码
+* @param password 必选 string 密码
+* @return {"code":0,"data":{"user_id":"3543","phone":"18522905678","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOiIzNTQzIiwiUGhvbmUiOiIxODUyMjkwNTY3OCIsIkV4cGlyZSI6MTU5OTc1MDE1OSwiUm9sZSI6Mn0.yzhKxq4CAYG-YdRIZOj83Buupp2WsooS4K4iAgCFnT0","role":2}}
+* @return_param user_id string 用户id
+* @return_param phone string 手机号码
+* @return_param token string 后面要用的token
+* @return_param role int 角色(1商户2管理员)
+* @remark (请求需要在header上面带上token,如果是商户key为merchant_token,如果是管理员key为admin_token)
+* @number 2
+ */
+func Login(c *gin.Context) {
+	var req models.LoginRequest
+	if err := c.ShouldBind(&req); err != nil {
+		logger.Error("Login bind err",
+			logger.Err(err),
+			logger.Any("req", req),
+		)
+		ResponseErr(c, ierr.NewIError(ierr.ParamErr, err.Error()))
+		return
+	}
+	reply, err := business.Login(&req)
+	if err != nil {
+		logger.Error("Login err",
+			logger.Err(err),
+			logger.Any("req", req),
+		)
+		ResponseErr(c, err)
+		return
+	}
+	ResponseSuccess(c, reply)
+}

+ 115 - 0
app/handlers/middleware.go

@@ -0,0 +1,115 @@
+package handlers
+
+import (
+	"github.com/spf13/viper"
+	"net/http"
+	"shopperthree_manage_v2/app/models"
+	"shopperthree_manage_v2/pkg/ierr"
+	"shopperthree_manage_v2/pkg/jwt"
+	"time"
+
+	"github.com/gin-gonic/gin"
+)
+
+var Cors = func(c *gin.Context) {
+	method := c.Request.Method
+	c.Header("Access-Control-Allow-Origin", "*")
+	c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, UPDATE")
+	c.Header("Access-Control-Allow-Headers", "*")
+	if method == "OPTIONS" {
+		c.AbortWithStatus(http.StatusNoContent)
+	}
+	c.Next()
+}
+
+func AuthToken() gin.HandlerFunc {
+	//这里不管是什么身份只要登录了就可以
+	return func(c *gin.Context) {
+		token := c.GetHeader("shopManageToken")
+		if token == "" {
+			token = c.Query("shopManageToken")
+		}
+		if token == "" {
+			ResponseErr(c, ierr.NewIError(ierr.NotAllowed, "need login"))
+			c.Abort()
+			return
+		}
+		res, err := jwt.ParseToken(token, viper.GetString("token_secret"))
+		if err != nil {
+			ResponseErr(c, ierr.NewIError(ierr.NotAllowed, err.Error()))
+			c.Abort()
+			return
+		}
+		if res.Expire < time.Now().Unix() {
+			ResponseErr(c, ierr.NewIError(ierr.TokenExpire, "token expire"))
+			c.Abort()
+			return
+		}
+		c.Set("uid", res.UserId)
+		c.Next()
+	}
+}
+
+func AdminToken() gin.HandlerFunc {
+	return func(c *gin.Context) {
+		token := c.GetHeader("shopManageToken")
+		if token == "" {
+			token = c.Query("shopManageToken")
+		}
+		if token == "" {
+			ResponseErr(c, ierr.NewIError(ierr.NotAllowed, "need login"))
+			c.Abort()
+			return
+		}
+		res, err := jwt.ParseToken(token, viper.GetString("token_secret"))
+		if err != nil {
+			ResponseErr(c, ierr.NewIError(ierr.NotAllowed, err.Error()))
+			c.Abort()
+			return
+		}
+		if res.Expire < time.Now().Unix() {
+			ResponseErr(c, ierr.NewIError(ierr.TokenExpire, "token expire"))
+			c.Abort()
+			return
+		}
+		if res.Role != models.RoleAdmin {
+			ResponseErr(c, ierr.NewIError(ierr.NotAllowed, "have no admin access"))
+			c.Abort()
+			return
+		}
+		c.Set("uid", res.UserId)
+		c.Next()
+	}
+}
+
+func MerchantToken() gin.HandlerFunc {
+	return func(c *gin.Context) {
+		token := c.GetHeader("shopManageToken")
+		if token == "" {
+			token = c.Query("shopManageToken")
+		}
+		if token == "" {
+			ResponseErr(c, ierr.NewIError(ierr.NotAllowed, "need login"))
+			c.Abort()
+			return
+		}
+		res, err := jwt.ParseToken(token, viper.GetString("token_secret"))
+		if err != nil {
+			ResponseErr(c, ierr.NewIError(ierr.NotAllowed, err.Error()))
+			c.Abort()
+			return
+		}
+		if res.Expire < time.Now().Unix() {
+			ResponseErr(c, ierr.NewIError(ierr.TokenExpire, "token expire"))
+			c.Abort()
+			return
+		}
+		if res.Role != models.RoleMerchant {
+			ResponseErr(c, ierr.NewIError(ierr.NotAllowed, "have no merchant access"))
+			c.Abort()
+			return
+		}
+		c.Set("uid", res.UserId)
+		c.Next()
+	}
+}

+ 28 - 0
app/handlers/response.go

@@ -0,0 +1,28 @@
+package handlers
+
+import (
+	"github.com/gin-gonic/gin"
+	"net/http"
+)
+
+func ResponseSuccess(c *gin.Context, data interface{}) {
+	c.JSON(http.StatusOK, map[string]interface{}{
+		"code": 0,
+		"data": data,
+	})
+}
+
+//使用这个方法需要返回自己定义的错误
+func ResponseErr(c *gin.Context, err error) {
+	c.JSON(http.StatusOK, err)
+}
+
+func ResponseErrWithCode(c *gin.Context, code int, err error) {
+	var resp = map[string]interface{}{
+		"code": code,
+	}
+	if err != nil {
+		resp["err"] = err.Error()
+	}
+	c.JSON(http.StatusOK, resp)
+}

+ 45 - 0
app/models/common.go

@@ -0,0 +1,45 @@
+package models
+
+import (
+	"time"
+
+	"shopperthree_manage_v2/client/mysql"
+)
+
+// 删除标志
+const (
+	StatusNormal = 0
+	StatusDelete = 1
+)
+
+// 审核状态
+const (
+	VerifyPending  = 0
+	VerifyPassed   = 1
+	VerifyRejected = 2
+)
+
+//订单sku
+const (
+	OrderSkuSuccess     = 0 // 下单成功
+	OrderSkuPay         = 1 // 已支付,即发货中
+	OrderSkuPackSuccess = 2 // 发货成功
+	OrderSkuChange      = 3 // 退换货
+	OrderSkuRefund      = 4 // 退货退款
+	OrderSkuCancel      = 5 // 取消下单
+)
+
+type CommonField struct {
+	Id int `gorm:"primary_key;column:id"`
+
+	CreatedAt time.Time `json:"created_at" gorm:"column:created_at;type:datetime;NOT NULL;index:idx_created_at;DEFAULT:CURRENT_TIMESTAMP"`                                // 创建时间
+	UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at;type:datetime;NOT NULL;index:idx_updated_at;DEFAULT:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0)"` // 最后更新时间
+	Status    uint8     `json:"status" gorm:"column:status;NOT NULL;index:idx_status;default:0"`                                                                          // 删除标记,1:normal, 0: delete
+}
+
+func GetShortUUID() string {
+	db := mysql.Client.Master()
+	var uuid string
+	db.Unscoped().Raw("SELECT UUID_SHORT()").Row().Scan(&uuid)
+	return uuid
+}

+ 15 - 0
app/models/defile_file.go

@@ -0,0 +1,15 @@
+package models
+
+type FileResponse struct {
+	Url    string `json:"url"`     // URL地址
+	Name   string `json:"name"`    // 文件名
+	Size   int64  `json:"size"`    // 文件大小
+	Ext    string `json:"ext"`     // 文件后缀
+	UserId string `json:"user_id"` // 上传的用户id
+}
+
+type UploadFileRequest struct {
+}
+type UploadFileResponse struct {
+	File
+}

+ 30 - 0
app/models/define_login.go

@@ -0,0 +1,30 @@
+package models
+
+type Role int
+
+const (
+	RoleMerchant = 1
+	RoleAdmin    = 2
+)
+
+//func (r Role) SecretKey() string {
+//	switch r {
+//	case RoleMerchant:
+//		return viper.GetString("token_key.merchant")
+//	case RoleAdmin:
+//		return viper.GetString("token_key.admin")
+//	}
+//	return ""
+//}
+
+type LoginRequest struct {
+	Phone    string `json:"phone"`
+	Password string `json:"password"`
+}
+
+type LoginReply struct {
+	UserId string `json:"user_id"`
+	Phone  string `json:"phone"`
+	Token  string `json:"token"`
+	Role   int    `json:"role"`
+}

+ 34 - 0
app/models/table_admin.go

@@ -0,0 +1,34 @@
+package models
+
+import "shopperthree_manage_v2/client/mysql"
+
+type TAdmin struct {
+	UserId   string `gorm:"column:user_id;type:varchar(20)"`
+	Phone    string `gorm:"column:phone;type:varchar(20)"`
+	Password string `gorm:"column:password;type:varchar(64)"`
+	Role     int    `gorm:"column:role"`
+	CommonField
+}
+
+func (t *TAdmin) TableName() string {
+	return "admin"
+}
+
+func (t *TAdmin) Show() (*TAdmin, error) {
+	db := mysql.Client.Slave()
+	var result = new(TAdmin)
+	err := db.Table("admin").Where("user_id = ?", t.UserId).Scan(&result).Error
+	if err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+func (t *TAdmin) ShowByPhone() (*TAdmin, error) {
+	db := mysql.Client.Slave()
+	var result = new(TAdmin)
+	err := db.Table("admin").Where("phone = ?", t.Phone).Scan(&result).Error
+	if err != nil {
+		return nil, err
+	}
+	return result, nil
+}

+ 35 - 0
app/models/table_file.go

@@ -0,0 +1,35 @@
+package models
+
+import (
+	"shopperthree_manage_v2/client/mysql"
+	"shopperthree_manage_v2/pkg/ierr"
+)
+
+type File struct {
+	Url    string `json:"url" gorm:"url;type:varchar(512);NOT NULL"`                          // URL地址
+	Name   string `json:"name" gorm:"name;type:varchar(128);NOT NULL"`                        // 文件名
+	Path   string `json:"path" gorm:"path;type:varchar(128);NOT NULL"`                        // 存储的路径
+	Size   int64  `json:"size" gorm:"size;NOT NULL"`                                          // 文件大小
+	Ext    string `json:"ext" gorm:"ext;type:varchar(16);NOT NULL"`                           // 文件后缀
+	UserId string `json:"user_id" gorm:"user_id;type:varchar(20);NOT NULL;index:idx_user_id"` // 上传的用户id
+	CommonField
+}
+
+func (f *File) TableName() string {
+	return "file"
+}
+
+func (f *File) Save() error {
+	if f.Name == "" {
+		return ierr.NewIError(ierr.InvalidFilename, "invalid file name")
+	}
+	if f.UserId == "" {
+		return ierr.NewIError(ierr.InvalidUserId, "invalid user id")
+	}
+
+	var err = mysql.Client.Master().Save(f).Error
+	if err != nil {
+		return ierr.NewIError(ierr.CreateDataFail, err.Error())
+	}
+	return nil
+}

+ 29 - 0
app/router/router.go

@@ -0,0 +1,29 @@
+package router
+
+import (
+	"github.com/gin-gonic/gin"
+	"net/http"
+	"shopperthree_manage_v2/app/handlers"
+)
+
+func StepRouters(r *gin.Engine) {
+	r.Use(gin.Logger())
+	r.Use(gin.Recovery())
+	r.Use(handlers.Cors)
+
+	public := r.Group("/v1")
+	public.GET("/ping", func(c *gin.Context) {
+		c.JSON(http.StatusOK, "pong")
+	})
+
+	//这里是一个通用的认证 只要是登录用户就可以使用的接口 比如文件上传
+	authPublic := r.Group("/v1")
+	authPublic.Use(handlers.AuthToken())
+
+	// 文件模块
+	{
+		// 上传文件
+		authPublic.POST("/file/upload", handlers.UploadFile)
+	}
+
+}

+ 48 - 0
client/mysql/gorm_client.go

@@ -0,0 +1,48 @@
+package mysql
+
+import (
+	_ "github.com/go-sql-driver/mysql"
+	"github.com/jinzhu/gorm"
+)
+
+type GormClient struct {
+	master *gorm.DB
+	slave  *gorm.DB
+}
+
+func NewClient() *GormClient {
+	return &GormClient{}
+}
+
+var Client *GormClient
+
+func Dial(dialect string, args ...interface{}) (*GormClient, error) {
+	Client = NewClient()
+	return Client.Dial(dialect, args...)
+}
+
+func (c *GormClient) Dial(dialect string, args ...interface{}) (*GormClient, error) {
+	var err error
+	// master dial
+	c.master, err = gorm.Open(dialect, args...)
+	if err != nil {
+		return c, err
+	}
+	c.master.LogMode(true)
+	c.master.Debug()
+	// slave dial
+	c.slave, err = gorm.Open(dialect, args...)
+	if err != nil {
+		return c, err
+	}
+	c.slave.LogMode(true)
+	return c, nil
+}
+
+func (c *GormClient) Master() *gorm.DB {
+	return c.master
+}
+
+func (c *GormClient) Slave() *gorm.DB {
+	return c.slave
+}

+ 14 - 0
client/sredis/redis_client.go

@@ -0,0 +1,14 @@
+package sredis
+
+import "github.com/gomodule/redigo/redis"
+
+var MasterPool *redis.Pool
+var SalvePool *redis.Pool
+
+func GetMasterCon() redis.Conn {
+	return MasterPool.Get()
+}
+
+func GetSalveCon() redis.Conn {
+	return SalvePool.Get()
+}

+ 27 - 0
config/config.go

@@ -0,0 +1,27 @@
+package config
+
+import (
+	"os"
+
+	"github.com/spf13/viper"
+)
+
+func init() {
+	viper.SetConfigName("shopperthree_manage")
+	viper.SetConfigType("yaml")
+	viper.AddConfigPath(".")
+	viper.AddConfigPath("..")
+	viper.AddConfigPath("/etc/shopperthree_manage")
+	if err := viper.ReadInConfig(); err != nil {
+		panic(err)
+	}
+
+	if path := viper.GetString("log.path"); path != "" {
+		f, err := os.OpenFile(path, os.O_CREATE|os.O_RDWR|os.O_APPEND, os.ModePerm)
+		if err != nil {
+			panic(err)
+		}
+		os.Stdout = f
+		os.Stderr = f
+	}
+}

+ 14 - 0
go.mod

@@ -0,0 +1,14 @@
+module shopperthree_manage_v2
+
+go 1.13
+
+require (
+	github.com/dgrijalva/jwt-go v3.2.0+incompatible
+	github.com/gin-gonic/gin v1.6.3
+	github.com/go-sql-driver/mysql v1.5.0
+	github.com/gomodule/redigo/redis v0.0.0-20200429221454-e14091dffc1b
+	github.com/guregu/null v4.0.0+incompatible
+	github.com/jinzhu/gorm v1.9.16
+	github.com/spf13/viper v1.7.1
+	go.uber.org/zap v1.10.0
+)

+ 373 - 0
go.sum

@@ -0,0 +1,373 @@
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
+cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
+cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
+cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
+cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
+cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
+cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
+cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
+cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
+cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
+dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
+github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
+github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
+github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
+github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
+github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
+github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
+github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
+github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
+github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
+github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
+github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
+github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
+github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
+github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM=
+github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
+github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
+github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
+github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
+github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 h1:Yzb9+7DPaBjB8zlTR87/ElzFsnQfuHnVUVqpZZIcV5Y=
+github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
+github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
+github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
+github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
+github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
+github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
+github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
+github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
+github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
+github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
+github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
+github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
+github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
+github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
+github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
+github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
+github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
+github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
+github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
+github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
+github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
+github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
+github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
+github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
+github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
+github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
+github.com/gomodule/redigo/redis v0.0.0-20200429221454-e14091dffc1b h1:XAV1CHPRk+MUwbuzYHrCgq7mVq0Z0kcKNilDF4A8yys=
+github.com/gomodule/redigo/redis v0.0.0-20200429221454-e14091dffc1b/go.mod h1:0zioC1ElIFjAFjnYHA9Y8oeU9SHff86XhZgs2tpx9SU=
+github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
+github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
+github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
+github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
+github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
+github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
+github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
+github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
+github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
+github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
+github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
+github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+github.com/guregu/null v4.0.0+incompatible h1:4zw0ckM7ECd6FNNddc3Fu4aty9nTlpkkzH7dPn4/4Gw=
+github.com/guregu/null v4.0.0+incompatible/go.mod h1:ePGpQaN9cw0tj45IR5E5ehMvsFlLlQZAkkOXZurJ3NM=
+github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
+github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
+github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
+github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
+github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
+github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
+github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
+github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
+github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
+github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
+github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
+github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
+github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
+github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
+github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
+github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
+github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
+github.com/jinzhu/gorm v1.9.16 h1:+IyIjPEABKRpsu/F8OvDPy9fyQlgsg2luMV2ZIH5i5o=
+github.com/jinzhu/gorm v1.9.16/go.mod h1:G3LB3wezTOWM2ITLzPxEXgSkOXAntiLHS7UdBefADcs=
+github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
+github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
+github.com/jinzhu/now v1.0.1 h1:HjfetcXq097iXP0uoPCdnM4Efp5/9MsM0/M+XOTeR3M=
+github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
+github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
+github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
+github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
+github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
+github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
+github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
+github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
+github.com/lib/pq v1.1.1 h1:sJZmqHoEaY7f+NPP8pgLB/WxulyR3fewgCM2qaSlBb4=
+github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
+github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
+github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
+github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA=
+github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
+github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
+github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
+github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
+github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
+github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
+github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
+github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
+github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
+github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
+github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
+github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
+github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
+github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
+github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
+github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
+github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
+github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
+github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
+github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
+github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
+github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
+github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
+github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
+github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
+github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
+github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
+github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
+github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
+github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
+github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
+github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
+github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
+github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
+github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
+github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk=
+github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
+github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
+github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
+github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
+github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
+github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
+github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
+github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
+go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
+go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
+go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
+go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
+go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
+go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
+go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=
+go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
+golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd h1:GGJVjV8waZKRHrgwvtH66z9ZGVurTD1MT0n1Bb+q4aM=
+golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
+golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
+golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
+golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
+golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
+golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
+golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
+golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
+golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 h1:HyfiK1WMnHj5FXFXatD+Qs1A/xC2Run6RzeW1SyHxpc=
+golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
+golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
+golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
+google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
+google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
+google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
+google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
+google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
+google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
+google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
+gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno=
+gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
+gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
+gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
+gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
+rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=

+ 28 - 0
logger/default.go

@@ -0,0 +1,28 @@
+package logger
+
+import (
+	"github.com/spf13/viper"
+	"go.uber.org/zap"
+)
+
+var defaultLogger = New(viper.GetString("log.path"))
+
+func Debug(msg string, field ...zap.Field) {
+	defaultLogger.Debug(msg, field...)
+}
+
+func Warn(msg string, field ...zap.Field) {
+	defaultLogger.Warn(msg, field...)
+}
+
+func Info(msg string, field ...zap.Field) {
+	defaultLogger.Info(msg, field...)
+}
+
+func Error(msg string, field ...zap.Field) {
+	defaultLogger.Error(msg, field...)
+}
+
+func Fatal(msg string, field ...zap.Field) {
+	defaultLogger.Fatal(msg, field...)
+}

+ 162 - 0
logger/public.go

@@ -0,0 +1,162 @@
+package logger
+
+import (
+	"go.uber.org/zap"
+	"go.uber.org/zap/zapcore"
+	"os"
+)
+
+var hookCore []zapcore.Core
+
+type L struct {
+	log *zap.Logger
+}
+
+func (l *L) Debug(msg string, field ...zap.Field) {
+	l.log.Debug(msg, field...)
+}
+
+func (l *L) Warn(msg string, field ...zap.Field) {
+	l.log.Warn(msg, field...)
+}
+
+func (l *L) Info(msg string, field ...zap.Field) {
+	l.log.Info(msg, field...)
+}
+
+func (l *L) Error(msg string, field ...zap.Field) {
+	l.log.Error(msg, field...)
+}
+
+func (l *L) Fatal(msg string, field ...zap.Field) {
+	l.log.Fatal(msg, field...)
+}
+
+//func (l *L) Errorf(format string, f ...interface{}) {
+//	defaultLogger.log.Error(fmt.Sprintf(format, f...))
+//}
+//
+//func (l *L) Warnf(format string, f ...interface{}) {
+//	defaultLogger.log.Warn(fmt.Sprintf(format, f...))
+//}
+//
+//func (l *L) Infof(format string, f ...interface{}) {
+//	defaultLogger.log.Info(fmt.Sprintf(format, f...))
+//}
+//
+//func (l *L) Debugf(format string, f ...interface{}) {
+//	defaultLogger.log.Debug(fmt.Sprintf(format, f...))
+//}
+
+//func DebugAsJson(value interface{}) {
+//	defaultLogger.Debug("debugAsJson", zap.Any("object", value))
+//}
+
+func Err(err error) zap.Field {
+	return zap.Error(err)
+}
+
+func String(key string, val string) zap.Field {
+	return zap.String(key, val)
+}
+
+func Any(key string, value interface{}) zap.Field {
+	return zap.Any(key, value)
+}
+
+func Binary(key string, val []byte) zap.Field {
+	return zap.Binary(key, val)
+}
+
+func Bool(key string, val bool) zap.Field {
+	return zap.Bool(key, val)
+}
+
+func ByteString(key string, val []byte) zap.Field {
+	return zap.ByteString(key, val)
+}
+
+func Float64(key string, val float64) zap.Field {
+	return zap.Float64(key, val)
+}
+
+func Float32(key string, val float32) zap.Field {
+	return zap.Float32(key, val)
+}
+
+func NewEncoderConfig() zapcore.EncoderConfig {
+	encoderConfig := zap.NewProductionEncoderConfig()
+	encoderConfig.CallerKey = "line"
+	encoderConfig.TimeKey = "time"
+	encoderConfig.StacktraceKey = ""
+	encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
+	return encoderConfig
+}
+
+func newHook(core zapcore.Core) {
+	hookCore = []zapcore.Core{
+		core,
+	}
+}
+
+//针对这个日志可以配置输出位置
+func consoleHook(path string) zapcore.Core {
+	encoderConfig := NewEncoderConfig()
+	encoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
+	level := zap.LevelEnablerFunc(func(lv zapcore.Level) bool {
+		return lv <= zap.FatalLevel
+	})
+	consoleWriter := zapcore.AddSync(os.Stdout)
+
+	return zapcore.NewCore(zapcore.NewConsoleEncoder(encoderConfig), consoleWriter, level)
+
+}
+
+func New(path string) *L {
+	newHook(consoleHook(path))
+	return &L{log: zap.New(zapcore.NewTee(hookCore...), zap.AddCaller(), zap.AddCallerSkip(2))}
+
+}
+
+func Int(key string, val int) zap.Field {
+	return Int64(key, int64(val))
+}
+
+func Int64(key string, val int64) zap.Field {
+	return zap.Int64(key, val)
+}
+
+func Int8(key string, val int8) zap.Field {
+	return zap.Int8(key, val)
+}
+
+func Uint(key string, val uint) zap.Field {
+	return Uint64(key, uint64(val))
+}
+
+func Uint64(key string, val uint64) zap.Field {
+	return zap.Uint64(key, val)
+}
+
+func Uint8(key string, val uint8) zap.Field {
+	return zap.Uint8(key, val)
+}
+
+func SetLevel(level string) zap.AtomicLevel {
+	switch level {
+	case "debug":
+		return zap.NewAtomicLevelAt(zap.DebugLevel)
+	case "info":
+		return zap.NewAtomicLevelAt(zap.InfoLevel)
+	case "warn":
+		return zap.NewAtomicLevelAt(zap.WarnLevel)
+	case "error":
+		return zap.NewAtomicLevelAt(zap.ErrorLevel)
+	case "fatal":
+		return zap.NewAtomicLevelAt(zap.FatalLevel)
+	case "panic":
+		return zap.NewAtomicLevelAt(zap.PanicLevel)
+	default:
+		return zap.NewAtomicLevelAt(zap.DebugLevel)
+	}
+}

+ 12 - 0
main.go

@@ -0,0 +1,12 @@
+package main
+
+import (
+	_ "shopperthree_manage_v2/config"
+
+	"shopperthree_manage_v2/app/boot"
+)
+
+func main() {
+	boot.Run()
+
+}

+ 23 - 0
passport.yaml

@@ -0,0 +1,23 @@
+server:
+  host: 127.0.0.1
+  port: 7696
+
+mysql:
+  address: shopperthree:U4r6u*j0deCqHN3y@tcp(wzkj.pc:3306)/shopperthree?charset=utf8&parseTime=True&loc=Local
+#  address: tangs:123456@tcp(local.pc:3306)/shopperthree?charset=utf8&parseTime=True&loc=Local
+
+redis:
+  master:
+    address: localhost:6379
+  slave:
+    address: localhost:6379
+#log:
+#  path: /Users/lvxiaorun/log/groupdef.log
+
+file:
+  path: .
+  host: http://file.dianxiaosa.com/
+
+token_key: 3946f3ac-a634-479c-9080-284e050a12a3
+runmode: dev
+

+ 22 - 0
passport_example.yaml

@@ -0,0 +1,22 @@
+server:
+  host: 127.0.0.1
+  port: 7696
+
+mysql:
+  address: root:123456@/dbname?charset=utf8&parseTime=True&loc=Local
+
+redis:
+  master:
+    address: localhost:6379
+  slave:
+    address: localhost:6379
+#log:
+#  path: /var/log/example/log.log
+
+file:
+  path: /data/file
+  host: http://file.example.com/
+
+token_key: 394133ac-a634-479c-9080-284e050123465
+runmode: dev
+

+ 36 - 0
pkg/ierr/code.go

@@ -0,0 +1,36 @@
+package ierr
+
+type Code int
+
+var (
+	NotAllowed  Code = 403
+	BadRequest  Code = 400
+	TokenExpire Code = 40001
+
+	// 通用错误
+	InvalidId    Code = 30001  // 无效的id
+	InvalidState Code = 300002 // 无效的状态
+
+	// 用户相关
+	InvalidUserId Code = 30001 // 无效的用户id
+
+	ParamErr               Code = 41001 //参数错误
+	PasswordErr            Code = 41002
+	ReceiveRequestFileFail Code = 41003
+
+	CreateDataFail Code = 50001 // 创建数据失败
+	DeleteDataFail Code = 50002 // 删除数据失败
+	UpdateDataFail Code = 50003 // 更新数据失败
+	QueryDataFail  Code = 50004 // 查询数据失败
+	CommitTxFail   Code = 50005 // 提交事务失败
+	CountDataFail  Code = 50006 // 统计数据失败
+
+	GenerateTokenFailed Code = 50006 //生成token失败
+
+	PhoneNotExists    Code = 40004 //该手机号码不存在
+	PasswordError     Code = 40005 //密码错误
+	PhoneHasOtherRole Code = 40007 //这个手机已经有别的角色
+
+	// 文件相关
+	InvalidFilename Code = 80001 // 无效的文件名
+)

+ 21 - 0
pkg/ierr/err.go

@@ -0,0 +1,21 @@
+package ierr
+
+import "fmt"
+
+type IError struct {
+	Code     Code   `json:"code"`
+	Msg      string `json:"msg"` //跟code一致的
+	MoreInfo string `json:"more_info"`
+}
+
+func NewIError(code Code, moreInfo string) *IError {
+	return &IError{Code: code, MoreInfo: moreInfo}
+}
+
+func NewIErrorf(code Code, format string, args ...interface{}) *IError {
+	return &IError{Code: code, MoreInfo: fmt.Sprintf(format, args...)}
+}
+
+func (e *IError) Error() string {
+	return fmt.Sprintf("code(%d),err(%s)", e.Code, e.MoreInfo)
+}

+ 40 - 0
pkg/jwt/jwt.go

@@ -0,0 +1,40 @@
+package jwt
+
+import (
+	"errors"
+	"github.com/dgrijalva/jwt-go"
+	"time"
+)
+
+type Playload struct {
+	UserId string
+	Phone  string
+	Expire int64
+	Role   int //角色信息
+}
+
+func (p *Playload) Valid() error {
+	//目前这里想到的是验证超时
+	if p.Expire < time.Now().Unix() {
+		return errors.New("timeout")
+	}
+	return nil
+}
+func GenerateToken(pl *Playload, secretKey string) (string, error) {
+	token := jwt.NewWithClaims(jwt.SigningMethodHS256, pl)
+	return token.SignedString([]byte(secretKey))
+}
+
+func ParseToken(tokenStr string, secretKey string) (*Playload, error) {
+	var pl Playload
+	token, err := jwt.ParseWithClaims(tokenStr, &pl, func(token *jwt.Token) (interface{}, error) {
+		return []byte(secretKey), nil
+	})
+	if err != nil {
+		return nil, err
+	}
+	if claims, ok := token.Claims.(*Playload); ok {
+		return claims, nil
+	}
+	return nil, errors.New("not type")
+}

+ 16 - 0
pkg/util/filter.go

@@ -0,0 +1,16 @@
+package util
+
+func PageAndPageSize(page, pageSize int) (int, int) {
+	if page < 1 {
+		page = 1
+	}
+	if pageSize < 1 {
+		pageSize = 15
+	}
+	return page, pageSize
+}
+
+func SkipAndLimit(page, pageSize int) (int, int) {
+	page, pageSize = PageAndPageSize(page, pageSize)
+	return (page - 1) * pageSize, pageSize
+}

+ 32 - 0
pkg/util/gorm.go

@@ -0,0 +1,32 @@
+package util
+
+import (
+	"github.com/jinzhu/gorm"
+)
+
+// Where 根据条件是否拼接where查询语句
+func Where(db *gorm.DB, cond bool, query interface{}, args ...interface{}) *gorm.DB {
+	if !cond {
+		return db
+	}
+	return db.Where(query, args...)
+}
+
+// Order 排序拼接
+func Order(db *gorm.DB, sort string, reorder bool) *gorm.DB {
+	if sort == "" {
+		return db
+	}
+	return db.Order(sort, reorder)
+}
+
+// OffsetAndLimit 拼接offset和limit
+func OffsetAndLimit(db *gorm.DB, offset, limit int) *gorm.DB {
+	if offset != 0 {
+		db = db.Offset(offset)
+	}
+	if limit != 0 {
+		db = db.Limit(limit)
+	}
+	return db
+}

+ 118 - 0
pkg/util/map.go

@@ -0,0 +1,118 @@
+package util
+
+import (
+	"encoding/json"
+	"math"
+	"math/big"
+)
+
+// PutIntoMapIf 根据条件放进map
+func PutIntoMapIf(m map[string]interface{}, cond bool, key string, value interface{}) {
+	if cond {
+		m[key] = value
+	}
+}
+
+// S2Json struct to json
+func S2Json(v interface{}) string {
+	buf, err := json.Marshal(v)
+	if err != nil {
+		return ""
+	}
+	return string(buf)
+}
+
+// Json2S trans json to object
+func Json2S(src string, dest interface{}) error {
+	return json.Unmarshal([]byte(src), dest)
+}
+
+func S2S(data, v interface{}) error {
+	return Json2S(S2Json(data), v)
+}
+
+// BigIntToFloat64 大整数转为float64
+func BigIntToFloat64(v *big.Int) float64 {
+	a := &big.Float{}
+	f, _ := a.SetInt(v).Float64()
+	return f
+}
+
+// Float64ToBigInt float6¢ 转为大整数
+func Float64ToBigInt(v float64) *big.Int {
+	f := big.NewFloat(v)
+	r, _ := f.Int(nil)
+	return r
+}
+
+// StringToU64 string to uint64
+func StringToU64(s string) uint64 {
+	bi, ok := (&big.Int{}).SetString(s, 10)
+	if ok {
+		return bi.Uint64()
+	}
+	return 0
+}
+
+// Gas 计算以太坊gas, gasPrice 单位是gwei
+func Gas(gasLimit uint64, gasPrice uint64) *big.Int {
+	limit := (&big.Int{}).SetUint64(gasLimit)
+	price := (&big.Int{}).Mul((&big.Int{}).SetUint64(gasPrice), big.NewInt(1e9))
+
+	return (&big.Int{}).Mul(limit, price)
+}
+
+// LeftPadString 字符串前面填充到指定到个数
+func LeftPadString(s, padding string, total int) string {
+	if len(s) >= total {
+		return s
+	}
+
+	count := total - len(s)
+	for i := 0; i < count; i++ {
+		s = padding + s
+	}
+
+	return s
+}
+
+// AddStrInt string int add
+func AddStrInt(a, b string) *big.Int {
+	ai, _ := (&big.Int{}).SetString(a, 10)
+	bi, _ := (&big.Int{}).SetString(b, 10)
+
+	sum := (big.NewInt(0)).Add(ai, bi)
+	return sum
+}
+
+// SubStrInt return a-b
+func SubStrInt(a, b string) *big.Int {
+	ai, _ := (&big.Int{}).SetString(a, 10)
+	bi, _ := (&big.Int{}).SetString(b, 10)
+
+	diff := (big.NewInt(0)).Sub(ai, bi)
+	return diff
+}
+
+// F64ToU64 float64 转 uint64 并且乘以给定到小数点位数
+func F64ToU64(value float64, decimal int) uint64 {
+	return uint64(value * math.Pow10(decimal))
+}
+
+// FormatUsdt 格式化usdt
+func FormatUsdt(v float64) float64 {
+	f := new(big.Float).Quo(big.NewFloat(v), big.NewFloat(1e6))
+	res, _ := f.Float64()
+	return res
+}
+
+// FormatEther 格式化以太币
+func FormatEther(v string) string {
+	i, _ := new(big.Int).SetString(v, 10)
+	i = i.Div(i, big.NewInt(1e9))
+
+	f := new(big.Float).SetUint64(i.Uint64())
+
+	f = f.Quo(f, big.NewFloat(1e9))
+	return f.Text('f', 9)
+}

+ 38 - 0
pkg/util/random.go

@@ -0,0 +1,38 @@
+package util
+
+import (
+	"math/rand"
+	"time"
+)
+
+var defaultLetters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
+
+// RandomString returns a random string with a fixed length
+func RandomString(n int, allowedChars ...[]rune) string {
+	var letters []rune
+
+	if len(allowedChars) == 0 {
+		letters = defaultLetters
+	} else {
+		letters = allowedChars[0]
+	}
+
+	b := make([]rune, n)
+	for i := range b {
+		b[i] = letters[rand.Intn(len(letters))]
+	}
+
+	return string(b)
+}
+
+func RandInt64(min, max int64) int64 {
+	s := rand.NewSource(time.Now().UnixNano())
+	r := rand.New(s)
+	return min + r.Int63n(max-min+1)
+}
+func RandFloat64(min, max float64) float64 {
+	s := rand.NewSource(time.Now().UnixNano())
+	r := rand.New(s)
+
+	return min + r.Float64()*(max-min)
+}

+ 10 - 0
pkg/util/round.go

@@ -0,0 +1,10 @@
+package util
+
+import (
+	"math"
+)
+
+func Round(f float64, n int) float64 {
+	pow10_n := math.Pow10(n)
+	return math.Trunc((f+0.5/pow10_n)*pow10_n) / pow10_n
+}

+ 43 - 0
pkg/util/sign.go

@@ -0,0 +1,43 @@
+package util
+
+import (
+	"crypto/md5"
+	"crypto/sha1"
+	"crypto/sha256"
+	"crypto/sha512"
+	"encoding/hex"
+	"fmt"
+)
+
+func MD5Hex(str string) string {
+	h := md5.New()
+	h.Write([]byte(str))
+	return hex.EncodeToString(h.Sum(nil))
+}
+
+func Sha1(str string) (hex string) {
+	if str == "" {
+		return
+	}
+
+	hex = fmt.Sprintf("%x", sha1.Sum([]byte(str)))
+	return
+}
+
+func Sha512(str string) string {
+	if str == "" {
+		return ""
+	}
+	sha_h := sha512.New()
+	sha_h.Write([]byte(str))
+	return fmt.Sprintf("%x", sha_h.Sum(nil))
+}
+
+func Sha256(str string) string {
+	if str == "" {
+		return ""
+	}
+	sha_h := sha256.New()
+	sha_h.Write([]byte(str))
+	return fmt.Sprintf("%x", sha_h.Sum(nil))
+}

+ 34 - 0
pkg/util/time.go

@@ -0,0 +1,34 @@
+package util
+
+import (
+	"time"
+)
+
+// NowMilli 获得当前时间,毫秒级
+func NowMilli() int64 {
+	return time.Now().Local().UnixNano() / int64(time.Millisecond)
+}
+
+// 当天时间的0点
+func DayZeroStart(add time.Duration) int64 {
+	now := time.Now()
+	startTime := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
+	startTime = startTime.Add(add)
+	return startTime.UnixNano() / 1e6
+}
+
+// 当天时间的0点
+func DayZeroStartTime(add time.Duration) time.Time {
+	now := time.Now()
+	startTime := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
+	startTime = startTime.Add(add)
+	return startTime
+}
+
+func Now13() int64 {
+	return time.Now().UnixNano() / 1e6
+}
+
+func Now10() int64 {
+	return time.Now().Unix()
+}