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

update

上级 28f23171
......@@ -10,8 +10,9 @@ import (
"golang.org/x/sync/errgroup"
xlogger "xmall/pkg/logger"
"xmall/pkg/prof"
"gitlab.wanzhuangkj.com/tush/xpkg/prof"
xlogger "gitlab.wanzhuangkj.com/tush/xpkg/logger"
)
// IServer server interface
......
......@@ -6,9 +6,9 @@ import (
"github.com/stretchr/testify/assert"
"xmall/pkg/encoding"
"xmall/pkg/gotest"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/encoding"
"gitlab.wanzhuangkj.com/tush/xpkg/gotest"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
type cacheUser struct {
......
......@@ -10,11 +10,11 @@ import (
"github.com/dgraph-io/ristretto"
"github.com/spf13/cast"
"xmall/pkg/encoding"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/logger"
xslice "xmall/pkg/utils/xslice"
"xmall/pkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/encoding"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
xslice "gitlab.wanzhuangkj.com/tush/xpkg/utils/xslice"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
)
type memoryCache struct {
......
......@@ -6,9 +6,9 @@ import (
"github.com/stretchr/testify/assert"
"xmall/pkg/encoding"
"xmall/pkg/gotest"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/encoding"
"gitlab.wanzhuangkj.com/tush/xpkg/gotest"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
type memoryUser struct {
......
......@@ -10,8 +10,8 @@ import (
"github.com/redis/go-redis/v9"
"xmall/pkg/encoding"
"xmall/pkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/encoding"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
)
// CacheNotFound no hit cache
......
......@@ -6,9 +6,9 @@ import (
"github.com/stretchr/testify/assert"
"xmall/pkg/encoding"
"xmall/pkg/gotest"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/encoding"
"gitlab.wanzhuangkj.com/tush/xpkg/gotest"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
type redisUser struct {
......
......@@ -2,8 +2,8 @@ package conf
import (
"bytes"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"log"
"xmall/pkg/xerrors/xerror"
consulapi "github.com/armon/consul-api"
"github.com/spf13/viper"
......
......@@ -6,10 +6,10 @@ import (
"bytes"
"encoding/json"
"fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"path"
"path/filepath"
"strings"
"xmall/pkg/xerrors/xerror"
"github.com/fsnotify/fsnotify"
"github.com/spf13/viper"
......
......@@ -3,7 +3,7 @@ package consulcli
import (
"fmt"
"xmall/pkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"github.com/hashicorp/consul/api"
)
......
......@@ -5,7 +5,7 @@ import (
"testing"
"time"
"xmall/pkg/etcdcli"
"gitlab.wanzhuangkj.com/tush/xpkg/etcdcli"
"go.uber.org/zap"
)
......
......@@ -7,7 +7,7 @@ import (
"testing"
"time"
"xmall/pkg/goredis"
"gitlab.wanzhuangkj.com/tush/xpkg/goredis"
)
func TestRedisLock_TryLock(t *testing.T) {
......
......@@ -4,8 +4,8 @@ import (
"crypto/rand"
"crypto/tls"
"fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"math/big"
"xmall/pkg/xerrors/xerror"
"gopkg.in/gomail.v2"
)
......
......@@ -8,7 +8,7 @@ import (
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"xmall/pkg/encoding"
"gitlab.wanzhuangkj.com/tush/xpkg/encoding"
)
// Name is the name registered for the json codec.
......
......@@ -6,7 +6,7 @@ import (
"google.golang.org/protobuf/proto"
"xmall/pkg/encoding"
"gitlab.wanzhuangkj.com/tush/xpkg/encoding"
)
// Name is the name registered for the proto compressor.
......
......@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/status"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
var rpcStatus = []*RPCStatus{
......
......@@ -3,8 +3,8 @@ package etcdcli
import (
"fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"time"
"xmall/pkg/xerrors/xerror"
clientv3 "go.etcd.io/etcd/client/v3"
"google.golang.org/grpc"
......
......@@ -9,8 +9,8 @@ import (
"github.com/gin-gonic/gin"
"xmall/pkg/errcode"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
// CheckHealthReply check health result
......
......@@ -4,11 +4,11 @@ package middleware
import (
"github.com/gin-gonic/gin"
"xmall/pkg/errcode"
"xmall/pkg/gin/response"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/jwt"
"xmall/pkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/jwt"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
)
const (
......
......@@ -12,10 +12,10 @@ import (
"github.com/gin-gonic/gin"
"xmall/pkg/gin/response"
"xmall/pkg/httpcli"
"xmall/pkg/jwt"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"gitlab.wanzhuangkj.com/tush/xpkg/jwt"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
"github.com/stretchr/testify/assert"
)
......
......@@ -5,9 +5,9 @@ import (
"github.com/gin-gonic/gin"
"xmall/pkg/container/group"
"xmall/pkg/gin/response"
"xmall/pkg/shield/circuitbreaker"
"gitlab.wanzhuangkj.com/tush/xpkg/container/group"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
)
// ErrNotAllowed error not allowed.
......
......@@ -11,11 +11,11 @@ import (
"github.com/gin-gonic/gin"
"xmall/pkg/container/group"
"xmall/pkg/gin/response"
"xmall/pkg/httpcli"
"xmall/pkg/shield/circuitbreaker"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/container/group"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func runCircuitBreakerHTTPServer() string {
......
......@@ -2,11 +2,11 @@ package middleware
import (
"bytes"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/ips"
"io"
"net/http"
"time"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/ips"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
......
......@@ -7,11 +7,11 @@ import (
"github.com/gin-gonic/gin"
"xmall/pkg/gin/response"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/httpcli"
"xmall/pkg/logger"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func init() {
......
......@@ -8,8 +8,8 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"xmall/pkg/gin/handlerfunc"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/handlerfunc"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func TestMetrics(t *testing.T) {
......
......@@ -7,8 +7,8 @@ import (
"github.com/gin-gonic/gin"
"xmall/pkg/gin/response"
rl "xmall/pkg/shield/ratelimit"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
rl "gitlab.wanzhuangkj.com/tush/xpkg/shield/ratelimit"
)
// ErrLimitExceed is returned when the rate limiter is
......
......@@ -11,9 +11,9 @@ import (
"github.com/gin-gonic/gin"
"xmall/pkg/gin/response"
"xmall/pkg/httpcli"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func runRateLimiterHTTPServer() string {
......
package middleware
import (
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"net/http"
ctxUtil "xmall/pkg/gin/xctx"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
......
......@@ -2,8 +2,8 @@ package middleware
import (
"context"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"net/http"
ctxUtil "xmall/pkg/gin/xctx"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
......
......@@ -6,8 +6,8 @@ import (
"testing"
"time"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/utils"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
......
......@@ -5,9 +5,9 @@ import (
"testing"
"time"
"xmall/pkg/gin/response"
"xmall/pkg/httpcli"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/gin/response"
"gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
......
......@@ -8,7 +8,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func TestRegister(t *testing.T) {
......
......@@ -8,11 +8,10 @@ import (
"github.com/gin-gonic/gin"
"xmall/internal/ecode"
"xmall/pkg/errcode"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/logger"
"xmall/pkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/errcode"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
)
const CustomErrorCode = 0
......@@ -74,7 +73,7 @@ func respJSONWithStatusCode(c *gin.Context, code int, msg string, data ...interf
func Output(c *gin.Context, code int, data ...interface{}) {
switch code {
case http.StatusOK:
respJSONWithStatusCode(c, http.StatusOK, ecode.Success.Msg(), data...)
respJSONWithStatusCode(c, http.StatusOK, errcode.Success.Msg(), data...)
case http.StatusBadRequest:
respJSONWithStatusCode(c, http.StatusBadRequest, errcode.InvalidParams.Msg(), data...)
case http.StatusUnauthorized:
......@@ -104,7 +103,7 @@ func Out(c *gin.Context, err *errcode.Error, data ...interface{}) {
code := err.ToHTTPCode()
switch code {
case http.StatusOK:
respJSONWithStatusCode(c, http.StatusOK, ecode.Success.Msg(), data...)
respJSONWithStatusCode(c, http.StatusOK, errcode.Success.Msg(), data...)
case http.StatusInternalServerError:
respJSONWithStatusCode(c, http.StatusInternalServerError, err.Msg(), data...)
case http.StatusBadRequest:
......@@ -141,17 +140,17 @@ func respJSONWith200(c *gin.Context, code int, msg string, data ...interface{})
// Success return success
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
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
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
......
......@@ -10,10 +10,9 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"xmall/internal/ecode"
"xmall/pkg/errcode"
"xmall/pkg/httpcli"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"gitlab.wanzhuangkj.com/tush/xpkg/httpcli"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
var (
......@@ -66,7 +65,7 @@ func TestRespond(t *testing.T) {
result = &httpcli.StdResult{}
err = httpcli.Get(context.Background(), result, requestAddr+"/error")
assert.NoError(t, err)
assert.NotEqual(t, ecode.Success.Code(), result.Code)
assert.NotEqual(t, errcode.Success.Code(), result.Code)
for _, code := range httpResponseCodes {
result := &httpcli.StdResult{}
......
......@@ -11,7 +11,7 @@ import (
ginSwagger "github.com/swaggo/gin-swagger"
"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
......
......@@ -9,7 +9,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func runHTTPServer(registerSwaggerFn func(r *gin.Engine)) string {
......
......@@ -17,7 +17,7 @@ import (
"github.com/gin-gonic/gin/binding"
"github.com/stretchr/testify/assert"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func runValidatorHTTPServer() string {
......
......@@ -2,7 +2,7 @@ package xctx
import (
"context"
xsf "xmall/pkg/utils/xsnowflake"
xsf "gitlab.wanzhuangkj.com/tush/xpkg/utils/xsnowflake"
"github.com/gin-gonic/gin"
"github.com/spf13/cast"
......
......@@ -8,7 +8,7 @@ import (
"encoding/hex"
"errors"
"xmall/pkg/gocrypto/wcipher"
"gitlab.wanzhuangkj.com/tush/xpkg/gocrypto/wcipher"
)
// AesEncrypt aes encryption, returns ciphertext is not transcoded
......
......@@ -6,7 +6,7 @@ package gocrypto
import (
"encoding/hex"
"xmall/pkg/gocrypto/wcipher"
"gitlab.wanzhuangkj.com/tush/xpkg/gocrypto/wcipher"
)
// DesEncrypt des encryption, the returned ciphertext is not transcoded
......
......@@ -7,8 +7,8 @@ import (
"runtime"
"time"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/logger"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"github.com/redis/go-redis/v9"
"go.uber.org/zap"
......
......@@ -6,7 +6,7 @@ import (
"github.com/alicebob/miniredis/v2"
"github.com/redis/go-redis/v9"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
// Cache redis cache
......
......@@ -9,7 +9,7 @@ import (
"github.com/DATA-DOG/go-sqlmock"
"gorm.io/gorm"
"xmall/pkg/sgorm/query"
"gitlab.wanzhuangkj.com/tush/xpkg/sgorm/query"
)
func TestNewDao(t *testing.T) {
......
......@@ -9,7 +9,7 @@ import (
"github.com/gin-gonic/gin"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
// Handler info
......
......@@ -9,7 +9,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
// Service info
......
......@@ -8,10 +8,10 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"xmall/pkg/grpc/gtls"
"xmall/pkg/grpc/interceptor"
"xmall/pkg/logger"
"xmall/pkg/servicerd/discovery"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/interceptor"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/discovery"
)
// NewClient creates a new grpc client
......
......@@ -9,8 +9,8 @@ import (
clientv3 "go.etcd.io/etcd/client/v3"
"go.uber.org/zap"
"xmall/pkg/grpc/gtls/certfile"
"xmall/pkg/servicerd/registry/etcd"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls/certfile"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry/etcd"
)
func TestNewClient(t *testing.T) {
......
......@@ -6,7 +6,7 @@ import (
"go.uber.org/zap"
"google.golang.org/grpc"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
var (
......
......@@ -9,8 +9,8 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"xmall/pkg/grpc/interceptor"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/interceptor"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
func TestWithDialOptions(t *testing.T) {
......
......@@ -3,7 +3,7 @@ package gtls
import (
"testing"
"xmall/pkg/grpc/gtls/certfile"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls/certfile"
"github.com/stretchr/testify/assert"
)
......
......@@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/assert"
"xmall/pkg/grpc/gtls/certfile"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls/certfile"
)
func TestGetServerTLSCredentials(t *testing.T) {
......
......@@ -8,9 +8,9 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"xmall/pkg/container/group"
"xmall/pkg/errcode"
"xmall/pkg/shield/circuitbreaker"
"gitlab.wanzhuangkj.com/tush/xpkg/container/group"
"gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
)
// ErrNotAllowed error not allowed.
......
......@@ -7,9 +7,9 @@ import (
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"xmall/pkg/container/group"
"xmall/pkg/errcode"
"xmall/pkg/shield/circuitbreaker"
"gitlab.wanzhuangkj.com/tush/xpkg/container/group"
"gitlab.wanzhuangkj.com/tush/xpkg/errcode"
"gitlab.wanzhuangkj.com/tush/xpkg/shield/circuitbreaker"
"google.golang.org/grpc/codes"
)
......
......@@ -10,7 +10,7 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"xmall/pkg/jwt"
"gitlab.wanzhuangkj.com/tush/xpkg/jwt"
)
// ---------------------------------- client ----------------------------------
......
......@@ -9,8 +9,8 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"xmall/pkg/jwt"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/jwt"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
var (
......
......@@ -9,7 +9,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/status"
zapLog "xmall/pkg/logger"
zapLog "gitlab.wanzhuangkj.com/tush/xpkg/logger"
)
var contentMark = []byte(" ...... ")
......
......@@ -5,7 +5,7 @@ import (
"testing"
"time"
"xmall/pkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
)
func TestUnaryClientLog(t *testing.T) {
......
......@@ -3,7 +3,7 @@ package interceptor
import (
"google.golang.org/grpc"
"xmall/pkg/grpc/metrics"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/metrics"
)
// UnaryClientMetrics client-side metrics unary interceptor
......
......@@ -6,8 +6,8 @@ import (
"google.golang.org/grpc"
"xmall/pkg/errcode"
rl "xmall/pkg/shield/ratelimit"
"gitlab.wanzhuangkj.com/tush/xpkg/errcode"
rl "gitlab.wanzhuangkj.com/tush/xpkg/shield/ratelimit"
)
// ---------------------------------- server interceptor ----------------------------------
......
......@@ -2,8 +2,8 @@ package interceptor
import (
"context"
ctxUtil "gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"sync"
ctxUtil "xmall/pkg/gin/xctx"
grpc_metadata "github.com/grpc-ecosystem/go-grpc-middleware/v2/metadata"
"go.uber.org/zap"
......
......@@ -18,7 +18,7 @@ import (
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/runtime/protoimpl"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func newUnaryRPCServer(unaryServerInterceptors ...grpc.UnaryServerInterceptor) string {
......
......@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func TestClientHTTPService(t *testing.T) {
......
......@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func Test_srvRegisterMetrics(t *testing.T) {
......
......@@ -8,7 +8,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"xmall/pkg/grpc/metrics"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/metrics"
)
// RegisterFn register object
......
......@@ -9,9 +9,9 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"xmall/pkg/grpc/metrics"
"xmall/pkg/logger"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/metrics"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
var fn = func(s *grpc.Server) {
......
......@@ -7,15 +7,15 @@ import (
"encoding/json"
"errors"
"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"
"net/http"
"net/url"
"strings"
"time"
ctxUtil "xmall/pkg/gin/xctx"
"xmall/pkg/logger"
"xmall/pkg/utils/xjson"
"xmall/pkg/xerrors/xerror"
"github.com/duke-git/lancet/v2/retry"
)
......
......@@ -12,7 +12,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
type myBody struct {
......
......@@ -9,7 +9,7 @@ import (
"github.com/IBM/sarama"
"go.uber.org/zap"
"xmall/pkg/grpc/gtls/certfile"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls/certfile"
)
var (
......
......@@ -8,7 +8,7 @@ import (
"github.com/IBM/sarama/mocks"
"go.uber.org/zap"
"xmall/pkg/grpc/gtls/certfile"
"gitlab.wanzhuangkj.com/tush/xpkg/grpc/gtls/certfile"
)
var (
......
......@@ -4,9 +4,9 @@ package nacoscli
import (
"errors"
"fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"os"
"strings"
"xmall/pkg/xerrors/xerror"
"github.com/nacos-group/nacos-sdk-go/v2/clients"
"github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client"
......
......@@ -9,7 +9,7 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
"github.com/stretchr/testify/assert"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
var (
......
......@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func TestRegister(t *testing.T) {
......
......@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
var (
......
......@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func TestConsumerOptions(t *testing.T) {
......
......@@ -9,7 +9,7 @@ import (
amqp "github.com/rabbitmq/amqp091-go"
"github.com/stretchr/testify/assert"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func TestProducerOptions(t *testing.T) {
......
......@@ -8,7 +8,7 @@ import (
amqp "github.com/rabbitmq/amqp091-go"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
var testChannelName = "pub-sub"
......
......@@ -7,7 +7,7 @@ import (
amqp "github.com/rabbitmq/amqp091-go"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func TestSubscriber(t *testing.T) {
......
......@@ -12,7 +12,7 @@ import (
"text/template"
"time"
"xmall/pkg/gofile"
"gitlab.wanzhuangkj.com/tush/xpkg/gofile"
)
var _ Replacer = (*replacerInfo)(nil)
......
......@@ -8,7 +8,7 @@ import (
"google.golang.org/grpc/resolver"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
const name = "discovery"
......
......@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/resolver"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
type discovery struct{}
......
......@@ -13,7 +13,7 @@ import (
"google.golang.org/grpc/attributes"
"google.golang.org/grpc/resolver"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
type discoveryResolver struct {
......
......@@ -10,7 +10,7 @@ import (
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/serviceconfig"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
type cliConn struct {
......
......@@ -10,7 +10,7 @@ import (
"github.com/hashicorp/consul/api"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
// Client is consul client config
......
......@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/consul/api"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
func getConsulClient() *Client {
......
......@@ -10,8 +10,8 @@ import (
"github.com/hashicorp/consul/api"
"xmall/pkg/consulcli"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/consulcli"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
var (
......
......@@ -7,7 +7,7 @@ import (
"github.com/hashicorp/consul/api"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
func TestNewRegistry(t *testing.T) {
......
......@@ -4,7 +4,7 @@ import (
"sync"
"sync/atomic"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
type serviceSet struct {
......
......@@ -3,7 +3,7 @@ package consul
import (
"context"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
type watcher struct {
......
......@@ -7,7 +7,7 @@ import (
"testing"
"time"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
func newServiceSet() *serviceSet {
......
......@@ -8,8 +8,8 @@ import (
clientv3 "go.etcd.io/etcd/client/v3"
"xmall/pkg/etcdcli"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/etcdcli"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
var (
......
......@@ -8,8 +8,8 @@ import (
"github.com/stretchr/testify/assert"
clientv3 "go.etcd.io/etcd/client/v3"
"xmall/pkg/servicerd/registry"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func TestNewRegistry(t *testing.T) {
......
......@@ -4,7 +4,7 @@ package etcd
import (
"encoding/json"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
func marshal(si *registry.ServiceInstance) (string, error) {
......
......@@ -5,7 +5,7 @@ import (
clientv3 "go.etcd.io/etcd/client/v3"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
var _ registry.Watcher = &watcher{}
......
......@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
clientv3 "go.etcd.io/etcd/client/v3"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
type wt struct{}
......
......@@ -12,8 +12,8 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
"github.com/nacos-group/nacos-sdk-go/v2/vo"
"xmall/pkg/nacoscli"
"xmall/pkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/nacoscli"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
)
var (
......
......@@ -7,8 +7,8 @@ import (
"github.com/stretchr/testify/assert"
"xmall/pkg/servicerd/registry"
"xmall/pkg/utils"
"gitlab.wanzhuangkj.com/tush/xpkg/servicerd/registry"
"gitlab.wanzhuangkj.com/tush/xpkg/utils"
)
func TestNewRegistry(t *testing.T) {
......
......@@ -8,7 +8,7 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/model"
"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)
......
......@@ -8,7 +8,7 @@ import (
"github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client"
"github.com/stretchr/testify/assert"
"xmall/pkg/nacoscli"
"gitlab.wanzhuangkj.com/tush/xpkg/nacoscli"
)
func getCli() naming_client.INamingClient {
......
......@@ -8,7 +8,7 @@ import (
"github.com/huandu/xstrings"
"gorm.io/gorm"
"xmall/pkg/sgorm/dbclose"
"gitlab.wanzhuangkj.com/tush/xpkg/sgorm/dbclose"
)
type DB = gorm.DB
......
......@@ -13,9 +13,9 @@ import (
"gorm.io/gorm/schema"
"gorm.io/plugin/dbresolver"
"xmall/pkg/sgorm/dbclose"
"xmall/pkg/sgorm/glog"
"xmall/pkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/sgorm/dbclose"
"gitlab.wanzhuangkj.com/tush/xpkg/sgorm/glog"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
)
// Init mysql
......
......@@ -12,8 +12,8 @@ import (
"gorm.io/gorm/logger"
"gorm.io/gorm/schema"
"xmall/pkg/sgorm/dbclose"
"xmall/pkg/sgorm/glog"
"gitlab.wanzhuangkj.com/tush/xpkg/sgorm/dbclose"
"gitlab.wanzhuangkj.com/tush/xpkg/sgorm/glog"
)
// Init postgresql
......
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论