提交 48539002 authored 作者: mooncake9527's avatar mooncake9527

update

上级 28f23171
...@@ -10,8 +10,9 @@ import ( ...@@ -10,8 +10,9 @@ import (
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
xlogger "xmall/pkg/logger" "gitlab.wanzhuangkj.com/tush/xpkg/prof"
"xmall/pkg/prof"
xlogger "gitlab.wanzhuangkj.com/tush/xpkg/logger"
) )
// IServer server interface // IServer server interface
......
...@@ -6,9 +6,9 @@ import ( ...@@ -6,9 +6,9 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/encoding" "gitlab.wanzhuangkj.com/tush/xpkg/encoding"
"xmall/pkg/gotest" "gitlab.wanzhuangkj.com/tush/xpkg/gotest"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
type cacheUser struct { type cacheUser struct {
......
...@@ -10,11 +10,11 @@ import ( ...@@ -10,11 +10,11 @@ import (
"github.com/dgraph-io/ristretto" "github.com/dgraph-io/ristretto"
"github.com/spf13/cast" "github.com/spf13/cast"
"xmall/pkg/encoding" "gitlab.wanzhuangkj.com/tush/xpkg/encoding"
ctxUtil "xmall/pkg/gin/xctx" ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"xmall/pkg/logger" "gitlab.wanzhuangkj.com/tush/xpkg/logger"
xslice "xmall/pkg/utils/xslice" xslice "gitlab.wanzhuangkj.com/tush/xpkg/utils/xslice"
"xmall/pkg/xerrors/xerror" "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
) )
type memoryCache struct { type memoryCache struct {
......
...@@ -6,9 +6,9 @@ import ( ...@@ -6,9 +6,9 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/encoding" "gitlab.wanzhuangkj.com/tush/xpkg/encoding"
"xmall/pkg/gotest" "gitlab.wanzhuangkj.com/tush/xpkg/gotest"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
type memoryUser struct { type memoryUser struct {
......
...@@ -10,8 +10,8 @@ import ( ...@@ -10,8 +10,8 @@ import (
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
"xmall/pkg/encoding" "gitlab.wanzhuangkj.com/tush/xpkg/encoding"
"xmall/pkg/xerrors/xerror" "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
) )
// CacheNotFound no hit cache // CacheNotFound no hit cache
......
...@@ -6,9 +6,9 @@ import ( ...@@ -6,9 +6,9 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/encoding" "gitlab.wanzhuangkj.com/tush/xpkg/encoding"
"xmall/pkg/gotest" "gitlab.wanzhuangkj.com/tush/xpkg/gotest"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
type redisUser struct { type redisUser struct {
......
...@@ -2,8 +2,8 @@ package conf ...@@ -2,8 +2,8 @@ package conf
import ( import (
"bytes" "bytes"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"log" "log"
"xmall/pkg/xerrors/xerror"
consulapi "github.com/armon/consul-api" consulapi "github.com/armon/consul-api"
"github.com/spf13/viper" "github.com/spf13/viper"
......
...@@ -6,10 +6,10 @@ import ( ...@@ -6,10 +6,10 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"path" "path"
"path/filepath" "path/filepath"
"strings" "strings"
"xmall/pkg/xerrors/xerror"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"github.com/spf13/viper" "github.com/spf13/viper"
......
...@@ -3,7 +3,7 @@ package consulcli ...@@ -3,7 +3,7 @@ package consulcli
import ( import (
"fmt" "fmt"
"xmall/pkg/xerrors/xerror" "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
) )
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"testing" "testing"
"time" "time"
"xmall/pkg/etcdcli" "gitlab.wanzhuangkj.com/tush/xpkg/etcdcli"
"go.uber.org/zap" "go.uber.org/zap"
) )
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"testing" "testing"
"time" "time"
"xmall/pkg/goredis" "gitlab.wanzhuangkj.com/tush/xpkg/goredis"
) )
func TestRedisLock_TryLock(t *testing.T) { func TestRedisLock_TryLock(t *testing.T) {
......
...@@ -4,8 +4,8 @@ import ( ...@@ -4,8 +4,8 @@ import (
"crypto/rand" "crypto/rand"
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"math/big" "math/big"
"xmall/pkg/xerrors/xerror"
"gopkg.in/gomail.v2" "gopkg.in/gomail.v2"
) )
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"xmall/pkg/encoding" "gitlab.wanzhuangkj.com/tush/xpkg/encoding"
) )
// Name is the name registered for the json codec. // Name is the name registered for the json codec.
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"xmall/pkg/encoding" "gitlab.wanzhuangkj.com/tush/xpkg/encoding"
) )
// Name is the name registered for the proto compressor. // Name is the name registered for the proto compressor.
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
var rpcStatus = []*RPCStatus{ var rpcStatus = []*RPCStatus{
......
...@@ -3,8 +3,8 @@ package etcdcli ...@@ -3,8 +3,8 @@ package etcdcli
import ( import (
"fmt" "fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"time" "time"
"xmall/pkg/xerrors/xerror"
clientv3 "go.etcd.io/etcd/client/v3" clientv3 "go.etcd.io/etcd/client/v3"
"google.golang.org/grpc" "google.golang.org/grpc"
......
...@@ -9,8 +9,8 @@ import ( ...@@ -9,8 +9,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"xmall/pkg/errcode" "gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
// CheckHealthReply check health result // CheckHealthReply check health result
......
...@@ -4,11 +4,11 @@ package middleware ...@@ -4,11 +4,11 @@ package middleware
import ( import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"xmall/pkg/errcode" "gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"xmall/pkg/gin/response" "gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
ctxUtil "xmall/pkg/gin/xctx" ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"xmall/pkg/jwt" "gitlab.wanzhuangkj.com/tush/xpkg/jwt"
"xmall/pkg/logger" "gitlab.wanzhuangkj.com/tush/xpkg/logger"
) )
const ( const (
......
...@@ -12,10 +12,10 @@ import ( ...@@ -12,10 +12,10 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"xmall/pkg/gin/response" "gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"xmall/pkg/httpcli" "gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"xmall/pkg/jwt" "gitlab.wanzhuangkj.com/tush/xpkg/jwt"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
......
...@@ -5,9 +5,9 @@ import ( ...@@ -5,9 +5,9 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"xmall/pkg/container/group" "gitlab.wanzhuangkj.com/tush/xpkg/container/group"
"xmall/pkg/gin/response" "gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"xmall/pkg/shield/circuitbreaker" "gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
) )
// ErrNotAllowed error not allowed. // ErrNotAllowed error not allowed.
......
...@@ -11,11 +11,11 @@ import ( ...@@ -11,11 +11,11 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"xmall/pkg/container/group" "gitlab.wanzhuangkj.com/tush/xpkg/container/group"
"xmall/pkg/gin/response" "gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"xmall/pkg/httpcli" "gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"xmall/pkg/shield/circuitbreaker" "gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func runCircuitBreakerHTTPServer() string { func runCircuitBreakerHTTPServer() string {
......
...@@ -2,11 +2,11 @@ package middleware ...@@ -2,11 +2,11 @@ package middleware
import ( import (
"bytes" "bytes"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/ips"
"io" "io"
"net/http" "net/http"
"time" "time"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/ips"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
......
...@@ -7,11 +7,11 @@ import ( ...@@ -7,11 +7,11 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"xmall/pkg/gin/response" "gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
ctxUtil "xmall/pkg/gin/xctx" ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"xmall/pkg/httpcli" "gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"xmall/pkg/logger" "gitlab.wanzhuangkj.com/tush/xpkg/logger"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func init() { func init() {
......
...@@ -8,8 +8,8 @@ import ( ...@@ -8,8 +8,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/gin/handlerfunc" "gitlab.wanzhuangkj.com/tush/xpkg/gin/handlerfunc"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func TestMetrics(t *testing.T) { func TestMetrics(t *testing.T) {
......
...@@ -7,8 +7,8 @@ import ( ...@@ -7,8 +7,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"xmall/pkg/gin/response" "gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
rl "xmall/pkg/shield/ratelimit" rl "gitlab.wanzhuangkj.com/tush/xpkg/shield/ratelimit"
) )
// ErrLimitExceed is returned when the rate limiter is // ErrLimitExceed is returned when the rate limiter is
......
...@@ -11,9 +11,9 @@ import ( ...@@ -11,9 +11,9 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"xmall/pkg/gin/response" "gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"xmall/pkg/httpcli" "gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func runRateLimiterHTTPServer() string { func runRateLimiterHTTPServer() string {
......
package middleware package middleware
import ( import (
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"net/http" "net/http"
ctxUtil "xmall/pkg/gin/xctx"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
......
...@@ -2,8 +2,8 @@ package middleware ...@@ -2,8 +2,8 @@ package middleware
import ( import (
"context" "context"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"net/http" "net/http"
ctxUtil "xmall/pkg/gin/xctx"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
......
...@@ -6,8 +6,8 @@ import ( ...@@ -6,8 +6,8 @@ import (
"testing" "testing"
"time" "time"
ctxUtil "xmall/pkg/gin/xctx" ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
......
...@@ -5,9 +5,9 @@ import ( ...@@ -5,9 +5,9 @@ import (
"testing" "testing"
"time" "time"
"xmall/pkg/gin/response" "gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"xmall/pkg/httpcli" "gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func TestRegister(t *testing.T) { func TestRegister(t *testing.T) {
......
...@@ -8,11 +8,10 @@ import ( ...@@ -8,11 +8,10 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"xmall/internal/ecode" "gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"xmall/pkg/errcode" ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
ctxUtil "xmall/pkg/gin/xctx" "gitlab.wanzhuangkj.com/tush/xpkg/logger"
"xmall/pkg/logger" "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"xmall/pkg/xerrors/xerror"
) )
const CustomErrorCode = 0 const CustomErrorCode = 0
...@@ -74,7 +73,7 @@ func respJSONWithStatusCode(c *gin.Context, code int, msg string, data ...interf ...@@ -74,7 +73,7 @@ func respJSONWithStatusCode(c *gin.Context, code int, msg string, data ...interf
func Output(c *gin.Context, code int, data ...interface{}) { func Output(c *gin.Context, code int, data ...interface{}) {
switch code { switch code {
case http.StatusOK: case http.StatusOK:
respJSONWithStatusCode(c, http.StatusOK, ecode.Success.Msg(), data...) respJSONWithStatusCode(c, http.StatusOK, errcode.Success.Msg(), data...)
case http.StatusBadRequest: case http.StatusBadRequest:
respJSONWithStatusCode(c, http.StatusBadRequest, errcode.InvalidParams.Msg(), data...) respJSONWithStatusCode(c, http.StatusBadRequest, errcode.InvalidParams.Msg(), data...)
case http.StatusUnauthorized: case http.StatusUnauthorized:
...@@ -104,7 +103,7 @@ func Out(c *gin.Context, err *errcode.Error, data ...interface{}) { ...@@ -104,7 +103,7 @@ func Out(c *gin.Context, err *errcode.Error, data ...interface{}) {
code := err.ToHTTPCode() code := err.ToHTTPCode()
switch code { switch code {
case http.StatusOK: case http.StatusOK:
respJSONWithStatusCode(c, http.StatusOK, ecode.Success.Msg(), data...) respJSONWithStatusCode(c, http.StatusOK, errcode.Success.Msg(), data...)
case http.StatusInternalServerError: case http.StatusInternalServerError:
respJSONWithStatusCode(c, http.StatusInternalServerError, err.Msg(), data...) respJSONWithStatusCode(c, http.StatusInternalServerError, err.Msg(), data...)
case http.StatusBadRequest: case http.StatusBadRequest:
...@@ -141,17 +140,17 @@ func respJSONWith200(c *gin.Context, code int, msg string, data ...interface{}) ...@@ -141,17 +140,17 @@ func respJSONWith200(c *gin.Context, code int, msg string, data ...interface{})
// Success return success // Success return success
func Success(c *gin.Context, data ...interface{}) { func Success(c *gin.Context, data ...interface{}) {
respJSONWith200(c, ecode.Success.Code(), ecode.Success.Msg(), data...) respJSONWith200(c, errcode.Success.Code(), errcode.Success.Msg(), data...)
} }
// SuccessWithPage return success // SuccessWithPage return success
func SuccessWithPage[T any](c *gin.Context, list []*T, total int64) { func SuccessWithPage[T any](c *gin.Context, list []*T, total int64) {
respJSONWith200(c, ecode.Success.Code(), ecode.Success.Msg(), gin.H{"list": list, "total": total}) respJSONWith200(c, errcode.Success.Code(), errcode.Success.Msg(), gin.H{"list": list, "total": total})
} }
// SuccessWithList return success // SuccessWithList return success
func SuccessWithList[T any](c *gin.Context, list []*T) { func SuccessWithList[T any](c *gin.Context, list []*T) {
respJSONWith200(c, ecode.Success.Code(), ecode.Success.Msg(), gin.H{"list": list}) respJSONWith200(c, errcode.Success.Code(), errcode.Success.Msg(), gin.H{"list": list})
} }
// ErrorE return error // ErrorE return error
......
...@@ -10,10 +10,9 @@ import ( ...@@ -10,10 +10,9 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/internal/ecode" "gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"xmall/pkg/errcode" "gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"xmall/pkg/httpcli" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
"xmall/pkg/utils"
) )
var ( var (
...@@ -66,7 +65,7 @@ func TestRespond(t *testing.T) { ...@@ -66,7 +65,7 @@ func TestRespond(t *testing.T) {
result = &httpcli.StdResult{} result = &httpcli.StdResult{}
err = httpcli.Get(context.Background(), result, requestAddr+"/error") err = httpcli.Get(context.Background(), result, requestAddr+"/error")
assert.NoError(t, err) assert.NoError(t, err)
assert.NotEqual(t, ecode.Success.Code(), result.Code) assert.NotEqual(t, errcode.Success.Code(), result.Code)
for _, code := range httpResponseCodes { for _, code := range httpResponseCodes {
result := &httpcli.StdResult{} result := &httpcli.StdResult{}
......
...@@ -11,7 +11,7 @@ import ( ...@@ -11,7 +11,7 @@ import (
ginSwagger "github.com/swaggo/gin-swagger" ginSwagger "github.com/swaggo/gin-swagger"
"github.com/swaggo/swag" "github.com/swaggo/swag"
"xmall/pkg/gofile" "gitlab.wanzhuangkj.com/tush/xpkg/gofile"
) )
// DefaultRouter default swagger router, request url is http://<ip:port>/swagger/index.html // DefaultRouter default swagger router, request url is http://<ip:port>/swagger/index.html
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func runHTTPServer(registerSwaggerFn func(r *gin.Engine)) string { func runHTTPServer(registerSwaggerFn func(r *gin.Engine)) string {
......
...@@ -17,7 +17,7 @@ import ( ...@@ -17,7 +17,7 @@ import (
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func runValidatorHTTPServer() string { func runValidatorHTTPServer() string {
......
...@@ -2,7 +2,7 @@ package xctx ...@@ -2,7 +2,7 @@ package xctx
import ( import (
"context" "context"
xsf "xmall/pkg/utils/xsnowflake" xsf "gitlab.wanzhuangkj.com/tush/xpkg/utils/xsnowflake"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/spf13/cast" "github.com/spf13/cast"
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"encoding/hex" "encoding/hex"
"errors" "errors"
"xmall/pkg/gocrypto/wcipher" "gitlab.wanzhuangkj.com/tush/xpkg/gocrypto/wcipher"
) )
// AesEncrypt aes encryption, returns ciphertext is not transcoded // AesEncrypt aes encryption, returns ciphertext is not transcoded
......
...@@ -6,7 +6,7 @@ package gocrypto ...@@ -6,7 +6,7 @@ package gocrypto
import ( import (
"encoding/hex" "encoding/hex"
"xmall/pkg/gocrypto/wcipher" "gitlab.wanzhuangkj.com/tush/xpkg/gocrypto/wcipher"
) )
// DesEncrypt des encryption, the returned ciphertext is not transcoded // DesEncrypt des encryption, the returned ciphertext is not transcoded
......
...@@ -7,8 +7,8 @@ import ( ...@@ -7,8 +7,8 @@ import (
"runtime" "runtime"
"time" "time"
ctxUtil "xmall/pkg/gin/xctx" ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"xmall/pkg/logger" "gitlab.wanzhuangkj.com/tush/xpkg/logger"
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
"go.uber.org/zap" "go.uber.org/zap"
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
"github.com/alicebob/miniredis/v2" "github.com/alicebob/miniredis/v2"
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
// Cache redis cache // Cache redis cache
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/DATA-DOG/go-sqlmock" "github.com/DATA-DOG/go-sqlmock"
"gorm.io/gorm" "gorm.io/gorm"
"xmall/pkg/sgorm/query" "gitlab.wanzhuangkj.com/tush/xpkg/sgorm/query"
) )
func TestNewDao(t *testing.T) { func TestNewDao(t *testing.T) {
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
// Handler info // Handler info
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
// Service info // Service info
......
...@@ -8,10 +8,10 @@ import ( ...@@ -8,10 +8,10 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
"xmall/pkg/grpc/gtls" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls"
"xmall/pkg/grpc/interceptor" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/interceptor"
"xmall/pkg/logger" "gitlab.wanzhuangkj.com/tush/xpkg/logger"
"xmall/pkg/servicerd/discovery" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/discovery"
) )
// NewClient creates a new grpc client // NewClient creates a new grpc client
......
...@@ -9,8 +9,8 @@ import ( ...@@ -9,8 +9,8 @@ import (
clientv3 "go.etcd.io/etcd/client/v3" clientv3 "go.etcd.io/etcd/client/v3"
"go.uber.org/zap" "go.uber.org/zap"
"xmall/pkg/grpc/gtls/certfile" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls/certfile"
"xmall/pkg/servicerd/registry/etcd" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry/etcd"
) )
func TestNewClient(t *testing.T) { func TestNewClient(t *testing.T) {
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"google.golang.org/grpc" "google.golang.org/grpc"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
var ( var (
......
...@@ -9,8 +9,8 @@ import ( ...@@ -9,8 +9,8 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
"xmall/pkg/grpc/interceptor" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/interceptor"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
func TestWithDialOptions(t *testing.T) { func TestWithDialOptions(t *testing.T) {
......
...@@ -3,7 +3,7 @@ package gtls ...@@ -3,7 +3,7 @@ package gtls
import ( import (
"testing" "testing"
"xmall/pkg/grpc/gtls/certfile" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls/certfile"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/grpc/gtls/certfile" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls/certfile"
) )
func TestGetServerTLSCredentials(t *testing.T) { func TestGetServerTLSCredentials(t *testing.T) {
......
...@@ -8,9 +8,9 @@ import ( ...@@ -8,9 +8,9 @@ import (
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"xmall/pkg/container/group" "gitlab.wanzhuangkj.com/tush/xpkg/container/group"
"xmall/pkg/errcode" "gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"xmall/pkg/shield/circuitbreaker" "gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
) )
// ErrNotAllowed error not allowed. // ErrNotAllowed error not allowed.
......
...@@ -7,9 +7,9 @@ import ( ...@@ -7,9 +7,9 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"google.golang.org/grpc" "google.golang.org/grpc"
"xmall/pkg/container/group" "gitlab.wanzhuangkj.com/tush/xpkg/container/group"
"xmall/pkg/errcode" "gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"xmall/pkg/shield/circuitbreaker" "gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
) )
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"xmall/pkg/jwt" "gitlab.wanzhuangkj.com/tush/xpkg/jwt"
) )
// ---------------------------------- client ---------------------------------- // ---------------------------------- client ----------------------------------
......
...@@ -9,8 +9,8 @@ import ( ...@@ -9,8 +9,8 @@ import (
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"xmall/pkg/jwt" "gitlab.wanzhuangkj.com/tush/xpkg/jwt"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
var ( var (
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
zapLog "xmall/pkg/logger" zapLog "gitlab.wanzhuangkj.com/tush/xpkg/logger"
) )
var contentMark = []byte(" ...... ") var contentMark = []byte(" ...... ")
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"testing" "testing"
"time" "time"
"xmall/pkg/logger" "gitlab.wanzhuangkj.com/tush/xpkg/logger"
) )
func TestUnaryClientLog(t *testing.T) { func TestUnaryClientLog(t *testing.T) {
......
...@@ -3,7 +3,7 @@ package interceptor ...@@ -3,7 +3,7 @@ package interceptor
import ( import (
"google.golang.org/grpc" "google.golang.org/grpc"
"xmall/pkg/grpc/metrics" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/metrics"
) )
// UnaryClientMetrics client-side metrics unary interceptor // UnaryClientMetrics client-side metrics unary interceptor
......
...@@ -6,8 +6,8 @@ import ( ...@@ -6,8 +6,8 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"xmall/pkg/errcode" "gitlab.wanzhuangkj.com/tush/xpkg/errcode"
rl "xmall/pkg/shield/ratelimit" rl "gitlab.wanzhuangkj.com/tush/xpkg/shield/ratelimit"
) )
// ---------------------------------- server interceptor ---------------------------------- // ---------------------------------- server interceptor ----------------------------------
......
...@@ -2,8 +2,8 @@ package interceptor ...@@ -2,8 +2,8 @@ package interceptor
import ( import (
"context" "context"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"sync" "sync"
ctxUtil "xmall/pkg/gin/xctx"
grpc_metadata "github.com/grpc-ecosystem/go-grpc-middleware/v2/metadata" grpc_metadata "github.com/grpc-ecosystem/go-grpc-middleware/v2/metadata"
"go.uber.org/zap" "go.uber.org/zap"
......
...@@ -18,7 +18,7 @@ import ( ...@@ -18,7 +18,7 @@ import (
"google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/runtime/protoimpl" "google.golang.org/protobuf/runtime/protoimpl"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func newUnaryRPCServer(unaryServerInterceptors ...grpc.UnaryServerInterceptor) string { func newUnaryRPCServer(unaryServerInterceptors ...grpc.UnaryServerInterceptor) string {
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func TestClientHTTPService(t *testing.T) { func TestClientHTTPService(t *testing.T) {
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"google.golang.org/grpc" "google.golang.org/grpc"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func Test_srvRegisterMetrics(t *testing.T) { func Test_srvRegisterMetrics(t *testing.T) {
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
"xmall/pkg/grpc/metrics" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/metrics"
) )
// RegisterFn register object // RegisterFn register object
......
...@@ -9,9 +9,9 @@ import ( ...@@ -9,9 +9,9 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
"xmall/pkg/grpc/metrics" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/metrics"
"xmall/pkg/logger" "gitlab.wanzhuangkj.com/tush/xpkg/logger"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
var fn = func(s *grpc.Server) { var fn = func(s *grpc.Server) {
......
...@@ -7,15 +7,15 @@ import ( ...@@ -7,15 +7,15 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/utils/xjson"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"io" "io"
"net/http" "net/http"
"net/url" "net/url"
"strings" "strings"
"time" "time"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/logger"
"xmall/pkg/utils/xjson"
"xmall/pkg/xerrors/xerror"
"github.com/duke-git/lancet/v2/retry" "github.com/duke-git/lancet/v2/retry"
) )
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
type myBody struct { type myBody struct {
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/IBM/sarama" "github.com/IBM/sarama"
"go.uber.org/zap" "go.uber.org/zap"
"xmall/pkg/grpc/gtls/certfile" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls/certfile"
) )
var ( var (
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"github.com/IBM/sarama/mocks" "github.com/IBM/sarama/mocks"
"go.uber.org/zap" "go.uber.org/zap"
"xmall/pkg/grpc/gtls/certfile" "gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls/certfile"
) )
var ( var (
......
...@@ -4,9 +4,9 @@ package nacoscli ...@@ -4,9 +4,9 @@ package nacoscli
import ( import (
"errors" "errors"
"fmt" "fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"os" "os"
"strings" "strings"
"xmall/pkg/xerrors/xerror"
"github.com/nacos-group/nacos-sdk-go/v2/clients" "github.com/nacos-group/nacos-sdk-go/v2/clients"
"github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client" "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client"
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/common/constant" "github.com/nacos-group/nacos-sdk-go/v2/common/constant"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
var ( var (
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func TestRegister(t *testing.T) { func TestRegister(t *testing.T) {
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"go.uber.org/zap" "go.uber.org/zap"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
var ( var (
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"go.uber.org/zap" "go.uber.org/zap"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func TestConsumerOptions(t *testing.T) { func TestConsumerOptions(t *testing.T) {
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
amqp "github.com/rabbitmq/amqp091-go" amqp "github.com/rabbitmq/amqp091-go"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func TestProducerOptions(t *testing.T) { func TestProducerOptions(t *testing.T) {
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
amqp "github.com/rabbitmq/amqp091-go" amqp "github.com/rabbitmq/amqp091-go"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
var testChannelName = "pub-sub" var testChannelName = "pub-sub"
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
amqp "github.com/rabbitmq/amqp091-go" amqp "github.com/rabbitmq/amqp091-go"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func TestSubscriber(t *testing.T) { func TestSubscriber(t *testing.T) {
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
"text/template" "text/template"
"time" "time"
"xmall/pkg/gofile" "gitlab.wanzhuangkj.com/tush/xpkg/gofile"
) )
var _ Replacer = (*replacerInfo)(nil) var _ Replacer = (*replacerInfo)(nil)
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
const name = "discovery" const name = "discovery"
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
type discovery struct{} type discovery struct{}
......
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
"google.golang.org/grpc/attributes" "google.golang.org/grpc/attributes"
"google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
type discoveryResolver struct { type discoveryResolver struct {
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver"
"google.golang.org/grpc/serviceconfig" "google.golang.org/grpc/serviceconfig"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
type cliConn struct { type cliConn struct {
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
// Client is consul client config // Client is consul client config
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
func getConsulClient() *Client { func getConsulClient() *Client {
......
...@@ -10,8 +10,8 @@ import ( ...@@ -10,8 +10,8 @@ import (
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
"xmall/pkg/consulcli" "gitlab.wanzhuangkj.com/tush/xpkg/consulcli"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
var ( var (
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"github.com/hashicorp/consul/api" "github.com/hashicorp/consul/api"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
func TestNewRegistry(t *testing.T) { func TestNewRegistry(t *testing.T) {
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"sync" "sync"
"sync/atomic" "sync/atomic"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
type serviceSet struct { type serviceSet struct {
......
...@@ -3,7 +3,7 @@ package consul ...@@ -3,7 +3,7 @@ package consul
import ( import (
"context" "context"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
type watcher struct { type watcher struct {
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"testing" "testing"
"time" "time"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
func newServiceSet() *serviceSet { func newServiceSet() *serviceSet {
......
...@@ -8,8 +8,8 @@ import ( ...@@ -8,8 +8,8 @@ import (
clientv3 "go.etcd.io/etcd/client/v3" clientv3 "go.etcd.io/etcd/client/v3"
"xmall/pkg/etcdcli" "gitlab.wanzhuangkj.com/tush/xpkg/etcdcli"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
var ( var (
......
...@@ -8,8 +8,8 @@ import ( ...@@ -8,8 +8,8 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
clientv3 "go.etcd.io/etcd/client/v3" clientv3 "go.etcd.io/etcd/client/v3"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func TestNewRegistry(t *testing.T) { func TestNewRegistry(t *testing.T) {
......
...@@ -4,7 +4,7 @@ package etcd ...@@ -4,7 +4,7 @@ package etcd
import ( import (
"encoding/json" "encoding/json"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
func marshal(si *registry.ServiceInstance) (string, error) { func marshal(si *registry.ServiceInstance) (string, error) {
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
clientv3 "go.etcd.io/etcd/client/v3" clientv3 "go.etcd.io/etcd/client/v3"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
var _ registry.Watcher = &watcher{} var _ registry.Watcher = &watcher{}
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
clientv3 "go.etcd.io/etcd/client/v3" clientv3 "go.etcd.io/etcd/client/v3"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
type wt struct{} type wt struct{}
......
...@@ -12,8 +12,8 @@ import ( ...@@ -12,8 +12,8 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/common/constant" "github.com/nacos-group/nacos-sdk-go/v2/common/constant"
"github.com/nacos-group/nacos-sdk-go/v2/vo" "github.com/nacos-group/nacos-sdk-go/v2/vo"
"xmall/pkg/nacoscli" "gitlab.wanzhuangkj.com/tush/xpkg/nacoscli"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
var ( var (
......
...@@ -7,8 +7,8 @@ import ( ...@@ -7,8 +7,8 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func TestNewRegistry(t *testing.T) { func TestNewRegistry(t *testing.T) {
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/model" "github.com/nacos-group/nacos-sdk-go/v2/model"
"github.com/nacos-group/nacos-sdk-go/v2/vo" "github.com/nacos-group/nacos-sdk-go/v2/vo"
"xmall/pkg/servicerd/registry" "gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
) )
var _ registry.Watcher = (*watcher)(nil) var _ registry.Watcher = (*watcher)(nil)
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client" "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/nacoscli" "gitlab.wanzhuangkj.com/tush/xpkg/nacoscli"
) )
func getCli() naming_client.INamingClient { func getCli() naming_client.INamingClient {
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"github.com/huandu/xstrings" "github.com/huandu/xstrings"
"gorm.io/gorm" "gorm.io/gorm"
"xmall/pkg/sgorm/dbclose" "gitlab.wanzhuangkj.com/tush/xpkg/sgorm/dbclose"
) )
type DB = gorm.DB type DB = gorm.DB
......
...@@ -13,9 +13,9 @@ import ( ...@@ -13,9 +13,9 @@ import (
"gorm.io/gorm/schema" "gorm.io/gorm/schema"
"gorm.io/plugin/dbresolver" "gorm.io/plugin/dbresolver"
"xmall/pkg/sgorm/dbclose" "gitlab.wanzhuangkj.com/tush/xpkg/sgorm/dbclose"
"xmall/pkg/sgorm/glog" "gitlab.wanzhuangkj.com/tush/xpkg/sgorm/glog"
"xmall/pkg/xerrors/xerror" "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
) )
// Init mysql // Init mysql
......
...@@ -12,8 +12,8 @@ import ( ...@@ -12,8 +12,8 @@ import (
"gorm.io/gorm/logger" "gorm.io/gorm/logger"
"gorm.io/gorm/schema" "gorm.io/gorm/schema"
"xmall/pkg/sgorm/dbclose" "gitlab.wanzhuangkj.com/tush/xpkg/sgorm/dbclose"
"xmall/pkg/sgorm/glog" "gitlab.wanzhuangkj.com/tush/xpkg/sgorm/glog"
) )
// Init postgresql // Init postgresql
......
...@@ -3,9 +3,9 @@ package query ...@@ -3,9 +3,9 @@ package query
import ( import (
"fmt" "fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/utils/xtime"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"strings" "strings"
"xmall/pkg/utils/xtime"
"xmall/pkg/xerrors/xerror"
) )
const ( const (
......
...@@ -12,8 +12,8 @@ import ( ...@@ -12,8 +12,8 @@ import (
"gorm.io/gorm/logger" "gorm.io/gorm/logger"
"gorm.io/gorm/schema" "gorm.io/gorm/schema"
"xmall/pkg/sgorm/dbclose" "gitlab.wanzhuangkj.com/tush/xpkg/sgorm/dbclose"
"xmall/pkg/sgorm/glog" "gitlab.wanzhuangkj.com/tush/xpkg/sgorm/glog"
) )
// Init sqlite // Init sqlite
......
...@@ -9,7 +9,7 @@ Circuit Breaker for web middleware and rpc interceptor. ...@@ -9,7 +9,7 @@ Circuit Breaker for web middleware and rpc interceptor.
**gin circuit breaker middleware** **gin circuit breaker middleware**
```go ```go
import "xmall/pkg/shield/circuitbreaker" import "gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
// CircuitBreaker a circuit breaker middleware // CircuitBreaker a circuit breaker middleware
func CircuitBreaker(opts ...CircuitBreakerOption) gin.HandlerFunc { func CircuitBreaker(opts ...CircuitBreakerOption) gin.HandlerFunc {
...@@ -45,7 +45,7 @@ func CircuitBreaker(opts ...CircuitBreakerOption) gin.HandlerFunc { ...@@ -45,7 +45,7 @@ func CircuitBreaker(opts ...CircuitBreakerOption) gin.HandlerFunc {
**rpc server circuit breaker interceptor** **rpc server circuit breaker interceptor**
```go ```go
import "xmall/pkg/shield/circuitbreaker" import "gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
// UnaryServerCircuitBreaker server-side unary circuit breaker interceptor // UnaryServerCircuitBreaker server-side unary circuit breaker interceptor
func UnaryServerCircuitBreaker(opts ...CircuitBreakerOption) grpc.UnaryServerInterceptor { func UnaryServerCircuitBreaker(opts ...CircuitBreakerOption) grpc.UnaryServerInterceptor {
......
...@@ -3,7 +3,7 @@ package circuitbreaker_test ...@@ -3,7 +3,7 @@ package circuitbreaker_test
import ( import (
"testing" "testing"
"xmall/pkg/shield/circuitbreaker" "gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
) )
// This is an example of using a circuit breaker Do() when return nil. // This is an example of using a circuit breaker Do() when return nil.
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"xmall/pkg/shield/window" "gitlab.wanzhuangkj.com/tush/xpkg/shield/window"
) )
// Option is sre breaker option function. // Option is sre breaker option function.
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/shield/window" "gitlab.wanzhuangkj.com/tush/xpkg/shield/window"
) )
func getSREBreaker() *Breaker { func getSREBreaker() *Breaker {
......
...@@ -7,8 +7,8 @@ import ( ...@@ -7,8 +7,8 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"xmall/pkg/shield/cpu" "gitlab.wanzhuangkj.com/tush/xpkg/shield/cpu"
"xmall/pkg/shield/window" "gitlab.wanzhuangkj.com/tush/xpkg/shield/window"
) )
var ( var (
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"xmall/pkg/shield/window" "gitlab.wanzhuangkj.com/tush/xpkg/shield/window"
) )
var ( var (
......
...@@ -13,8 +13,8 @@ import ( ...@@ -13,8 +13,8 @@ import (
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
mgoOptions "go.mongodb.org/mongo-driver/mongo/options" mgoOptions "go.mongodb.org/mongo-driver/mongo/options"
"xmall/pkg/mgo" "gitlab.wanzhuangkj.com/tush/xpkg/mgo"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
const ( const (
......
...@@ -651,7 +651,7 @@ func getModelStructCode(data tmplData, importPaths []string, isEmbed bool, jsonN ...@@ -651,7 +651,7 @@ func getModelStructCode(data tmplData, importPaths []string, isEmbed bool, jsonN
newImportPaths = append(newImportPaths, path) newImportPaths = append(newImportPaths, path)
} }
} }
newImportPaths = append(newImportPaths, "xmall/pkg/sgorm") newImportPaths = append(newImportPaths, "gitlab.wanzhuangkj.com/tush/xpkg/sgorm")
} else { } else {
for i, field := range data.Fields { for i, field := range data.Fields {
switch field.DBDriver { switch field.DBDriver {
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"xmall/pkg/sgorm/sqlite" "gitlab.wanzhuangkj.com/tush/xpkg/sgorm/sqlite"
) )
// GetSqliteTableInfo get table info from sqlite // GetSqliteTableInfo get table info from sqlite
......
...@@ -9,9 +9,9 @@ import ( ...@@ -9,9 +9,9 @@ import (
"os" "os"
"strings" "strings"
"xmall/pkg/gofile" "gitlab.wanzhuangkj.com/tush/xpkg/gofile"
"xmall/pkg/sql2code/parser" "gitlab.wanzhuangkj.com/tush/xpkg/sql2code/parser"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
// Args generate code arguments // Args generate code arguments
......
...@@ -8,8 +8,8 @@ import ( ...@@ -8,8 +8,8 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
"xmall/pkg/stat/cpu" "gitlab.wanzhuangkj.com/tush/xpkg/stat/cpu"
"xmall/pkg/stat/mem" "gitlab.wanzhuangkj.com/tush/xpkg/stat/mem"
) )
var ( var (
......
...@@ -3,8 +3,8 @@ package aliyun ...@@ -3,8 +3,8 @@ package aliyun
import ( import (
"io" "io"
"mime/multipart" "mime/multipart"
"xmall/internal/config"
"xmall/pkg/xerrors/xerror" "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"github.com/aliyun/aliyun-oss-go-sdk/oss" "github.com/aliyun/aliyun-oss-go-sdk/oss"
) )
...@@ -13,71 +13,49 @@ type AliyunOSS struct{} ...@@ -13,71 +13,49 @@ type AliyunOSS struct{}
var OSS = &AliyunOSS{} var OSS = &AliyunOSS{}
func NewClient() (bucket *oss.Bucket, err error) { type AliOssConfig struct {
endpoint := "" Endpoint string `mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
accessKeyId := "" AccessKeyId string `mapstructure:"access-key-id" json:"access-key-id" yaml:"access-key-id"`
accessKeySecret := "" AccessKeySecret string `mapstructure:"access-key-secret" json:"access-key-secret" yaml:"access-key-secret"`
region := "" BucketName string `mapstructure:"bucket-name" json:"bucket-name" yaml:"bucket-name"`
bucketName := "" BasePath string `mapstructure:"base-path" json:"base-path" yaml:"base-path"`
BucketUrl string `mapstructure:"bucket-url" json:"bucket-url" yaml:"bucket-url"`
Region string `mapstructure:"region" json:"region" yaml:"region"`
}
config.Read(func(c *config.Config) { func NewClient(cfg *AliOssConfig) (bucket *oss.Bucket, err error) {
endpoint = c.Extend.AliOss.Endpoint client, err := oss.New(cfg.Endpoint,
accessKeyId = c.Extend.AliOss.AccessKeyId cfg.AccessKeyId,
accessKeySecret = c.Extend.AliOss.AccessKeySecret cfg.AccessKeySecret,
region = c.Extend.AliOss.Region
bucketName = c.Extend.AliOss.BucketName
})
client, err := oss.New(endpoint,
accessKeyId,
accessKeySecret,
oss.AuthVersion(oss.AuthV4), oss.AuthVersion(oss.AuthV4),
oss.Region(region)) oss.Region(cfg.Region))
if err != nil { if err != nil {
return nil, xerror.New(err.Error()) return nil, xerror.New(err.Error())
} }
bucket, err = client.Bucket(bucketName) bucket, err = client.Bucket(cfg.BucketName)
return return
} }
func NewBucket() (bucket *oss.Bucket, err error) { func NewBucket(cfg *AliOssConfig) (bucket *oss.Bucket, err error) {
endpoint := "" client, err := oss.New(cfg.Endpoint, cfg.AccessKeyId, cfg.AccessKeySecret)
accessKeyId := ""
accessKeySecret := ""
bucketName := ""
config.Read(func(c *config.Config) {
endpoint = c.Extend.AliOss.Endpoint
accessKeyId = c.Extend.AliOss.AccessKeyId
accessKeySecret = c.Extend.AliOss.AccessKeySecret
bucketName = c.Extend.AliOss.BucketName
})
client, err := oss.New(endpoint, accessKeyId, accessKeySecret)
if err != nil { if err != nil {
return return
} }
bucket, err = client.Bucket(bucketName) bucket, err = client.Bucket(cfg.BucketName)
return return
} }
func (*AliyunOSS) UploadFile(reader io.Reader, name string) (string, string, error) { func (*AliyunOSS) UploadFile(reader io.Reader, name string, cfg *AliOssConfig) (string, string, error) {
basePath := "" bucket, err := NewClient(cfg)
bucketUrl := ""
config.Read(func(c *config.Config) {
basePath = c.Extend.AliOss.BasePath
bucketUrl = c.Extend.AliOss.BucketUrl
})
bucket, err := NewClient()
if err != nil { if err != nil {
return "", "", err return "", "", err
} }
fileTmpPath := basePath + "/" + name fileTmpPath := cfg.BasePath + "/" + name
err = bucket.PutObject(fileTmpPath, reader) err = bucket.PutObject(fileTmpPath, reader)
if err != nil { if err != nil {
return "", "", xerror.New(err.Error()) return "", "", xerror.New(err.Error())
} }
return bucketUrl + "/" + fileTmpPath, fileTmpPath, nil return cfg.BucketUrl + "/" + fileTmpPath, fileTmpPath, nil
} }
type Attachment struct { type Attachment struct {
...@@ -106,17 +84,15 @@ func (x Attachment) NewFromMultipartFileHeaders(files []*multipart.FileHeader) ( ...@@ -106,17 +84,15 @@ func (x Attachment) NewFromMultipartFileHeaders(files []*multipart.FileHeader) (
return attachments, nil return attachments, nil
} }
func (x *AliyunOSS) UploadMultipartFileHeaders(files []*multipart.FileHeader) ([]*Attachment, error) { func (x *AliyunOSS) UploadMultipartFileHeaders(files []*multipart.FileHeader, cfg *AliOssConfig) ([]*Attachment, error) {
if len(files) == 0 { if len(files) == 0 {
return nil, nil return nil, nil
} }
attachments, err := Attachment{}.NewFromMultipartFileHeaders(files) attachments, err := Attachment{}.NewFromMultipartFileHeaders(files)
if err != nil { if err != nil {
return nil, err return nil, err
} }
err = x.UploadFiles(&attachments, cfg)
err = x.UploadFiles(&attachments)
if err != nil { if err != nil {
return nil, err return nil, err
} }
...@@ -124,29 +100,21 @@ func (x *AliyunOSS) UploadMultipartFileHeaders(files []*multipart.FileHeader) ([ ...@@ -124,29 +100,21 @@ func (x *AliyunOSS) UploadMultipartFileHeaders(files []*multipart.FileHeader) ([
return attachments, nil return attachments, nil
} }
func (*AliyunOSS) UploadFiles(files *[]*Attachment) error { func (*AliyunOSS) UploadFiles(files *[]*Attachment, cfg *AliOssConfig) error {
if len(*files) == 0 { if len(*files) == 0 {
return nil return nil
} }
basePath := "" bucket, err := NewClient(cfg)
bucketUrl := ""
config.Read(func(c *config.Config) {
basePath = c.Extend.AliOss.BasePath
bucketUrl = c.Extend.AliOss.BucketUrl
})
bucket, err := NewClient()
if err != nil { if err != nil {
return xerror.New(err.Error()) return xerror.New(err.Error())
} }
for i, file := range *files { for i, file := range *files {
relativeUri := basePath + "/" + file.Name relativeUri := cfg.BasePath + "/" + file.Name
err = bucket.PutObject(relativeUri, file.File) err = bucket.PutObject(relativeUri, file.File)
if err != nil { if err != nil {
return xerror.New(err.Error()) return xerror.New(err.Error())
} }
(*files)[i].AbsUrl = bucketUrl + "/" + relativeUri (*files)[i].AbsUrl = cfg.BucketUrl + "/" + relativeUri
(*files)[i].RelativeUrl = relativeUri (*files)[i].RelativeUrl = relativeUri
} }
return nil return nil
......
...@@ -2,10 +2,10 @@ package wg ...@@ -2,10 +2,10 @@ package wg
import ( import (
"context" "context"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"sync" "sync"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/logger"
"xmall/pkg/xerrors/xerror"
) )
func Go(ctx context.Context, n int, fn func() error) error { func Go(ctx context.Context, n int, fn func() error) error {
......
...@@ -2,9 +2,9 @@ package xslice ...@@ -2,9 +2,9 @@ package xslice
import ( import (
"fmt" "fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/xset"
"strings" "strings"
"xmall/pkg/xerrors/xerror"
"xmall/pkg/xset"
"github.com/jinzhu/copier" "github.com/jinzhu/copier"
"github.com/spf13/cast" "github.com/spf13/cast"
......
...@@ -13,7 +13,7 @@ import ( ...@@ -13,7 +13,7 @@ import (
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"go.uber.org/zap" "go.uber.org/zap"
"xmall/pkg/utils" "gitlab.wanzhuangkj.com/tush/xpkg/utils"
) )
func TestWebSocketServerDefault(t *testing.T) { func TestWebSocketServerDefault(t *testing.T) {
......
...@@ -3,13 +3,13 @@ package ws ...@@ -3,13 +3,13 @@ package ws
import ( import (
"context" "context"
"encoding/json" "encoding/json"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/jwt"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"net/http" "net/http"
"sync" "sync"
"time" "time"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/jwt"
"xmall/pkg/logger"
"xmall/pkg/xerrors/xerror"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
......
...@@ -3,7 +3,7 @@ package xerror ...@@ -3,7 +3,7 @@ package xerror
import ( import (
"fmt" "fmt"
"xmall/pkg/xerrors/xcode" "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xcode"
) )
// New 用于创建一个自定义文本错误信息的 error 对象,并包含堆栈信息。 // New 用于创建一个自定义文本错误信息的 error 对象,并包含堆栈信息。
......
...@@ -2,8 +2,8 @@ package xerror ...@@ -2,8 +2,8 @@ package xerror
import ( import (
"fmt" "fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xcode"
"strings" "strings"
"xmall/pkg/xerrors/xcode"
) )
// NewCode 用于创建一个自定义错误信息的 error 对象,并包含堆栈信息,并增加错误码对象的输入。 // NewCode 用于创建一个自定义错误信息的 error 对象,并包含堆栈信息,并增加错误码对象的输入。
......
package xerror package xerror
import "xmall/pkg/xerrors/xcode" import "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xcode"
// Code 获取错误码。 // Code 获取错误码。
// 如果没有错误代码,则返回 `xcode.CodeDefault`。 // 如果没有错误代码,则返回 `xcode.CodeDefault`。
......
package xerror_test package xerror_test
import ( import (
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"testing" "testing"
"xmall/pkg/xerrors/xerror"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
......
...@@ -2,8 +2,8 @@ package xerror_test ...@@ -2,8 +2,8 @@ package xerror_test
import ( import (
"fmt" "fmt"
"xmall/pkg/xerrors/xcode" "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xcode"
"xmall/pkg/xerrors/xerror" "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
......
...@@ -3,12 +3,12 @@ package xerror_test ...@@ -3,12 +3,12 @@ package xerror_test
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xcode"
"testing" "testing"
"xmall/pkg/xerrors/xcode"
"github.com/pkg/errors" "github.com/pkg/errors"
"xmall/pkg/xerrors/xerror" "gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"gorm.io/gorm" "gorm.io/gorm"
......
package xset package xset
import ( import (
"xmall/pkg/xtype" "gitlab.wanzhuangkj.com/tush/xpkg/xtype"
) )
type Set[T xtype.Key] struct { type Set[T xtype.Key] struct {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论