Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xpkg
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
屠思豪
xpkg
Commits
48539002
提交
48539002
authored
5月 13, 2025
作者:
mooncake9527
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
28f23171
隐藏空白字符变更
内嵌
并排
正在显示
125 个修改的文件
包含
245 行增加
和
278 行删除
+245
-278
app.go
app/app.go
+3
-2
cache_test.go
cache/cache_test.go
+3
-3
memory.go
cache/memory.go
+5
-5
memory_test.go
cache/memory_test.go
+3
-3
redis.go
cache/redis.go
+2
-2
redis_test.go
cache/redis_test.go
+3
-3
consul_parse.go
conf/consul_parse.go
+1
-1
local_parse.go
conf/local_parse.go
+1
-1
consulcli.go
consulcli/consulcli.go
+1
-1
etcd_test.go
dlock/etcd_test.go
+1
-1
redis_test.go
dlock/redis_test.go
+1
-1
email.go
email/email.go
+1
-1
json.go
encoding/json/json.go
+1
-1
proto.go
encoding/proto/proto.go
+1
-1
rpc_error_test.go
errcode/rpc_error_test.go
+1
-1
etcdcli.go
etcdcli/etcdcli.go
+1
-1
common.go
gin/handlerfunc/common.go
+2
-2
auth.go
gin/middleware/auth.go
+5
-5
auth_test.go
gin/middleware/auth_test.go
+4
-4
breaker.go
gin/middleware/breaker.go
+3
-3
breaker_test.go
gin/middleware/breaker_test.go
+5
-5
logging.go
gin/middleware/logging.go
+2
-2
logging_test.go
gin/middleware/logging_test.go
+5
-5
metrics_test.go
gin/middleware/metrics/metrics_test.go
+2
-2
ratelimit.go
gin/middleware/ratelimit.go
+2
-2
ratelimit_test.go
gin/middleware/ratelimit_test.go
+3
-3
recovery.go
gin/middleware/recovery.go
+1
-1
requstid.go
gin/middleware/requstid.go
+1
-1
requstid_test.go
gin/middleware/requstid_test.go
+2
-2
tracing_test.go
gin/middleware/tracing_test.go
+3
-3
prof_test.go
gin/prof/prof_test.go
+1
-1
response.go
gin/response/response.go
+9
-10
response_test.go
gin/response/response_test.go
+4
-5
swagger.go
gin/swagger/swagger.go
+1
-1
swagger_test.go
gin/swagger/swagger_test.go
+1
-1
validator_test.go
gin/validator/validator_test.go
+1
-1
ctx.go
gin/xctx/ctx.go
+1
-1
aes.go
gocrypto/aes.go
+1
-1
des.go
gocrypto/des.go
+1
-1
logger.go
goredis/logger.go
+2
-2
cache.go
gotest/cache.go
+1
-1
dao_test.go
gotest/dao_test.go
+1
-1
handler.go
gotest/handler.go
+1
-1
service.go
gotest/service.go
+1
-1
client_conn.go
grpc/grpccli/client_conn.go
+4
-4
client_conn_test.go
grpc/grpccli/client_conn_test.go
+2
-2
option.go
grpc/grpccli/option.go
+1
-1
option_test.go
grpc/grpccli/option_test.go
+2
-2
client_test.go
grpc/gtls/client_test.go
+1
-1
server_test.go
grpc/gtls/server_test.go
+1
-1
breaker.go
grpc/interceptor/breaker.go
+3
-3
breaker_test.go
grpc/interceptor/breaker_test.go
+3
-3
jwtAuth.go
grpc/interceptor/jwtAuth.go
+1
-1
jwtAuth_test.go
grpc/interceptor/jwtAuth_test.go
+2
-2
logging.go
grpc/interceptor/logging.go
+1
-1
logging_test.go
grpc/interceptor/logging_test.go
+1
-1
metrics.go
grpc/interceptor/metrics.go
+1
-1
ratelimit.go
grpc/interceptor/ratelimit.go
+2
-2
requstid.go
grpc/interceptor/requstid.go
+1
-1
requstid_test.go
grpc/interceptor/requstid_test.go
+1
-1
clientMetrics_test.go
grpc/metrics/clientMetrics_test.go
+1
-1
serverMetrics_test.go
grpc/metrics/serverMetrics_test.go
+1
-1
server.go
grpc/server/server.go
+1
-1
server_test.go
grpc/server/server_test.go
+3
-3
httpcli.go
httpcli/httpcli.go
+4
-4
httpcli_test.go
httpcli/httpcli_test.go
+1
-1
consumer_test.go
kafka/consumer_test.go
+1
-1
producer_test.go
kafka/producer_test.go
+1
-1
nacos.go
nacoscli/nacos.go
+1
-1
nacos_test.go
nacoscli/nacos_test.go
+1
-1
http_test.go
prof/http_test.go
+1
-1
connection_test.go
rabbitmq/connection_test.go
+1
-1
consumer_test.go
rabbitmq/consumer_test.go
+1
-1
producer_test.go
rabbitmq/producer_test.go
+1
-1
publisher_test.go
rabbitmq/publisher_test.go
+1
-1
subscriber_test.go
rabbitmq/subscriber_test.go
+1
-1
replacer.go
replacer/replacer.go
+1
-1
builder.go
servicerd/discovery/builder.go
+1
-1
builder_test.go
servicerd/discovery/builder_test.go
+1
-1
resolver.go
servicerd/discovery/resolver.go
+1
-1
resolver_test.go
servicerd/discovery/resolver_test.go
+1
-1
client.go
servicerd/registry/consul/client.go
+1
-1
client_test.go
servicerd/registry/consul/client_test.go
+1
-1
registry.go
servicerd/registry/consul/registry.go
+2
-2
registry_test.go
servicerd/registry/consul/registry_test.go
+1
-1
service.go
servicerd/registry/consul/service.go
+1
-1
watcher.go
servicerd/registry/consul/watcher.go
+1
-1
watcher_test.go
servicerd/registry/consul/watcher_test.go
+1
-1
registry.go
servicerd/registry/etcd/registry.go
+2
-2
registry_test.go
servicerd/registry/etcd/registry_test.go
+2
-2
service.go
servicerd/registry/etcd/service.go
+1
-1
watcher.go
servicerd/registry/etcd/watcher.go
+1
-1
watcher_test.go
servicerd/registry/etcd/watcher_test.go
+1
-1
registry.go
servicerd/registry/nacos/registry.go
+2
-2
registry_test.go
servicerd/registry/nacos/registry_test.go
+2
-2
watcher.go
servicerd/registry/nacos/watcher.go
+1
-1
watcher_test.go
servicerd/registry/nacos/watcher_test.go
+1
-1
base_model.go
sgorm/base_model.go
+1
-1
mysql.go
sgorm/mysql/mysql.go
+3
-3
postgresql.go
sgorm/postgresql/postgresql.go
+2
-2
query_condition.go
sgorm/query/query_condition.go
+2
-2
sqlite.go
sgorm/sqlite/sqlite.go
+2
-2
README.md
shield/circuitbreaker/README.md
+2
-2
circuitbreaker_test.go
shield/circuitbreaker/circuitbreaker_test.go
+1
-1
sre.go
shield/circuitbreaker/sre.go
+1
-1
sre_test.go
shield/circuitbreaker/sre_test.go
+1
-1
bbr.go
shield/ratelimit/bbr.go
+2
-2
bbr_test.go
shield/ratelimit/bbr_test.go
+1
-1
mongodb.go
sql2code/parser/mongodb.go
+2
-2
parser.go
sql2code/parser/parser.go
+1
-1
sqlite.go
sql2code/parser/sqlite.go
+1
-1
sql2code.go
sql2code/sql2code.go
+3
-3
stat.go
stat/stat.go
+2
-2
oss.go
third/alioss/oss.go
+30
-62
wg.go
utils/wg/wg.go
+3
-3
xslice.go
utils/xslice/xslice.go
+2
-2
server_test.go
ws/server_test.go
+1
-1
ws.go
ws/ws.go
+4
-4
xerror_api.go
xerrors/xerror/xerror_api.go
+1
-1
xerror_api_code.go
xerrors/xerror/xerror_api_code.go
+1
-1
xerror_error_code.go
xerrors/xerror/xerror_error_code.go
+1
-1
xerror_z_bench_test.go
xerrors/xerror/xerror_z_bench_test.go
+1
-1
xerror_z_example_test.go
xerrors/xerror/xerror_z_example_test.go
+2
-2
xerror_z_unit_test.go
xerrors/xerror/xerror_z_unit_test.go
+2
-2
xset.go
xset/xset.go
+1
-1
没有找到文件。
app/app.go
浏览文件 @
48539002
...
...
@@ -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
...
...
cache/cache_test.go
浏览文件 @
48539002
...
...
@@ -6,9 +6,9 @@ import (
"github.com/stretchr/testify/assert"
"
xmall/
pkg/encoding"
"
xmall/
pkg/gotest"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/encoding"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gotest"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
type
cacheUser
struct
{
...
...
cache/memory.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/encoding"
ctxUtil
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/xctx"
"
gitlab.wanzhuangkj.com/tush/x
pkg/logger"
xslice
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils/xslice"
"
gitlab.wanzhuangkj.com/tush/x
pkg/xerrors/xerror"
)
type
memoryCache
struct
{
...
...
cache/memory_test.go
浏览文件 @
48539002
...
...
@@ -6,9 +6,9 @@ import (
"github.com/stretchr/testify/assert"
"
xmall/
pkg/encoding"
"
xmall/
pkg/gotest"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/encoding"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gotest"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
type
memoryUser
struct
{
...
...
cache/redis.go
浏览文件 @
48539002
...
...
@@ -10,8 +10,8 @@ import (
"github.com/redis/go-redis/v9"
"
xmall/
pkg/encoding"
"
xmall/
pkg/xerrors/xerror"
"
gitlab.wanzhuangkj.com/tush/x
pkg/encoding"
"
gitlab.wanzhuangkj.com/tush/x
pkg/xerrors/xerror"
)
// CacheNotFound no hit cache
...
...
cache/redis_test.go
浏览文件 @
48539002
...
...
@@ -6,9 +6,9 @@ import (
"github.com/stretchr/testify/assert"
"
xmall/
pkg/encoding"
"
xmall/
pkg/gotest"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/encoding"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gotest"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
type
redisUser
struct
{
...
...
conf/consul_parse.go
浏览文件 @
48539002
...
...
@@ -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"
...
...
conf/local_parse.go
浏览文件 @
48539002
...
...
@@ -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"
...
...
consulcli/consulcli.go
浏览文件 @
48539002
...
...
@@ -3,7 +3,7 @@ package consulcli
import
(
"fmt"
"
xmall/
pkg/xerrors/xerror"
"
gitlab.wanzhuangkj.com/tush/x
pkg/xerrors/xerror"
"github.com/hashicorp/consul/api"
)
...
...
dlock/etcd_test.go
浏览文件 @
48539002
...
...
@@ -5,7 +5,7 @@ import (
"testing"
"time"
"
xmall/
pkg/etcdcli"
"
gitlab.wanzhuangkj.com/tush/x
pkg/etcdcli"
"go.uber.org/zap"
)
...
...
dlock/redis_test.go
浏览文件 @
48539002
...
...
@@ -7,7 +7,7 @@ import (
"testing"
"time"
"
xmall/
pkg/goredis"
"
gitlab.wanzhuangkj.com/tush/x
pkg/goredis"
)
func
TestRedisLock_TryLock
(
t
*
testing
.
T
)
{
...
...
email/email.go
浏览文件 @
48539002
...
...
@@ -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"
)
...
...
encoding/json/json.go
浏览文件 @
48539002
...
...
@@ -8,7 +8,7 @@ import (
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
"
xmall/
pkg/encoding"
"
gitlab.wanzhuangkj.com/tush/x
pkg/encoding"
)
// Name is the name registered for the json codec.
...
...
encoding/proto/proto.go
浏览文件 @
48539002
...
...
@@ -6,7 +6,7 @@ import (
"google.golang.org/protobuf/proto"
"
xmall/
pkg/encoding"
"
gitlab.wanzhuangkj.com/tush/x
pkg/encoding"
)
// Name is the name registered for the proto compressor.
...
...
errcode/rpc_error_test.go
浏览文件 @
48539002
...
...
@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/status"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
var
rpcStatus
=
[]
*
RPCStatus
{
...
...
etcdcli/etcdcli.go
浏览文件 @
48539002
...
...
@@ -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"
...
...
gin/handlerfunc/common.go
浏览文件 @
48539002
...
...
@@ -9,8 +9,8 @@ import (
"github.com/gin-gonic/gin"
"
xmall/
pkg/errcode"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/errcode"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
// CheckHealthReply check health result
...
...
gin/middleware/auth.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/errcode"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/response"
ctxUtil
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/xctx"
"
gitlab.wanzhuangkj.com/tush/x
pkg/jwt"
"
gitlab.wanzhuangkj.com/tush/x
pkg/logger"
)
const
(
...
...
gin/middleware/auth_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/gin/response"
"
gitlab.wanzhuangkj.com/tush/x
pkg/httpcli"
"
gitlab.wanzhuangkj.com/tush/x
pkg/jwt"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
"github.com/stretchr/testify/assert"
)
...
...
gin/middleware/breaker.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/container/group"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/response"
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/circuitbreaker"
)
// ErrNotAllowed error not allowed.
...
...
gin/middleware/breaker_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/container/group"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/response"
"
gitlab.wanzhuangkj.com/tush/x
pkg/httpcli"
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/circuitbreaker"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
runCircuitBreakerHTTPServer
()
string
{
...
...
gin/middleware/logging.go
浏览文件 @
48539002
...
...
@@ -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"
...
...
gin/middleware/logging_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/gin/response"
ctxUtil
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/xctx"
"
gitlab.wanzhuangkj.com/tush/x
pkg/httpcli"
"
gitlab.wanzhuangkj.com/tush/x
pkg/logger"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
init
()
{
...
...
gin/middleware/metrics/metrics_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/gin/handlerfunc"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
TestMetrics
(
t
*
testing
.
T
)
{
...
...
gin/middleware/ratelimit.go
浏览文件 @
48539002
...
...
@@ -7,8 +7,8 @@ import (
"github.com/gin-gonic/gin"
"
xmall/
pkg/gin/response"
rl
"
xmall/
pkg/shield/ratelimit"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/response"
rl
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/ratelimit"
)
// ErrLimitExceed is returned when the rate limiter is
...
...
gin/middleware/ratelimit_test.go
浏览文件 @
48539002
...
...
@@ -11,9 +11,9 @@ import (
"github.com/gin-gonic/gin"
"
xmall/
pkg/gin/response"
"
xmall/
pkg/httpcli"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/response"
"
gitlab.wanzhuangkj.com/tush/x
pkg/httpcli"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
runRateLimiterHTTPServer
()
string
{
...
...
gin/middleware/recovery.go
浏览文件 @
48539002
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"
...
...
gin/middleware/requstid.go
浏览文件 @
48539002
...
...
@@ -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"
...
...
gin/middleware/requstid_test.go
浏览文件 @
48539002
...
...
@@ -6,8 +6,8 @@ import (
"testing"
"time"
ctxUtil
"
xmall/
pkg/gin/xctx"
"
xmall/
pkg/utils"
ctxUtil
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/xctx"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
...
...
gin/middleware/tracing_test.go
浏览文件 @
48539002
...
...
@@ -5,9 +5,9 @@ import (
"testing"
"time"
"
xmall/
pkg/gin/response"
"
xmall/
pkg/httpcli"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/response"
"
gitlab.wanzhuangkj.com/tush/x
pkg/httpcli"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
...
...
gin/prof/prof_test.go
浏览文件 @
48539002
...
...
@@ -8,7 +8,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
TestRegister
(
t
*
testing
.
T
)
{
...
...
gin/response/response.go
浏览文件 @
48539002
...
...
@@ -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
,
e
rr
code
.
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
,
e
rr
code
.
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
,
e
code
.
Success
.
Code
(),
e
code
.
Success
.
Msg
(),
data
...
)
respJSONWith200
(
c
,
e
rrcode
.
Success
.
Code
(),
err
code
.
Success
.
Msg
(),
data
...
)
}
// SuccessWithPage return success
func
SuccessWithPage
[
T
any
](
c
*
gin
.
Context
,
list
[]
*
T
,
total
int64
)
{
respJSONWith200
(
c
,
e
code
.
Success
.
Code
(),
e
code
.
Success
.
Msg
(),
gin
.
H
{
"list"
:
list
,
"total"
:
total
})
respJSONWith200
(
c
,
e
rrcode
.
Success
.
Code
(),
err
code
.
Success
.
Msg
(),
gin
.
H
{
"list"
:
list
,
"total"
:
total
})
}
// SuccessWithList return success
func
SuccessWithList
[
T
any
](
c
*
gin
.
Context
,
list
[]
*
T
)
{
respJSONWith200
(
c
,
e
code
.
Success
.
Code
(),
e
code
.
Success
.
Msg
(),
gin
.
H
{
"list"
:
list
})
respJSONWith200
(
c
,
e
rrcode
.
Success
.
Code
(),
err
code
.
Success
.
Msg
(),
gin
.
H
{
"list"
:
list
})
}
// ErrorE return error
...
...
gin/response/response_test.go
浏览文件 @
48539002
...
...
@@ -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
,
e
rr
code
.
Success
.
Code
(),
result
.
Code
)
for
_
,
code
:=
range
httpResponseCodes
{
result
:=
&
httpcli
.
StdResult
{}
...
...
gin/swagger/swagger.go
浏览文件 @
48539002
...
...
@@ -11,7 +11,7 @@ import (
ginSwagger
"github.com/swaggo/gin-swagger"
"github.com/swaggo/swag"
"
xmall/
pkg/gofile"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gofile"
)
// DefaultRouter default swagger router, request url is http://<ip:port>/swagger/index.html
...
...
gin/swagger/swagger_test.go
浏览文件 @
48539002
...
...
@@ -9,7 +9,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
runHTTPServer
(
registerSwaggerFn
func
(
r
*
gin
.
Engine
))
string
{
...
...
gin/validator/validator_test.go
浏览文件 @
48539002
...
...
@@ -17,7 +17,7 @@ import (
"github.com/gin-gonic/gin/binding"
"github.com/stretchr/testify/assert"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
runValidatorHTTPServer
()
string
{
...
...
gin/xctx/ctx.go
浏览文件 @
48539002
...
...
@@ -2,7 +2,7 @@ package xctx
import
(
"context"
xsf
"
xmall/
pkg/utils/xsnowflake"
xsf
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils/xsnowflake"
"github.com/gin-gonic/gin"
"github.com/spf13/cast"
...
...
gocrypto/aes.go
浏览文件 @
48539002
...
...
@@ -8,7 +8,7 @@ import (
"encoding/hex"
"errors"
"
xmall/
pkg/gocrypto/wcipher"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gocrypto/wcipher"
)
// AesEncrypt aes encryption, returns ciphertext is not transcoded
...
...
gocrypto/des.go
浏览文件 @
48539002
...
...
@@ -6,7 +6,7 @@ package gocrypto
import
(
"encoding/hex"
"
xmall/
pkg/gocrypto/wcipher"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gocrypto/wcipher"
)
// DesEncrypt des encryption, the returned ciphertext is not transcoded
...
...
goredis/logger.go
浏览文件 @
48539002
...
...
@@ -7,8 +7,8 @@ import (
"runtime"
"time"
ctxUtil
"
xmall/
pkg/gin/xctx"
"
xmall/
pkg/logger"
ctxUtil
"
gitlab.wanzhuangkj.com/tush/x
pkg/gin/xctx"
"
gitlab.wanzhuangkj.com/tush/x
pkg/logger"
"github.com/redis/go-redis/v9"
"go.uber.org/zap"
...
...
gotest/cache.go
浏览文件 @
48539002
...
...
@@ -6,7 +6,7 @@ import (
"github.com/alicebob/miniredis/v2"
"github.com/redis/go-redis/v9"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
// Cache redis cache
...
...
gotest/dao_test.go
浏览文件 @
48539002
...
...
@@ -9,7 +9,7 @@ import (
"github.com/DATA-DOG/go-sqlmock"
"gorm.io/gorm"
"
xmall/
pkg/sgorm/query"
"
gitlab.wanzhuangkj.com/tush/x
pkg/sgorm/query"
)
func
TestNewDao
(
t
*
testing
.
T
)
{
...
...
gotest/handler.go
浏览文件 @
48539002
...
...
@@ -9,7 +9,7 @@ import (
"github.com/gin-gonic/gin"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
// Handler info
...
...
gotest/service.go
浏览文件 @
48539002
...
...
@@ -9,7 +9,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
// Service info
...
...
grpc/grpccli/client_conn.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/grpc/gtls"
"
gitlab.wanzhuangkj.com/tush/x
pkg/grpc/interceptor"
"
gitlab.wanzhuangkj.com/tush/x
pkg/logger"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/discovery"
)
// NewClient creates a new grpc client
...
...
grpc/grpccli/client_conn_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/grpc/gtls/certfile"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry/etcd"
)
func
TestNewClient
(
t
*
testing
.
T
)
{
...
...
grpc/grpccli/option.go
浏览文件 @
48539002
...
...
@@ -6,7 +6,7 @@ import (
"go.uber.org/zap"
"google.golang.org/grpc"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
var
(
...
...
grpc/grpccli/option_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/grpc/interceptor"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
func
TestWithDialOptions
(
t
*
testing
.
T
)
{
...
...
grpc/gtls/client_test.go
浏览文件 @
48539002
...
...
@@ -3,7 +3,7 @@ package gtls
import
(
"testing"
"
xmall/
pkg/grpc/gtls/certfile"
"
gitlab.wanzhuangkj.com/tush/x
pkg/grpc/gtls/certfile"
"github.com/stretchr/testify/assert"
)
...
...
grpc/gtls/server_test.go
浏览文件 @
48539002
...
...
@@ -5,7 +5,7 @@ import (
"github.com/stretchr/testify/assert"
"
xmall/
pkg/grpc/gtls/certfile"
"
gitlab.wanzhuangkj.com/tush/x
pkg/grpc/gtls/certfile"
)
func
TestGetServerTLSCredentials
(
t
*
testing
.
T
)
{
...
...
grpc/interceptor/breaker.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/container/group"
"
gitlab.wanzhuangkj.com/tush/x
pkg/errcode"
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/circuitbreaker"
)
// ErrNotAllowed error not allowed.
...
...
grpc/interceptor/breaker_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/container/group"
"
gitlab.wanzhuangkj.com/tush/x
pkg/errcode"
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/circuitbreaker"
"google.golang.org/grpc/codes"
)
...
...
grpc/interceptor/jwtAuth.go
浏览文件 @
48539002
...
...
@@ -10,7 +10,7 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"
xmall/
pkg/jwt"
"
gitlab.wanzhuangkj.com/tush/x
pkg/jwt"
)
// ---------------------------------- client ----------------------------------
...
...
grpc/interceptor/jwtAuth_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/jwt"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
var
(
...
...
grpc/interceptor/logging.go
浏览文件 @
48539002
...
...
@@ -9,7 +9,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/status"
zapLog
"
xmall/
pkg/logger"
zapLog
"
gitlab.wanzhuangkj.com/tush/x
pkg/logger"
)
var
contentMark
=
[]
byte
(
" ...... "
)
...
...
grpc/interceptor/logging_test.go
浏览文件 @
48539002
...
...
@@ -5,7 +5,7 @@ import (
"testing"
"time"
"
xmall/
pkg/logger"
"
gitlab.wanzhuangkj.com/tush/x
pkg/logger"
)
func
TestUnaryClientLog
(
t
*
testing
.
T
)
{
...
...
grpc/interceptor/metrics.go
浏览文件 @
48539002
...
...
@@ -3,7 +3,7 @@ package interceptor
import
(
"google.golang.org/grpc"
"
xmall/
pkg/grpc/metrics"
"
gitlab.wanzhuangkj.com/tush/x
pkg/grpc/metrics"
)
// UnaryClientMetrics client-side metrics unary interceptor
...
...
grpc/interceptor/ratelimit.go
浏览文件 @
48539002
...
...
@@ -6,8 +6,8 @@ import (
"google.golang.org/grpc"
"
xmall/
pkg/errcode"
rl
"
xmall/
pkg/shield/ratelimit"
"
gitlab.wanzhuangkj.com/tush/x
pkg/errcode"
rl
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/ratelimit"
)
// ---------------------------------- server interceptor ----------------------------------
...
...
grpc/interceptor/requstid.go
浏览文件 @
48539002
...
...
@@ -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"
...
...
grpc/interceptor/requstid_test.go
浏览文件 @
48539002
...
...
@@ -18,7 +18,7 @@ import (
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/runtime/protoimpl"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
newUnaryRPCServer
(
unaryServerInterceptors
...
grpc
.
UnaryServerInterceptor
)
string
{
...
...
grpc/metrics/clientMetrics_test.go
浏览文件 @
48539002
...
...
@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
TestClientHTTPService
(
t
*
testing
.
T
)
{
...
...
grpc/metrics/serverMetrics_test.go
浏览文件 @
48539002
...
...
@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
Test_srvRegisterMetrics
(
t
*
testing
.
T
)
{
...
...
grpc/server/server.go
浏览文件 @
48539002
...
...
@@ -8,7 +8,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"
xmall/
pkg/grpc/metrics"
"
gitlab.wanzhuangkj.com/tush/x
pkg/grpc/metrics"
)
// RegisterFn register object
...
...
grpc/server/server_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/grpc/metrics"
"
gitlab.wanzhuangkj.com/tush/x
pkg/logger"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
var
fn
=
func
(
s
*
grpc
.
Server
)
{
...
...
httpcli/httpcli.go
浏览文件 @
48539002
...
...
@@ -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"
)
...
...
httpcli/httpcli_test.go
浏览文件 @
48539002
...
...
@@ -12,7 +12,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
type
myBody
struct
{
...
...
kafka/consumer_test.go
浏览文件 @
48539002
...
...
@@ -9,7 +9,7 @@ import (
"github.com/IBM/sarama"
"go.uber.org/zap"
"
xmall/
pkg/grpc/gtls/certfile"
"
gitlab.wanzhuangkj.com/tush/x
pkg/grpc/gtls/certfile"
)
var
(
...
...
kafka/producer_test.go
浏览文件 @
48539002
...
...
@@ -8,7 +8,7 @@ import (
"github.com/IBM/sarama/mocks"
"go.uber.org/zap"
"
xmall/
pkg/grpc/gtls/certfile"
"
gitlab.wanzhuangkj.com/tush/x
pkg/grpc/gtls/certfile"
)
var
(
...
...
nacoscli/nacos.go
浏览文件 @
48539002
...
...
@@ -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"
...
...
nacoscli/nacos_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/utils"
)
var
(
...
...
prof/http_test.go
浏览文件 @
48539002
...
...
@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
TestRegister
(
t
*
testing
.
T
)
{
...
...
rabbitmq/connection_test.go
浏览文件 @
48539002
...
...
@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
var
(
...
...
rabbitmq/consumer_test.go
浏览文件 @
48539002
...
...
@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
TestConsumerOptions
(
t
*
testing
.
T
)
{
...
...
rabbitmq/producer_test.go
浏览文件 @
48539002
...
...
@@ -9,7 +9,7 @@ import (
amqp
"github.com/rabbitmq/amqp091-go"
"github.com/stretchr/testify/assert"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
TestProducerOptions
(
t
*
testing
.
T
)
{
...
...
rabbitmq/publisher_test.go
浏览文件 @
48539002
...
...
@@ -8,7 +8,7 @@ import (
amqp
"github.com/rabbitmq/amqp091-go"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
var
testChannelName
=
"pub-sub"
...
...
rabbitmq/subscriber_test.go
浏览文件 @
48539002
...
...
@@ -7,7 +7,7 @@ import (
amqp
"github.com/rabbitmq/amqp091-go"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
TestSubscriber
(
t
*
testing
.
T
)
{
...
...
replacer/replacer.go
浏览文件 @
48539002
...
...
@@ -12,7 +12,7 @@ import (
"text/template"
"time"
"
xmall/
pkg/gofile"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gofile"
)
var
_
Replacer
=
(
*
replacerInfo
)(
nil
)
...
...
servicerd/discovery/builder.go
浏览文件 @
48539002
...
...
@@ -8,7 +8,7 @@ import (
"google.golang.org/grpc/resolver"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
const
name
=
"discovery"
...
...
servicerd/discovery/builder_test.go
浏览文件 @
48539002
...
...
@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"google.golang.org/grpc/resolver"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
type
discovery
struct
{}
...
...
servicerd/discovery/resolver.go
浏览文件 @
48539002
...
...
@@ -13,7 +13,7 @@ import (
"google.golang.org/grpc/attributes"
"google.golang.org/grpc/resolver"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
type
discoveryResolver
struct
{
...
...
servicerd/discovery/resolver_test.go
浏览文件 @
48539002
...
...
@@ -10,7 +10,7 @@ import (
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/serviceconfig"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
type
cliConn
struct
{
...
...
servicerd/registry/consul/client.go
浏览文件 @
48539002
...
...
@@ -10,7 +10,7 @@ import (
"github.com/hashicorp/consul/api"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
// Client is consul client config
...
...
servicerd/registry/consul/client_test.go
浏览文件 @
48539002
...
...
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/consul/api"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
func
getConsulClient
()
*
Client
{
...
...
servicerd/registry/consul/registry.go
浏览文件 @
48539002
...
...
@@ -10,8 +10,8 @@ import (
"github.com/hashicorp/consul/api"
"
xmall/
pkg/consulcli"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/consulcli"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
var
(
...
...
servicerd/registry/consul/registry_test.go
浏览文件 @
48539002
...
...
@@ -7,7 +7,7 @@ import (
"github.com/hashicorp/consul/api"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
func
TestNewRegistry
(
t
*
testing
.
T
)
{
...
...
servicerd/registry/consul/service.go
浏览文件 @
48539002
...
...
@@ -4,7 +4,7 @@ import (
"sync"
"sync/atomic"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
type
serviceSet
struct
{
...
...
servicerd/registry/consul/watcher.go
浏览文件 @
48539002
...
...
@@ -3,7 +3,7 @@ package consul
import
(
"context"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
type
watcher
struct
{
...
...
servicerd/registry/consul/watcher_test.go
浏览文件 @
48539002
...
...
@@ -7,7 +7,7 @@ import (
"testing"
"time"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
func
newServiceSet
()
*
serviceSet
{
...
...
servicerd/registry/etcd/registry.go
浏览文件 @
48539002
...
...
@@ -8,8 +8,8 @@ import (
clientv3
"go.etcd.io/etcd/client/v3"
"
xmall/
pkg/etcdcli"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/etcdcli"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
var
(
...
...
servicerd/registry/etcd/registry_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
TestNewRegistry
(
t
*
testing
.
T
)
{
...
...
servicerd/registry/etcd/service.go
浏览文件 @
48539002
...
...
@@ -4,7 +4,7 @@ package etcd
import
(
"encoding/json"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
func
marshal
(
si
*
registry
.
ServiceInstance
)
(
string
,
error
)
{
...
...
servicerd/registry/etcd/watcher.go
浏览文件 @
48539002
...
...
@@ -5,7 +5,7 @@ import (
clientv3
"go.etcd.io/etcd/client/v3"
"
xmall/
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
var
_
registry
.
Watcher
=
&
watcher
{}
...
...
servicerd/registry/etcd/watcher_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/servicerd/registry"
)
type
wt
struct
{}
...
...
servicerd/registry/nacos/registry.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/nacoscli"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
)
var
(
...
...
servicerd/registry/nacos/registry_test.go
浏览文件 @
48539002
...
...
@@ -7,8 +7,8 @@ import (
"github.com/stretchr/testify/assert"
"
xmall/
pkg/servicerd/registry"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/servicerd/registry"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
TestNewRegistry
(
t
*
testing
.
T
)
{
...
...
servicerd/registry/nacos/watcher.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/servicerd/registry"
)
var
_
registry
.
Watcher
=
(
*
watcher
)(
nil
)
...
...
servicerd/registry/nacos/watcher_test.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/nacoscli"
)
func
getCli
()
naming_client
.
INamingClient
{
...
...
sgorm/base_model.go
浏览文件 @
48539002
...
...
@@ -8,7 +8,7 @@ import (
"github.com/huandu/xstrings"
"gorm.io/gorm"
"
xmall/
pkg/sgorm/dbclose"
"
gitlab.wanzhuangkj.com/tush/x
pkg/sgorm/dbclose"
)
type
DB
=
gorm
.
DB
...
...
sgorm/mysql/mysql.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/sgorm/dbclose"
"
gitlab.wanzhuangkj.com/tush/x
pkg/sgorm/glog"
"
gitlab.wanzhuangkj.com/tush/x
pkg/xerrors/xerror"
)
// Init mysql
...
...
sgorm/postgresql/postgresql.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/sgorm/dbclose"
"
gitlab.wanzhuangkj.com/tush/x
pkg/sgorm/glog"
)
// Init postgresql
...
...
sgorm/query/query_condition.go
浏览文件 @
48539002
...
...
@@ -3,9 +3,9 @@ package query
import
(
"fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/utils/xtime"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"strings"
"xmall/pkg/utils/xtime"
"xmall/pkg/xerrors/xerror"
)
const
(
...
...
sgorm/sqlite/sqlite.go
浏览文件 @
48539002
...
...
@@ -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/x
pkg/sgorm/dbclose"
"
gitlab.wanzhuangkj.com/tush/x
pkg/sgorm/glog"
)
// Init sqlite
...
...
shield/circuitbreaker/README.md
浏览文件 @
48539002
...
...
@@ -9,7 +9,7 @@ Circuit Breaker for web middleware and rpc interceptor.
**gin circuit breaker middleware**
```
go
import
"
xmall/
pkg/shield/circuitbreaker"
import
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/circuitbreaker"
// CircuitBreaker a circuit breaker middleware
func
CircuitBreaker
(
opts
...
CircuitBreakerOption
)
gin
.
HandlerFunc
{
...
...
@@ -45,7 +45,7 @@ func CircuitBreaker(opts ...CircuitBreakerOption) gin.HandlerFunc {
**rpc server circuit breaker interceptor**
```
go
import
"
xmall/
pkg/shield/circuitbreaker"
import
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/circuitbreaker"
// UnaryServerCircuitBreaker server-side unary circuit breaker interceptor
func
UnaryServerCircuitBreaker
(
opts
...
CircuitBreakerOption
)
grpc
.
UnaryServerInterceptor
{
...
...
shield/circuitbreaker/circuitbreaker_test.go
浏览文件 @
48539002
...
...
@@ -3,7 +3,7 @@ package circuitbreaker_test
import
(
"testing"
"
xmall/
pkg/shield/circuitbreaker"
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/circuitbreaker"
)
// This is an example of using a circuit breaker Do() when return nil.
...
...
shield/circuitbreaker/sre.go
浏览文件 @
48539002
...
...
@@ -7,7 +7,7 @@ import (
"sync/atomic"
"time"
"
xmall/
pkg/shield/window"
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/window"
)
// Option is sre breaker option function.
...
...
shield/circuitbreaker/sre_test.go
浏览文件 @
48539002
...
...
@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"
xmall/
pkg/shield/window"
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/window"
)
func
getSREBreaker
()
*
Breaker
{
...
...
shield/ratelimit/bbr.go
浏览文件 @
48539002
...
...
@@ -7,8 +7,8 @@ import (
"sync/atomic"
"time"
"
xmall/
pkg/shield/cpu"
"
xmall/
pkg/shield/window"
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/cpu"
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/window"
)
var
(
...
...
shield/ratelimit/bbr_test.go
浏览文件 @
48539002
...
...
@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"
xmall/
pkg/shield/window"
"
gitlab.wanzhuangkj.com/tush/x
pkg/shield/window"
)
var
(
...
...
sql2code/parser/mongodb.go
浏览文件 @
48539002
...
...
@@ -13,8 +13,8 @@ import (
"go.mongodb.org/mongo-driver/mongo"
mgoOptions
"go.mongodb.org/mongo-driver/mongo/options"
"
xmall/
pkg/mgo"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/mgo"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
const
(
...
...
sql2code/parser/parser.go
浏览文件 @
48539002
...
...
@@ -651,7 +651,7 @@ func getModelStructCode(data tmplData, importPaths []string, isEmbed bool, jsonN
newImportPaths
=
append
(
newImportPaths
,
path
)
}
}
newImportPaths
=
append
(
newImportPaths
,
"
xmall/
pkg/sgorm"
)
newImportPaths
=
append
(
newImportPaths
,
"
gitlab.wanzhuangkj.com/tush/x
pkg/sgorm"
)
}
else
{
for
i
,
field
:=
range
data
.
Fields
{
switch
field
.
DBDriver
{
...
...
sql2code/parser/sqlite.go
浏览文件 @
48539002
...
...
@@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"
xmall/
pkg/sgorm/sqlite"
"
gitlab.wanzhuangkj.com/tush/x
pkg/sgorm/sqlite"
)
// GetSqliteTableInfo get table info from sqlite
...
...
sql2code/sql2code.go
浏览文件 @
48539002
...
...
@@ -9,9 +9,9 @@ import (
"os"
"strings"
"
xmall/
pkg/gofile"
"
xmall/
pkg/sql2code/parser"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/gofile"
"
gitlab.wanzhuangkj.com/tush/x
pkg/sql2code/parser"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
// Args generate code arguments
...
...
stat/stat.go
浏览文件 @
48539002
...
...
@@ -8,8 +8,8 @@ import (
"go.uber.org/zap"
"
xmall/
pkg/stat/cpu"
"
xmall/
pkg/stat/mem"
"
gitlab.wanzhuangkj.com/tush/x
pkg/stat/cpu"
"
gitlab.wanzhuangkj.com/tush/x
pkg/stat/mem"
)
var
(
...
...
third/alioss/oss.go
浏览文件 @
48539002
...
...
@@ -3,8 +3,8 @@ package aliyun
import
(
"io"
"mime/multipart"
"xmall/internal/config"
"
xmall/
pkg/xerrors/xerror"
"
gitlab.wanzhuangkj.com/tush/x
pkg/xerrors/xerror"
"github.com/aliyun/aliyun-oss-go-sdk/oss"
)
...
...
@@ -13,71 +13,49 @@ type AliyunOSS struct{}
var
OSS
=
&
AliyunOSS
{}
func
NewClient
()
(
bucket
*
oss
.
Bucket
,
err
error
)
{
endpoint
:=
""
accessKeyId
:=
""
accessKeySecret
:=
""
region
:=
""
bucketName
:=
""
type
AliOssConfig
struct
{
Endpoint
string
`mapstructure:"endpoint" json:"endpoint" yaml:"endpoint"`
AccessKeyId
string
`mapstructure:"access-key-id" json:"access-key-id" yaml:"access-key-id"`
AccessKeySecret
string
`mapstructure:"access-key-secret" json:"access-key-secret" yaml:"access-key-secret"`
BucketName
string
`mapstructure:"bucket-name" json:"bucket-name" yaml:"bucket-name"`
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
)
{
endpoint
=
c
.
Extend
.
AliOss
.
Endpoint
accessKeyId
=
c
.
Extend
.
AliOss
.
AccessKeyId
accessKeySecret
=
c
.
Extend
.
AliOss
.
AccessKeySecret
region
=
c
.
Extend
.
AliOss
.
Region
bucketName
=
c
.
Extend
.
AliOss
.
BucketName
})
client
,
err
:=
oss
.
New
(
endpoint
,
accessKeyId
,
accessKeySecret
,
func
NewClient
(
cfg
*
AliOssConfig
)
(
bucket
*
oss
.
Bucket
,
err
error
)
{
client
,
err
:=
oss
.
New
(
cfg
.
Endpoint
,
cfg
.
AccessKeyId
,
cfg
.
AccessKeySecret
,
oss
.
AuthVersion
(
oss
.
AuthV4
),
oss
.
Region
(
r
egion
))
oss
.
Region
(
cfg
.
R
egion
))
if
err
!=
nil
{
return
nil
,
xerror
.
New
(
err
.
Error
())
}
bucket
,
err
=
client
.
Bucket
(
b
ucketName
)
bucket
,
err
=
client
.
Bucket
(
cfg
.
B
ucketName
)
return
}
func
NewBucket
()
(
bucket
*
oss
.
Bucket
,
err
error
)
{
endpoint
:=
""
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
)
func
NewBucket
(
cfg
*
AliOssConfig
)
(
bucket
*
oss
.
Bucket
,
err
error
)
{
client
,
err
:=
oss
.
New
(
cfg
.
Endpoint
,
cfg
.
AccessKeyId
,
cfg
.
AccessKeySecret
)
if
err
!=
nil
{
return
}
bucket
,
err
=
client
.
Bucket
(
b
ucketName
)
bucket
,
err
=
client
.
Bucket
(
cfg
.
B
ucketName
)
return
}
func
(
*
AliyunOSS
)
UploadFile
(
reader
io
.
Reader
,
name
string
)
(
string
,
string
,
error
)
{
basePath
:=
""
bucketUrl
:=
""
config
.
Read
(
func
(
c
*
config
.
Config
)
{
basePath
=
c
.
Extend
.
AliOss
.
BasePath
bucketUrl
=
c
.
Extend
.
AliOss
.
BucketUrl
})
bucket
,
err
:=
NewClient
()
func
(
*
AliyunOSS
)
UploadFile
(
reader
io
.
Reader
,
name
string
,
cfg
*
AliOssConfig
)
(
string
,
string
,
error
)
{
bucket
,
err
:=
NewClient
(
cfg
)
if
err
!=
nil
{
return
""
,
""
,
err
}
fileTmpPath
:=
b
asePath
+
"/"
+
name
fileTmpPath
:=
cfg
.
B
asePath
+
"/"
+
name
err
=
bucket
.
PutObject
(
fileTmpPath
,
reader
)
if
err
!=
nil
{
return
""
,
""
,
xerror
.
New
(
err
.
Error
())
}
return
b
ucketUrl
+
"/"
+
fileTmpPath
,
fileTmpPath
,
nil
return
cfg
.
B
ucketUrl
+
"/"
+
fileTmpPath
,
fileTmpPath
,
nil
}
type
Attachment
struct
{
...
...
@@ -106,17 +84,15 @@ func (x Attachment) NewFromMultipartFileHeaders(files []*multipart.FileHeader) (
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
{
return
nil
,
nil
}
attachments
,
err
:=
Attachment
{}
.
NewFromMultipartFileHeaders
(
files
)
if
err
!=
nil
{
return
nil
,
err
}
err
=
x
.
UploadFiles
(
&
attachments
)
err
=
x
.
UploadFiles
(
&
attachments
,
cfg
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -124,29 +100,21 @@ func (x *AliyunOSS) UploadMultipartFileHeaders(files []*multipart.FileHeader) ([
return
attachments
,
nil
}
func
(
*
AliyunOSS
)
UploadFiles
(
files
*
[]
*
Attachment
)
error
{
func
(
*
AliyunOSS
)
UploadFiles
(
files
*
[]
*
Attachment
,
cfg
*
AliOssConfig
)
error
{
if
len
(
*
files
)
==
0
{
return
nil
}
basePath
:=
""
bucketUrl
:=
""
config
.
Read
(
func
(
c
*
config
.
Config
)
{
basePath
=
c
.
Extend
.
AliOss
.
BasePath
bucketUrl
=
c
.
Extend
.
AliOss
.
BucketUrl
})
bucket
,
err
:=
NewClient
()
bucket
,
err
:=
NewClient
(
cfg
)
if
err
!=
nil
{
return
xerror
.
New
(
err
.
Error
())
}
for
i
,
file
:=
range
*
files
{
relativeUri
:=
b
asePath
+
"/"
+
file
.
Name
relativeUri
:=
cfg
.
B
asePath
+
"/"
+
file
.
Name
err
=
bucket
.
PutObject
(
relativeUri
,
file
.
File
)
if
err
!=
nil
{
return
xerror
.
New
(
err
.
Error
())
}
(
*
files
)[
i
]
.
AbsUrl
=
b
ucketUrl
+
"/"
+
relativeUri
(
*
files
)[
i
]
.
AbsUrl
=
cfg
.
B
ucketUrl
+
"/"
+
relativeUri
(
*
files
)[
i
]
.
RelativeUrl
=
relativeUri
}
return
nil
...
...
utils/wg/wg.go
浏览文件 @
48539002
...
...
@@ -2,10 +2,10 @@ package wg
import
(
"context"
ctxUtil
"gitlab.wanzhuangkj.com/tush/xpkg/gin/xctx"
"gitlab.wanzhuangkj.com/tush/xpkg/logger"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"sync"
ctxUtil
"xmall/pkg/gin/xctx"
"xmall/pkg/logger"
"xmall/pkg/xerrors/xerror"
)
func
Go
(
ctx
context
.
Context
,
n
int
,
fn
func
()
error
)
error
{
...
...
utils/xslice/xslice.go
浏览文件 @
48539002
...
...
@@ -2,9 +2,9 @@ package xslice
import
(
"fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"gitlab.wanzhuangkj.com/tush/xpkg/xset"
"strings"
"xmall/pkg/xerrors/xerror"
"xmall/pkg/xset"
"github.com/jinzhu/copier"
"github.com/spf13/cast"
...
...
ws/server_test.go
浏览文件 @
48539002
...
...
@@ -13,7 +13,7 @@ import (
"github.com/gorilla/websocket"
"go.uber.org/zap"
"
xmall/
pkg/utils"
"
gitlab.wanzhuangkj.com/tush/x
pkg/utils"
)
func
TestWebSocketServerDefault
(
t
*
testing
.
T
)
{
...
...
ws/ws.go
浏览文件 @
48539002
...
...
@@ -3,13 +3,13 @@ package ws
import
(
"context"
"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"
"sync"
"time"
ctxUtil
"xmall/pkg/gin/xctx"
"xmall/pkg/jwt"
"xmall/pkg/logger"
"xmall/pkg/xerrors/xerror"
"github.com/gin-gonic/gin"
"github.com/gorilla/websocket"
...
...
xerrors/xerror/xerror_api.go
浏览文件 @
48539002
...
...
@@ -3,7 +3,7 @@ package xerror
import
(
"fmt"
"
xmall/
pkg/xerrors/xcode"
"
gitlab.wanzhuangkj.com/tush/x
pkg/xerrors/xcode"
)
// New 用于创建一个自定义文本错误信息的 error 对象,并包含堆栈信息。
...
...
xerrors/xerror/xerror_api_code.go
浏览文件 @
48539002
...
...
@@ -2,8 +2,8 @@ package xerror
import
(
"fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xcode"
"strings"
"xmall/pkg/xerrors/xcode"
)
// NewCode 用于创建一个自定义错误信息的 error 对象,并包含堆栈信息,并增加错误码对象的输入。
...
...
xerrors/xerror/xerror_error_code.go
浏览文件 @
48539002
package
xerror
import
"
xmall/
pkg/xerrors/xcode"
import
"
gitlab.wanzhuangkj.com/tush/x
pkg/xerrors/xcode"
// Code 获取错误码。
// 如果没有错误代码,则返回 `xcode.CodeDefault`。
...
...
xerrors/xerror/xerror_z_bench_test.go
浏览文件 @
48539002
package
xerror_test
import
(
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xerror"
"testing"
"xmall/pkg/xerrors/xerror"
"github.com/pkg/errors"
)
...
...
xerrors/xerror/xerror_z_example_test.go
浏览文件 @
48539002
...
...
@@ -2,8 +2,8 @@ package xerror_test
import
(
"fmt"
"
xmall/
pkg/xerrors/xcode"
"
xmall/
pkg/xerrors/xerror"
"
gitlab.wanzhuangkj.com/tush/x
pkg/xerrors/xcode"
"
gitlab.wanzhuangkj.com/tush/x
pkg/xerrors/xerror"
"github.com/pkg/errors"
)
...
...
xerrors/xerror/xerror_z_unit_test.go
浏览文件 @
48539002
...
...
@@ -3,12 +3,12 @@ package xerror_test
import
(
"encoding/json"
"fmt"
"gitlab.wanzhuangkj.com/tush/xpkg/xerrors/xcode"
"testing"
"xmall/pkg/xerrors/xcode"
"github.com/pkg/errors"
"
xmall/
pkg/xerrors/xerror"
"
gitlab.wanzhuangkj.com/tush/x
pkg/xerrors/xerror"
"gorm.io/gorm"
...
...
xset/xset.go
浏览文件 @
48539002
package
xset
import
(
"
xmall/
pkg/xtype"
"
gitlab.wanzhuangkj.com/tush/x
pkg/xtype"
)
type
Set
[
T
xtype
.
Key
]
struct
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论