各服务数据库逻辑拆分
All checks were successful
Auth & User Management Service CI / build-services (app/douyin_ecpm_calculation_service/Dockerfile, douyin_ecpm_calculation_service, douyin_ecpm_calculation_service) (push) Successful in 36s
Auth & User Management Service CI / build-services (app/ranking_management/Dockerfile, ranking_management, ranking_management) (push) Successful in 41s
Auth & User Management Service CI / build-services (app/auth_service/Dockerfile, auth_service, auth_service) (push) Successful in 41s
Auth & User Management Service CI / build-services (app/user_management/Dockerfile, user_manager, user_management) (push) Successful in 38s
Auth & User Management Service CI / start-services (push) Successful in 5s
All checks were successful
Auth & User Management Service CI / build-services (app/douyin_ecpm_calculation_service/Dockerfile, douyin_ecpm_calculation_service, douyin_ecpm_calculation_service) (push) Successful in 36s
Auth & User Management Service CI / build-services (app/ranking_management/Dockerfile, ranking_management, ranking_management) (push) Successful in 41s
Auth & User Management Service CI / build-services (app/auth_service/Dockerfile, auth_service, auth_service) (push) Successful in 41s
Auth & User Management Service CI / build-services (app/user_management/Dockerfile, user_manager, user_management) (push) Successful in 38s
Auth & User Management Service CI / start-services (push) Successful in 5s
更新用户id为Sonyflake 添加gitea actions(ci/cd) 配置文件读取方式改为从ETCD读取 修改go module名称与gitea一致
This commit is contained in:
parent
b0f83e5356
commit
90f1d6eecf
5
.env
Normal file
5
.env
Normal file
@ -0,0 +1,5 @@
|
||||
CONFIG_TYPE=env
|
||||
LISTEN_ON=0.0.0.0:8080
|
||||
MODE=dev
|
||||
MYSQL=user:password@tcp(127.0.0.1:3306)/database
|
||||
REDIS_HOST=127.0.0.2
|
47
.gitea/workflows/demo.yaml
Normal file
47
.gitea/workflows/demo.yaml
Normal file
@ -0,0 +1,47 @@
|
||||
name: Auth & User Management Service CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build-services:
|
||||
runs-on: runner
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- service: user_management
|
||||
dockerfile: app/user_management/Dockerfile
|
||||
image: user_manager
|
||||
- service: ranking_management
|
||||
dockerfile: app/ranking_management/Dockerfile
|
||||
image: ranking_management
|
||||
- service: douyin_ecpm_calculation_service
|
||||
dockerfile: app/douyin_ecpm_calculation_service/Dockerfile
|
||||
image: douyin_ecpm_calculation_service
|
||||
- service: auth_service
|
||||
dockerfile: app/auth_service/Dockerfile
|
||||
image: auth_service
|
||||
steps:
|
||||
- uses: https://gitea.youtukeji.com.cn/actions/checkout@v4
|
||||
|
||||
- uses: https://gitea.youtukeji.com.cn/actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23.6'
|
||||
|
||||
- name: Verify Go version
|
||||
run: go version
|
||||
|
||||
- name: Build Docker Image
|
||||
run: docker build -t ${{ matrix.image }} -f ${{ matrix.dockerfile }} .
|
||||
|
||||
start-services:
|
||||
runs-on: runner
|
||||
needs: build-services # 依赖构建阶段
|
||||
steps:
|
||||
- uses: https://gitea.youtukeji.com.cn/actions/checkout@v4
|
||||
|
||||
- name: Start Docker Compose
|
||||
run: |
|
||||
docker-compose down --remove-orphans
|
||||
docker-compose up -d --build
|
||||
env:
|
||||
COMPOSE_PROJECT_NAME: youtu_grpc
|
32
app/auth_service/Dockerfile
Normal file
32
app/auth_service/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
||||
FROM golang:alpine AS builder
|
||||
|
||||
LABEL stage=gobuilder
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk update --no-cache && apk add --no-cache tzdata
|
||||
RUN apk add --no-cache git
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
ADD go.mod .
|
||||
ADD go.sum .
|
||||
RUN go env -w GOPRIVATE=gitea.youtukeji.com.cn
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
|
||||
RUN go build -ldflags="-s -w" -o /app/auth_service ./app/auth_service/auth_service.go
|
||||
|
||||
FROM alpine
|
||||
|
||||
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/auth_service /app/server
|
||||
|
||||
EXPOSE 8888
|
||||
|
||||
CMD ["/app/server"]
|
@ -1,27 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/internal/config"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/internal/server"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/server"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/auth_service.yaml", "the config file")
|
||||
const ServiceName = "auth_service"
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
err := config.GetConfig(&c, ServiceName)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
@ -33,6 +33,6 @@ func main() {
|
||||
})
|
||||
defer s.Stop()
|
||||
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.RpcServerConf.ListenOn)
|
||||
s.Start()
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ message Code2SessionRequest{
|
||||
message Code2SessionResponse{
|
||||
string OpenId = 1;
|
||||
string UnionId = 2;
|
||||
uint64 UserId = 3;
|
||||
}
|
||||
|
||||
message GetAccessTokenRequest{
|
||||
|
@ -173,6 +173,7 @@ type Code2SessionResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
OpenId string `protobuf:"bytes,1,opt,name=OpenId,proto3" json:"OpenId,omitempty"`
|
||||
UnionId string `protobuf:"bytes,2,opt,name=UnionId,proto3" json:"UnionId,omitempty"`
|
||||
UserId uint64 `protobuf:"varint,3,opt,name=UserId,proto3" json:"UserId,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -221,6 +222,13 @@ func (x *Code2SessionResponse) GetUnionId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Code2SessionResponse) GetUserId() uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetAccessTokenRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
AppId string `protobuf:"bytes,1,opt,name=AppId,proto3" json:"AppId,omitempty"`
|
||||
@ -324,36 +332,37 @@ var file_auth_service_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x43, 0x6f,
|
||||
0x64, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x41, 0x6e, 0x6f, 0x6e, 0x79, 0x6d, 0x6f, 0x75, 0x73, 0x43,
|
||||
0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x41, 0x6e, 0x6f, 0x6e, 0x79,
|
||||
0x6d, 0x6f, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x48, 0x0a, 0x14, 0x43, 0x6f, 0x64, 0x65,
|
||||
0x6d, 0x6f, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x60, 0x0a, 0x14, 0x43, 0x6f, 0x64, 0x65,
|
||||
0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x4f, 0x70, 0x65, 0x6e, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x55, 0x6e, 0x69, 0x6f,
|
||||
0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x55, 0x6e, 0x69, 0x6f, 0x6e,
|
||||
0x49, 0x64, 0x22, 0x2d, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54,
|
||||
0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41,
|
||||
0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49,
|
||||
0x64, 0x22, 0x3a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f,
|
||||
0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x41,
|
||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xf9, 0x01,
|
||||
0x0a, 0x0c, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x35,
|
||||
0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x15, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,
|
||||
0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x0c, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65,
|
||||
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0e,
|
||||
0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23,
|
||||
0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65,
|
||||
0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x04, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x15, 0x47, 0x65,
|
||||
0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65,
|
||||
0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x2f, 0x61,
|
||||
0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x05, 0x41, 0x70, 0x70, 0x49, 0x64, 0x22, 0x3a, 0x0a, 0x16, 0x47, 0x65, 0x74,
|
||||
0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b,
|
||||
0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73,
|
||||
0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xf9, 0x01, 0x0a, 0x0c, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x15,
|
||||
0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a,
|
||||
0x0c, 0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e,
|
||||
0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x43, 0x6f, 0x64,
|
||||
0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x22, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
|
||||
0x43, 0x6f, 0x64, 0x65, 0x32, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73,
|
||||
0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54,
|
||||
0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x75,
|
||||
0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63,
|
||||
0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
|
||||
var (
|
||||
|
@ -6,19 +6,20 @@ package auth_service_client
|
||||
|
||||
import (
|
||||
"context"
|
||||
auth_service2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/auth_service"
|
||||
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/auth_service"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
Code2SessionRequest = auth_service2.Code2SessionRequest
|
||||
Code2SessionResponse = auth_service2.Code2SessionResponse
|
||||
GetAccessTokenRequest = auth_service2.GetAccessTokenRequest
|
||||
GetAccessTokenResponse = auth_service2.GetAccessTokenResponse
|
||||
Request = auth_service2.Request
|
||||
Response = auth_service2.Response
|
||||
Code2SessionRequest = auth_service.Code2SessionRequest
|
||||
Code2SessionResponse = auth_service.Code2SessionResponse
|
||||
GetAccessTokenRequest = auth_service.GetAccessTokenRequest
|
||||
GetAccessTokenResponse = auth_service.GetAccessTokenResponse
|
||||
Request = auth_service.Request
|
||||
Response = auth_service.Response
|
||||
|
||||
AuthService interface {
|
||||
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
|
||||
@ -38,16 +39,16 @@ func NewAuthService(cli zrpc.Client) AuthService {
|
||||
}
|
||||
|
||||
func (m *defaultAuthService) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
|
||||
client := auth_service2.NewAuthServiceClient(m.cli.Conn())
|
||||
client := auth_service.NewAuthServiceClient(m.cli.Conn())
|
||||
return client.Ping(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultAuthService) Code2Session(ctx context.Context, in *Code2SessionRequest, opts ...grpc.CallOption) (*Code2SessionResponse, error) {
|
||||
client := auth_service2.NewAuthServiceClient(m.cli.Conn())
|
||||
client := auth_service.NewAuthServiceClient(m.cli.Conn())
|
||||
return client.Code2Session(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultAuthService) GetAccessToken(ctx context.Context, in *GetAccessTokenRequest, opts ...grpc.CallOption) (*GetAccessTokenResponse, error) {
|
||||
client := auth_service2.NewAuthServiceClient(m.cli.Conn())
|
||||
client := auth_service.NewAuthServiceClient(m.cli.Conn())
|
||||
return client.GetAccessToken(ctx, in, opts...)
|
||||
}
|
||||
|
27
app/auth_service/internal/gen/dao/model/app_user.gen.go
Normal file
27
app/auth_service/internal/gen/dao/model/app_user.gen.go
Normal file
@ -0,0 +1,27 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const TableNameAppUser = "app_user"
|
||||
|
||||
// AppUser mapped from table <app_user>
|
||||
type AppUser struct {
|
||||
ID uint64 `gorm:"column:id;type:bigint unsigned;primaryKey;autoIncrement:true;index:idx_app_user_id,priority:1" json:"id"`
|
||||
AppAccountID uint32 `gorm:"column:app_account_id;type:int unsigned;not null;uniqueIndex:app_account_id_open_id,priority:1;comment:app_account表外键" json:"app_account_id"` // app_account表外键
|
||||
UserID *uint64 `gorm:"column:user_id;type:bigint unsigned" json:"user_id"`
|
||||
Openid string `gorm:"column:openid;type:varchar(255);not null;uniqueIndex:app_account_id_open_id,priority:2" json:"openid"`
|
||||
Unionid string `gorm:"column:unionid;type:varchar(255);not null" json:"unionid"`
|
||||
AnonymousOpenid string `gorm:"column:anonymous_openid;type:varchar(255);not null;comment:匿名openid" json:"anonymous_openid"` // 匿名openid
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
}
|
||||
|
||||
// TableName AppUser's table name
|
||||
func (*AppUser) TableName() string {
|
||||
return TableNameAppUser
|
||||
}
|
@ -6,7 +6,6 @@ package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
@ -17,7 +16,7 @@ import (
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/gen/dao/model"
|
||||
)
|
||||
|
||||
func newAppAccount(db *gorm.DB, opts ...gen.DOOption) appAccount {
|
||||
@ -41,14 +40,14 @@ func newAppAccount(db *gorm.DB, opts ...gen.DOOption) appAccount {
|
||||
}
|
||||
|
||||
type appAccount struct {
|
||||
appAccountDo
|
||||
appAccountDo appAccountDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint32
|
||||
Type field.Uint32
|
||||
Type field.Uint32 // 类型(0:抖音,1:微信)
|
||||
AppID field.String
|
||||
Secret field.String
|
||||
Remark field.String
|
||||
Remark field.String // 备注
|
||||
DeletedAt field.Field
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
@ -78,6 +77,16 @@ func (a *appAccount) updateTableName(table string) *appAccount {
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *appAccount) WithContext(ctx context.Context) *appAccountDo {
|
||||
return a.appAccountDo.WithContext(ctx)
|
||||
}
|
||||
|
||||
func (a appAccount) TableName() string { return a.appAccountDo.TableName() }
|
||||
|
||||
func (a appAccount) Alias() string { return a.appAccountDo.Alias() }
|
||||
|
||||
func (a appAccount) Columns(cols ...field.Expr) gen.Columns { return a.appAccountDo.Columns(cols...) }
|
||||
|
||||
func (a *appAccount) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := a.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
@ -109,172 +118,95 @@ func (a appAccount) replaceDB(db *gorm.DB) appAccount {
|
||||
|
||||
type appAccountDo struct{ gen.DO }
|
||||
|
||||
type IAppAccountDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IAppAccountDo
|
||||
WithContext(ctx context.Context) IAppAccountDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IAppAccountDo
|
||||
WriteDB() IAppAccountDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IAppAccountDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IAppAccountDo
|
||||
Not(conds ...gen.Condition) IAppAccountDo
|
||||
Or(conds ...gen.Condition) IAppAccountDo
|
||||
Select(conds ...field.Expr) IAppAccountDo
|
||||
Where(conds ...gen.Condition) IAppAccountDo
|
||||
Order(conds ...field.Expr) IAppAccountDo
|
||||
Distinct(cols ...field.Expr) IAppAccountDo
|
||||
Omit(cols ...field.Expr) IAppAccountDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IAppAccountDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IAppAccountDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IAppAccountDo
|
||||
Group(cols ...field.Expr) IAppAccountDo
|
||||
Having(conds ...gen.Condition) IAppAccountDo
|
||||
Limit(limit int) IAppAccountDo
|
||||
Offset(offset int) IAppAccountDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IAppAccountDo
|
||||
Unscoped() IAppAccountDo
|
||||
Create(values ...*model.AppAccount) error
|
||||
CreateInBatches(values []*model.AppAccount, batchSize int) error
|
||||
Save(values ...*model.AppAccount) error
|
||||
First() (*model.AppAccount, error)
|
||||
Take() (*model.AppAccount, error)
|
||||
Last() (*model.AppAccount, error)
|
||||
Find() ([]*model.AppAccount, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AppAccount, err error)
|
||||
FindInBatches(result *[]*model.AppAccount, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.AppAccount) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IAppAccountDo
|
||||
Assign(attrs ...field.AssignExpr) IAppAccountDo
|
||||
Joins(fields ...field.RelationField) IAppAccountDo
|
||||
Preload(fields ...field.RelationField) IAppAccountDo
|
||||
FirstOrInit() (*model.AppAccount, error)
|
||||
FirstOrCreate() (*model.AppAccount, error)
|
||||
FindByPage(offset int, limit int) (result []*model.AppAccount, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IAppAccountDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
|
||||
GetAppConfig() (result []*model.AppAccount, err error)
|
||||
}
|
||||
|
||||
// GetAppConfig 获取所有小游戏配置
|
||||
//
|
||||
// select `app_id`,`secret`,`ecpm_value`,`ecpm_view`,`type` from `app_account` left join douyin_ecpm_config on app_account.id = douyin_ecpm_config.app_account_id
|
||||
func (a appAccountDo) GetAppConfig() (result []*model.AppAccount, err error) {
|
||||
var generateSQL strings.Builder
|
||||
generateSQL.WriteString("select `app_id`,`secret`,`ecpm_value`,`ecpm_view`,`type` from `app_account` left join douyin_ecpm_config on app_account.id = douyin_ecpm_config.app_account_id ")
|
||||
|
||||
var executeSQL *gorm.DB
|
||||
executeSQL = a.UnderlyingDB().Raw(generateSQL.String()).Find(&result) // ignore_security_alert
|
||||
err = executeSQL.Error
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (a appAccountDo) Debug() IAppAccountDo {
|
||||
func (a appAccountDo) Debug() *appAccountDo {
|
||||
return a.withDO(a.DO.Debug())
|
||||
}
|
||||
|
||||
func (a appAccountDo) WithContext(ctx context.Context) IAppAccountDo {
|
||||
func (a appAccountDo) WithContext(ctx context.Context) *appAccountDo {
|
||||
return a.withDO(a.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (a appAccountDo) ReadDB() IAppAccountDo {
|
||||
func (a appAccountDo) ReadDB() *appAccountDo {
|
||||
return a.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (a appAccountDo) WriteDB() IAppAccountDo {
|
||||
func (a appAccountDo) WriteDB() *appAccountDo {
|
||||
return a.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (a appAccountDo) Session(config *gorm.Session) IAppAccountDo {
|
||||
func (a appAccountDo) Session(config *gorm.Session) *appAccountDo {
|
||||
return a.withDO(a.DO.Session(config))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Clauses(conds ...clause.Expression) IAppAccountDo {
|
||||
func (a appAccountDo) Clauses(conds ...clause.Expression) *appAccountDo {
|
||||
return a.withDO(a.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Returning(value interface{}, columns ...string) IAppAccountDo {
|
||||
func (a appAccountDo) Returning(value interface{}, columns ...string) *appAccountDo {
|
||||
return a.withDO(a.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Not(conds ...gen.Condition) IAppAccountDo {
|
||||
func (a appAccountDo) Not(conds ...gen.Condition) *appAccountDo {
|
||||
return a.withDO(a.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Or(conds ...gen.Condition) IAppAccountDo {
|
||||
func (a appAccountDo) Or(conds ...gen.Condition) *appAccountDo {
|
||||
return a.withDO(a.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Select(conds ...field.Expr) IAppAccountDo {
|
||||
func (a appAccountDo) Select(conds ...field.Expr) *appAccountDo {
|
||||
return a.withDO(a.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Where(conds ...gen.Condition) IAppAccountDo {
|
||||
func (a appAccountDo) Where(conds ...gen.Condition) *appAccountDo {
|
||||
return a.withDO(a.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Order(conds ...field.Expr) IAppAccountDo {
|
||||
func (a appAccountDo) Order(conds ...field.Expr) *appAccountDo {
|
||||
return a.withDO(a.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Distinct(cols ...field.Expr) IAppAccountDo {
|
||||
func (a appAccountDo) Distinct(cols ...field.Expr) *appAccountDo {
|
||||
return a.withDO(a.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Omit(cols ...field.Expr) IAppAccountDo {
|
||||
func (a appAccountDo) Omit(cols ...field.Expr) *appAccountDo {
|
||||
return a.withDO(a.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Join(table schema.Tabler, on ...field.Expr) IAppAccountDo {
|
||||
func (a appAccountDo) Join(table schema.Tabler, on ...field.Expr) *appAccountDo {
|
||||
return a.withDO(a.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) LeftJoin(table schema.Tabler, on ...field.Expr) IAppAccountDo {
|
||||
func (a appAccountDo) LeftJoin(table schema.Tabler, on ...field.Expr) *appAccountDo {
|
||||
return a.withDO(a.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) RightJoin(table schema.Tabler, on ...field.Expr) IAppAccountDo {
|
||||
func (a appAccountDo) RightJoin(table schema.Tabler, on ...field.Expr) *appAccountDo {
|
||||
return a.withDO(a.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Group(cols ...field.Expr) IAppAccountDo {
|
||||
func (a appAccountDo) Group(cols ...field.Expr) *appAccountDo {
|
||||
return a.withDO(a.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Having(conds ...gen.Condition) IAppAccountDo {
|
||||
func (a appAccountDo) Having(conds ...gen.Condition) *appAccountDo {
|
||||
return a.withDO(a.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Limit(limit int) IAppAccountDo {
|
||||
func (a appAccountDo) Limit(limit int) *appAccountDo {
|
||||
return a.withDO(a.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Offset(offset int) IAppAccountDo {
|
||||
func (a appAccountDo) Offset(offset int) *appAccountDo {
|
||||
return a.withDO(a.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IAppAccountDo {
|
||||
func (a appAccountDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *appAccountDo {
|
||||
return a.withDO(a.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Unscoped() IAppAccountDo {
|
||||
func (a appAccountDo) Unscoped() *appAccountDo {
|
||||
return a.withDO(a.DO.Unscoped())
|
||||
}
|
||||
|
||||
@ -340,22 +272,22 @@ func (a appAccountDo) FindInBatches(result *[]*model.AppAccount, batchSize int,
|
||||
return a.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (a appAccountDo) Attrs(attrs ...field.AssignExpr) IAppAccountDo {
|
||||
func (a appAccountDo) Attrs(attrs ...field.AssignExpr) *appAccountDo {
|
||||
return a.withDO(a.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Assign(attrs ...field.AssignExpr) IAppAccountDo {
|
||||
func (a appAccountDo) Assign(attrs ...field.AssignExpr) *appAccountDo {
|
||||
return a.withDO(a.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (a appAccountDo) Joins(fields ...field.RelationField) IAppAccountDo {
|
||||
func (a appAccountDo) Joins(fields ...field.RelationField) *appAccountDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Joins(_f))
|
||||
}
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a appAccountDo) Preload(fields ...field.RelationField) IAppAccountDo {
|
||||
func (a appAccountDo) Preload(fields ...field.RelationField) *appAccountDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Preload(_f))
|
||||
}
|
@ -9,7 +9,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/gen/dao/model"
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
"gorm.io/gorm/clause"
|
@ -16,7 +16,7 @@ import (
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/gen/dao/model"
|
||||
)
|
||||
|
||||
func newAppUser(db *gorm.DB, opts ...gen.DOOption) appUser {
|
||||
@ -29,13 +29,11 @@ func newAppUser(db *gorm.DB, opts ...gen.DOOption) appUser {
|
||||
_appUser.ALL = field.NewAsterisk(tableName)
|
||||
_appUser.ID = field.NewUint64(tableName, "id")
|
||||
_appUser.AppAccountID = field.NewUint32(tableName, "app_account_id")
|
||||
_appUser.UserID = field.NewUint64(tableName, "user_id")
|
||||
_appUser.Openid = field.NewString(tableName, "openid")
|
||||
_appUser.Unionid = field.NewString(tableName, "unionid")
|
||||
_appUser.Nickname = field.NewString(tableName, "nickname")
|
||||
_appUser.Avatar = field.NewString(tableName, "avatar")
|
||||
_appUser.AnonymousOpenid = field.NewString(tableName, "anonymous_openid")
|
||||
_appUser.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_appUser.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
|
||||
_appUser.fillFieldMap()
|
||||
|
||||
@ -43,18 +41,16 @@ func newAppUser(db *gorm.DB, opts ...gen.DOOption) appUser {
|
||||
}
|
||||
|
||||
type appUser struct {
|
||||
appUserDo
|
||||
appUserDo appUserDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint64
|
||||
AppAccountID field.Uint32
|
||||
AppAccountID field.Uint32 // app_account表外键
|
||||
UserID field.Uint64
|
||||
Openid field.String
|
||||
Unionid field.String
|
||||
Nickname field.String
|
||||
Avatar field.String
|
||||
AnonymousOpenid field.String
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
AnonymousOpenid field.String // 匿名openid
|
||||
CreatedAt field.Time // 创建时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
@ -73,19 +69,25 @@ func (a *appUser) updateTableName(table string) *appUser {
|
||||
a.ALL = field.NewAsterisk(table)
|
||||
a.ID = field.NewUint64(table, "id")
|
||||
a.AppAccountID = field.NewUint32(table, "app_account_id")
|
||||
a.UserID = field.NewUint64(table, "user_id")
|
||||
a.Openid = field.NewString(table, "openid")
|
||||
a.Unionid = field.NewString(table, "unionid")
|
||||
a.Nickname = field.NewString(table, "nickname")
|
||||
a.Avatar = field.NewString(table, "avatar")
|
||||
a.AnonymousOpenid = field.NewString(table, "anonymous_openid")
|
||||
a.CreatedAt = field.NewTime(table, "created_at")
|
||||
a.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
|
||||
a.fillFieldMap()
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
func (a *appUser) WithContext(ctx context.Context) *appUserDo { return a.appUserDo.WithContext(ctx) }
|
||||
|
||||
func (a appUser) TableName() string { return a.appUserDo.TableName() }
|
||||
|
||||
func (a appUser) Alias() string { return a.appUserDo.Alias() }
|
||||
|
||||
func (a appUser) Columns(cols ...field.Expr) gen.Columns { return a.appUserDo.Columns(cols...) }
|
||||
|
||||
func (a *appUser) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := a.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
@ -96,16 +98,14 @@ func (a *appUser) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
}
|
||||
|
||||
func (a *appUser) fillFieldMap() {
|
||||
a.fieldMap = make(map[string]field.Expr, 9)
|
||||
a.fieldMap = make(map[string]field.Expr, 7)
|
||||
a.fieldMap["id"] = a.ID
|
||||
a.fieldMap["app_account_id"] = a.AppAccountID
|
||||
a.fieldMap["user_id"] = a.UserID
|
||||
a.fieldMap["openid"] = a.Openid
|
||||
a.fieldMap["unionid"] = a.Unionid
|
||||
a.fieldMap["nickname"] = a.Nickname
|
||||
a.fieldMap["avatar"] = a.Avatar
|
||||
a.fieldMap["anonymous_openid"] = a.AnonymousOpenid
|
||||
a.fieldMap["created_at"] = a.CreatedAt
|
||||
a.fieldMap["updated_at"] = a.UpdatedAt
|
||||
}
|
||||
|
||||
func (a appUser) clone(db *gorm.DB) appUser {
|
||||
@ -120,156 +120,95 @@ func (a appUser) replaceDB(db *gorm.DB) appUser {
|
||||
|
||||
type appUserDo struct{ gen.DO }
|
||||
|
||||
type IAppUserDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IAppUserDo
|
||||
WithContext(ctx context.Context) IAppUserDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IAppUserDo
|
||||
WriteDB() IAppUserDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IAppUserDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IAppUserDo
|
||||
Not(conds ...gen.Condition) IAppUserDo
|
||||
Or(conds ...gen.Condition) IAppUserDo
|
||||
Select(conds ...field.Expr) IAppUserDo
|
||||
Where(conds ...gen.Condition) IAppUserDo
|
||||
Order(conds ...field.Expr) IAppUserDo
|
||||
Distinct(cols ...field.Expr) IAppUserDo
|
||||
Omit(cols ...field.Expr) IAppUserDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IAppUserDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IAppUserDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IAppUserDo
|
||||
Group(cols ...field.Expr) IAppUserDo
|
||||
Having(conds ...gen.Condition) IAppUserDo
|
||||
Limit(limit int) IAppUserDo
|
||||
Offset(offset int) IAppUserDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IAppUserDo
|
||||
Unscoped() IAppUserDo
|
||||
Create(values ...*model.AppUser) error
|
||||
CreateInBatches(values []*model.AppUser, batchSize int) error
|
||||
Save(values ...*model.AppUser) error
|
||||
First() (*model.AppUser, error)
|
||||
Take() (*model.AppUser, error)
|
||||
Last() (*model.AppUser, error)
|
||||
Find() ([]*model.AppUser, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.AppUser, err error)
|
||||
FindInBatches(result *[]*model.AppUser, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.AppUser) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IAppUserDo
|
||||
Assign(attrs ...field.AssignExpr) IAppUserDo
|
||||
Joins(fields ...field.RelationField) IAppUserDo
|
||||
Preload(fields ...field.RelationField) IAppUserDo
|
||||
FirstOrInit() (*model.AppUser, error)
|
||||
FirstOrCreate() (*model.AppUser, error)
|
||||
FindByPage(offset int, limit int) (result []*model.AppUser, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IAppUserDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (a appUserDo) Debug() IAppUserDo {
|
||||
func (a appUserDo) Debug() *appUserDo {
|
||||
return a.withDO(a.DO.Debug())
|
||||
}
|
||||
|
||||
func (a appUserDo) WithContext(ctx context.Context) IAppUserDo {
|
||||
func (a appUserDo) WithContext(ctx context.Context) *appUserDo {
|
||||
return a.withDO(a.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (a appUserDo) ReadDB() IAppUserDo {
|
||||
func (a appUserDo) ReadDB() *appUserDo {
|
||||
return a.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (a appUserDo) WriteDB() IAppUserDo {
|
||||
func (a appUserDo) WriteDB() *appUserDo {
|
||||
return a.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (a appUserDo) Session(config *gorm.Session) IAppUserDo {
|
||||
func (a appUserDo) Session(config *gorm.Session) *appUserDo {
|
||||
return a.withDO(a.DO.Session(config))
|
||||
}
|
||||
|
||||
func (a appUserDo) Clauses(conds ...clause.Expression) IAppUserDo {
|
||||
func (a appUserDo) Clauses(conds ...clause.Expression) *appUserDo {
|
||||
return a.withDO(a.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Returning(value interface{}, columns ...string) IAppUserDo {
|
||||
func (a appUserDo) Returning(value interface{}, columns ...string) *appUserDo {
|
||||
return a.withDO(a.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Not(conds ...gen.Condition) IAppUserDo {
|
||||
func (a appUserDo) Not(conds ...gen.Condition) *appUserDo {
|
||||
return a.withDO(a.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Or(conds ...gen.Condition) IAppUserDo {
|
||||
func (a appUserDo) Or(conds ...gen.Condition) *appUserDo {
|
||||
return a.withDO(a.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Select(conds ...field.Expr) IAppUserDo {
|
||||
func (a appUserDo) Select(conds ...field.Expr) *appUserDo {
|
||||
return a.withDO(a.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Where(conds ...gen.Condition) IAppUserDo {
|
||||
func (a appUserDo) Where(conds ...gen.Condition) *appUserDo {
|
||||
return a.withDO(a.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Order(conds ...field.Expr) IAppUserDo {
|
||||
func (a appUserDo) Order(conds ...field.Expr) *appUserDo {
|
||||
return a.withDO(a.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Distinct(cols ...field.Expr) IAppUserDo {
|
||||
func (a appUserDo) Distinct(cols ...field.Expr) *appUserDo {
|
||||
return a.withDO(a.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Omit(cols ...field.Expr) IAppUserDo {
|
||||
func (a appUserDo) Omit(cols ...field.Expr) *appUserDo {
|
||||
return a.withDO(a.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Join(table schema.Tabler, on ...field.Expr) IAppUserDo {
|
||||
func (a appUserDo) Join(table schema.Tabler, on ...field.Expr) *appUserDo {
|
||||
return a.withDO(a.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (a appUserDo) LeftJoin(table schema.Tabler, on ...field.Expr) IAppUserDo {
|
||||
func (a appUserDo) LeftJoin(table schema.Tabler, on ...field.Expr) *appUserDo {
|
||||
return a.withDO(a.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a appUserDo) RightJoin(table schema.Tabler, on ...field.Expr) IAppUserDo {
|
||||
func (a appUserDo) RightJoin(table schema.Tabler, on ...field.Expr) *appUserDo {
|
||||
return a.withDO(a.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Group(cols ...field.Expr) IAppUserDo {
|
||||
func (a appUserDo) Group(cols ...field.Expr) *appUserDo {
|
||||
return a.withDO(a.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Having(conds ...gen.Condition) IAppUserDo {
|
||||
func (a appUserDo) Having(conds ...gen.Condition) *appUserDo {
|
||||
return a.withDO(a.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Limit(limit int) IAppUserDo {
|
||||
func (a appUserDo) Limit(limit int) *appUserDo {
|
||||
return a.withDO(a.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (a appUserDo) Offset(offset int) IAppUserDo {
|
||||
func (a appUserDo) Offset(offset int) *appUserDo {
|
||||
return a.withDO(a.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (a appUserDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IAppUserDo {
|
||||
func (a appUserDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *appUserDo {
|
||||
return a.withDO(a.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Unscoped() IAppUserDo {
|
||||
func (a appUserDo) Unscoped() *appUserDo {
|
||||
return a.withDO(a.DO.Unscoped())
|
||||
}
|
||||
|
||||
@ -335,22 +274,22 @@ func (a appUserDo) FindInBatches(result *[]*model.AppUser, batchSize int, fc fun
|
||||
return a.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (a appUserDo) Attrs(attrs ...field.AssignExpr) IAppUserDo {
|
||||
func (a appUserDo) Attrs(attrs ...field.AssignExpr) *appUserDo {
|
||||
return a.withDO(a.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Assign(attrs ...field.AssignExpr) IAppUserDo {
|
||||
func (a appUserDo) Assign(attrs ...field.AssignExpr) *appUserDo {
|
||||
return a.withDO(a.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (a appUserDo) Joins(fields ...field.RelationField) IAppUserDo {
|
||||
func (a appUserDo) Joins(fields ...field.RelationField) *appUserDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Joins(_f))
|
||||
}
|
||||
return &a
|
||||
}
|
||||
|
||||
func (a appUserDo) Preload(fields ...field.RelationField) IAppUserDo {
|
||||
func (a appUserDo) Preload(fields ...field.RelationField) *appUserDo {
|
||||
for _, _f := range fields {
|
||||
a = *a.withDO(a.DO.Preload(_f))
|
||||
}
|
@ -9,7 +9,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/gen/dao/model"
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
"gorm.io/gorm/clause"
|
99
app/auth_service/internal/gen/dao/query/gen.go
Normal file
99
app/auth_service/internal/gen/dao/query/gen.go
Normal file
@ -0,0 +1,99 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"gorm.io/gen"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
)
|
||||
|
||||
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AppAccount: newAppAccount(db, opts...),
|
||||
AppUser: newAppUser(db, opts...),
|
||||
}
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
db *gorm.DB
|
||||
|
||||
AppAccount appAccount
|
||||
AppUser appUser
|
||||
}
|
||||
|
||||
func (q *Query) Available() bool { return q.db != nil }
|
||||
|
||||
func (q *Query) clone(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AppAccount: q.AppAccount.clone(db),
|
||||
AppUser: q.AppUser.clone(db),
|
||||
}
|
||||
}
|
||||
|
||||
func (q *Query) ReadDB() *Query {
|
||||
return q.ReplaceDB(q.db.Clauses(dbresolver.Read))
|
||||
}
|
||||
|
||||
func (q *Query) WriteDB() *Query {
|
||||
return q.ReplaceDB(q.db.Clauses(dbresolver.Write))
|
||||
}
|
||||
|
||||
func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AppAccount: q.AppAccount.replaceDB(db),
|
||||
AppUser: q.AppUser.replaceDB(db),
|
||||
}
|
||||
}
|
||||
|
||||
type queryCtx struct {
|
||||
AppAccount *appAccountDo
|
||||
AppUser *appUserDo
|
||||
}
|
||||
|
||||
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
return &queryCtx{
|
||||
AppAccount: q.AppAccount.WithContext(ctx),
|
||||
AppUser: q.AppUser.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error {
|
||||
return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...)
|
||||
}
|
||||
|
||||
func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx {
|
||||
tx := q.db.Begin(opts...)
|
||||
return &QueryTx{Query: q.clone(tx), Error: tx.Error}
|
||||
}
|
||||
|
||||
type QueryTx struct {
|
||||
*Query
|
||||
Error error
|
||||
}
|
||||
|
||||
func (q *QueryTx) Commit() error {
|
||||
return q.db.Commit().Error
|
||||
}
|
||||
|
||||
func (q *QueryTx) Rollback() error {
|
||||
return q.db.Rollback().Error
|
||||
}
|
||||
|
||||
func (q *QueryTx) SavePoint(name string) error {
|
||||
return q.db.SavePoint(name).Error
|
||||
}
|
||||
|
||||
func (q *QueryTx) RollbackTo(name string) error {
|
||||
return q.db.RollbackTo(name).Error
|
||||
}
|
@ -79,8 +79,6 @@ func Test_WithContext(t *testing.T) {
|
||||
for _, ctx := range []context.Context{
|
||||
qCtx.AppAccount.UnderlyingDB().Statement.Context,
|
||||
qCtx.AppUser.UnderlyingDB().Statement.Context,
|
||||
qCtx.DouyinEcpmConfig.UnderlyingDB().Statement.Context,
|
||||
qCtx.GameScore.UnderlyingDB().Statement.Context,
|
||||
} {
|
||||
if v := ctx.Value(key); v != value {
|
||||
t.Errorf("get value from context fail, expect %q, got %q", value, v)
|
15
app/auth_service/internal/gen/gen.yaml
Normal file
15
app/auth_service/internal/gen/gen.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
version: "0.1"
|
||||
database:
|
||||
dsn : "root:youtu!0113@tcp(192.168.0.47:3306)/ecpm?charset=utf8mb4&parseTime=True&loc=Local"
|
||||
db : "mysql"
|
||||
tables :
|
||||
- "app_user"
|
||||
- "app_account"
|
||||
outPath : "./dao/query"
|
||||
outFile : ""
|
||||
withUnitTest : true
|
||||
modelPkgName : "model"
|
||||
fieldNullable : true
|
||||
fieldWithIndexTag : true
|
||||
fieldWithTypeTag : true
|
||||
fieldSignable : true
|
@ -2,8 +2,9 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
@ -23,6 +24,7 @@ func NewCode2SessionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Code
|
||||
}
|
||||
|
||||
func (l *Code2SessionLogic) Code2Session(in *auth_service.Code2SessionRequest) (*auth_service.Code2SessionResponse, error) {
|
||||
//获取cli,调用抖音或者微信api
|
||||
cli, err := l.svcCtx.Cli.Get(in.AppId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -31,8 +33,33 @@ func (l *Code2SessionLogic) Code2Session(in *auth_service.Code2SessionRequest) (
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//获取appId
|
||||
ac := l.svcCtx.Query.AppAccount
|
||||
acModel, err := ac.WithContext(l.ctx).Where(ac.AppID.Eq(in.AppId)).First()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//获取用户id
|
||||
au := l.svcCtx.Query.AppUser
|
||||
auModel, err := au.WithContext(l.ctx).Where(au.AppAccountID.Eq(acModel.ID), au.Openid.Eq(res.OpenID)).FirstOrCreate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//如果没有用户id,则创建一个空用户
|
||||
if auModel.UserID == nil {
|
||||
userId, err := l.svcCtx.UserManagerClient.CreateEmptyUser(l.ctx, &user_management.Empty{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
auModel.UserID = &userId.UserId
|
||||
}
|
||||
|
||||
return &auth_service.Code2SessionResponse{
|
||||
OpenId: res.OpenID,
|
||||
UnionId: res.UnionID,
|
||||
UserId: *auModel.UserID,
|
||||
}, nil
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -2,8 +2,8 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -6,14 +6,15 @@ package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
auth_service2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/auth_service"
|
||||
logic2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/internal/logic"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/internal/svc"
|
||||
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/logic"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/svc"
|
||||
)
|
||||
|
||||
type AuthServiceServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
auth_service2.UnimplementedAuthServiceServer
|
||||
auth_service.UnimplementedAuthServiceServer
|
||||
}
|
||||
|
||||
func NewAuthServiceServer(svcCtx *svc.ServiceContext) *AuthServiceServer {
|
||||
@ -22,17 +23,17 @@ func NewAuthServiceServer(svcCtx *svc.ServiceContext) *AuthServiceServer {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *AuthServiceServer) Ping(ctx context.Context, in *auth_service2.Request) (*auth_service2.Response, error) {
|
||||
l := logic2.NewPingLogic(ctx, s.svcCtx)
|
||||
func (s *AuthServiceServer) Ping(ctx context.Context, in *auth_service.Request) (*auth_service.Response, error) {
|
||||
l := logic.NewPingLogic(ctx, s.svcCtx)
|
||||
return l.Ping(in)
|
||||
}
|
||||
|
||||
func (s *AuthServiceServer) Code2Session(ctx context.Context, in *auth_service2.Code2SessionRequest) (*auth_service2.Code2SessionResponse, error) {
|
||||
l := logic2.NewCode2SessionLogic(ctx, s.svcCtx)
|
||||
func (s *AuthServiceServer) Code2Session(ctx context.Context, in *auth_service.Code2SessionRequest) (*auth_service.Code2SessionResponse, error) {
|
||||
l := logic.NewCode2SessionLogic(ctx, s.svcCtx)
|
||||
return l.Code2Session(in)
|
||||
}
|
||||
|
||||
func (s *AuthServiceServer) GetAccessToken(ctx context.Context, in *auth_service2.GetAccessTokenRequest) (*auth_service2.GetAccessTokenResponse, error) {
|
||||
l := logic2.NewGetAccessTokenLogic(ctx, s.svcCtx)
|
||||
func (s *AuthServiceServer) GetAccessToken(ctx context.Context, in *auth_service.GetAccessTokenRequest) (*auth_service.GetAccessTokenResponse, error) {
|
||||
l := logic.NewGetAccessTokenLogic(ctx, s.svcCtx)
|
||||
return l.GetAccessToken(in)
|
||||
}
|
||||
|
@ -2,28 +2,113 @@ package svc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/internal/config"
|
||||
cli2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/pkg"
|
||||
"encoding/json"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/internal/gen/dao/query"
|
||||
cli2 "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/pkg"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management_client"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config"
|
||||
"github.com/silenceper/wechat/v2/cache"
|
||||
redisCache "github.com/silenceper/wechat/v2/cache"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/discov"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
clientv3 "go.etcd.io/etcd/client/v3"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
Cli cli2.Helper
|
||||
UserManagerClient user_management_client.UserManagement
|
||||
Query *query.Query
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
|
||||
svc := &ServiceContext{
|
||||
Config: c,
|
||||
}
|
||||
|
||||
clientConf := zrpc.RpcClientConf{}
|
||||
err := conf.FillDefault(&clientConf) // 填充默认值,比如 trace 透传等,参考服务配置说明
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
clientConf.Token = "user_management.rpc.key"
|
||||
clientConf.App = "user_management.rpc"
|
||||
clientConf.Etcd = discov.EtcdConf{ // 通过 etcd 服务发现
|
||||
Hosts: []string{viper.GetString(config.EtcdAddrKey)},
|
||||
Key: "user_management.rpc",
|
||||
}
|
||||
|
||||
func (svc *ServiceContext) InitClient(c config.Config) {
|
||||
svc.UserManagerClient = user_management.NewUserManagementClient(zrpc.MustNewClient(clientConf).Conn())
|
||||
|
||||
dwCache := redisCache.NewRedis(context.Background(), &redisCache.RedisOpts{Host: c.Redis.Host})
|
||||
svc.InitClient()
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
type AppData struct {
|
||||
AppId string `json:"appId"`
|
||||
AppSecret string `json:"appSecret"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type AppDataList []AppData
|
||||
|
||||
const AppDataWatchKey = "/youtu/appData"
|
||||
|
||||
func (svc *ServiceContext) InitClient() {
|
||||
|
||||
dwCache := redisCache.NewRedis(context.Background(), &redisCache.RedisOpts{Host: svc.Config.Redis[0].Host})
|
||||
|
||||
cli, err := clientv3.NewFromURL(viper.GetString(config.EtcdAddrKey))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
res, err := cli.Get(context.TODO(), AppDataWatchKey)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var appDataArr AppDataList
|
||||
|
||||
for _, kv := range res.Kvs {
|
||||
var arr AppDataList
|
||||
err = json.Unmarshal(kv.Value, &arr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
appDataArr = append(appDataArr, arr...)
|
||||
}
|
||||
|
||||
svc.SaveDW(appDataArr, dwCache)
|
||||
|
||||
go func() {
|
||||
ch := cli.Watch(context.Background(), AppDataWatchKey)
|
||||
//从通道中尝试取值(监视的信息)
|
||||
for res := range ch {
|
||||
var appDataArr AppDataList
|
||||
for _, evt := range res.Events {
|
||||
var arr AppDataList
|
||||
err = json.Unmarshal(evt.Kv.Value, &arr)
|
||||
if err != nil {
|
||||
panic(err) //todo logger
|
||||
}
|
||||
appDataArr = append(appDataArr, arr...)
|
||||
}
|
||||
svc.SaveDW(appDataArr, dwCache)
|
||||
}
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
func (svc *ServiceContext) SaveDW(arr []AppData, dwCache cache.Cache) {
|
||||
svc.Cli.Clear()
|
||||
//配置小程序cli(抖音&微信)
|
||||
for _, v := range c.AppData {
|
||||
for _, v := range arr {
|
||||
var c cli2.DWClient
|
||||
switch v.Type {
|
||||
case cli2.DouyinClientType:
|
||||
|
@ -3,8 +3,8 @@ package cli
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/pkg/douyin/access-token"
|
||||
douyinopenapi "gitea.youtukeji.com.cn/youtu/openapi-helper/douyin"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/pkg/douyin/access-token"
|
||||
"github.com/silenceper/wechat/v2/cache"
|
||||
)
|
||||
|
||||
|
33
app/douyin_ecpm_calculation_service/Dockerfile
Normal file
33
app/douyin_ecpm_calculation_service/Dockerfile
Normal file
@ -0,0 +1,33 @@
|
||||
FROM golang:alpine AS builder
|
||||
|
||||
LABEL stage=gobuilder
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk update --no-cache && apk add --no-cache tzdata
|
||||
RUN apk add --no-cache git
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
ADD go.mod .
|
||||
ADD go.sum .
|
||||
RUN go env -w GOPRIVATE=gitea.youtukeji.com.cn
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
|
||||
RUN go build -ldflags="-s -w" -o /app/douyin_ecpm_calculation_service ./app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service.go
|
||||
|
||||
|
||||
FROM alpine
|
||||
|
||||
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/douyin_ecpm_calculation_service /app/server
|
||||
|
||||
EXPOSE 8888
|
||||
|
||||
CMD ["/app/server"]
|
@ -3,25 +3,29 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/config"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/server"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/internal/server"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/douyin_ecpm_calculation_service.yaml", "the config file")
|
||||
const ServiceName = "douyin_ecpm"
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
err := config.GetConfig(&c, ServiceName)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c.RpcServerConf.Name = ServiceName + ".rpc"
|
||||
ctx := svc.NewServiceContext(c)
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
@ -31,8 +35,9 @@ func main() {
|
||||
reflection.Register(grpcServer)
|
||||
}
|
||||
})
|
||||
|
||||
defer s.Stop()
|
||||
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.RpcServerConf.ListenOn)
|
||||
s.Start()
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ package douyin_ecpm_calculation_service_client
|
||||
|
||||
import (
|
||||
"context"
|
||||
douyin_ecpm_calculation_service2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||
douyin_ecpm_calculation_service2 "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
|
@ -5,9 +5,9 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/internal/svc"
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
@ -2,8 +2,8 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -6,9 +6,9 @@ package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
douyin_ecpm_calculation_service2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||
logic2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/logic"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/svc"
|
||||
douyin_ecpm_calculation_service2 "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/douyin_ecpm_calculation_service"
|
||||
logic2 "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/internal/logic"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/douyin_ecpm_calculation_service/internal/svc"
|
||||
)
|
||||
|
||||
type DouyinEcpmCalculationServiceServer struct {
|
||||
|
@ -2,8 +2,9 @@ package svc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/douyin_ecpm_calculation_service/internal/config"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/auth_service/auth_service"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/discov"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
@ -36,7 +37,7 @@ const EcpmConfigWatchKey = "ecpm_config"
|
||||
func (svc *ServiceContext) initEtcd() {
|
||||
|
||||
//初始化etcd客户端
|
||||
cli, err := clientv3.NewFromURL(svc.Config.Etcd.Hosts[0])
|
||||
cli, err := clientv3.NewFromURL(viper.GetString(config.EtcdAddrKey))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -77,7 +78,7 @@ func (svc *ServiceContext) initAuthServiceClient() {
|
||||
clientConf.Token = "auth_service.rpc.key"
|
||||
clientConf.App = "auth_service.rpc"
|
||||
clientConf.Etcd = discov.EtcdConf{ // 通过 etcd 服务发现
|
||||
Hosts: svc.Config.Etcd.Hosts,
|
||||
Hosts: []string{viper.GetString(config.EtcdAddrKey)},
|
||||
Key: "auth_service.rpc",
|
||||
}
|
||||
|
||||
|
33
app/ranking_management/Dockerfile
Normal file
33
app/ranking_management/Dockerfile
Normal file
@ -0,0 +1,33 @@
|
||||
FROM golang:alpine AS builder
|
||||
|
||||
LABEL stage=gobuilder
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk update --no-cache && apk add --no-cache tzdata
|
||||
RUN apk add --no-cache git
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
ADD go.mod .
|
||||
ADD go.sum .
|
||||
RUN go env -w GOPRIVATE=gitea.youtukeji.com.cn
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
|
||||
RUN go build -ldflags="-s -w" -o /app/ranking_management ./app/ranking_management/ranking_management.go
|
||||
|
||||
|
||||
FROM alpine
|
||||
|
||||
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/ranking_management /app/server
|
||||
|
||||
EXPOSE 8888
|
||||
|
||||
CMD ["/app/server"]
|
@ -17,8 +17,8 @@ import (
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/querier"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/my_gorm/gen/querier"
|
||||
)
|
||||
|
||||
func newGameScore(db *gorm.DB, opts ...gen.DOOption) gameScore {
|
@ -7,9 +7,10 @@ package query
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/gen/dao/model"
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
"gorm.io/gorm/clause"
|
||||
@ -143,3 +144,33 @@ func Test_gameScoreQuery(t *testing.T) {
|
||||
t.Error("Not/Or/Clauses on table <game_score> fail:", err)
|
||||
}
|
||||
}
|
||||
|
||||
var GameScoreGetUserRankTestCase = []TestCase{}
|
||||
|
||||
func Test_gameScore_GetUserRank(t *testing.T) {
|
||||
gameScore := newGameScore(_gen_test_db)
|
||||
do := gameScore.WithContext(context.Background()).Debug()
|
||||
|
||||
for i, tt := range GameScoreGetUserRankTestCase {
|
||||
t.Run("GetUserRank_"+strconv.Itoa(i), func(t *testing.T) {
|
||||
res1, res2 := do.GetUserRank(tt.Input.Args[0].(uint32), tt.Input.Args[1].(uint64), tt.Input.Args[2].(uint32))
|
||||
assert(t, "GetUserRank", res1, tt.Expectation.Ret[0])
|
||||
assert(t, "GetUserRank", res2, tt.Expectation.Ret[1])
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var GameScoreFindDistinctRankingTestCase = []TestCase{}
|
||||
|
||||
func Test_gameScore_FindDistinctRanking(t *testing.T) {
|
||||
gameScore := newGameScore(_gen_test_db)
|
||||
do := gameScore.WithContext(context.Background()).Debug()
|
||||
|
||||
for i, tt := range GameScoreFindDistinctRankingTestCase {
|
||||
t.Run("FindDistinctRanking_"+strconv.Itoa(i), func(t *testing.T) {
|
||||
res1, res2 := do.FindDistinctRanking()
|
||||
assert(t, "FindDistinctRanking", res1, tt.Expectation.Ret[0])
|
||||
assert(t, "FindDistinctRanking", res2, tt.Expectation.Ret[1])
|
||||
})
|
||||
}
|
||||
}
|
@ -17,26 +17,17 @@ import (
|
||||
|
||||
var (
|
||||
Q = new(Query)
|
||||
AppAccount *appAccount
|
||||
AppUser *appUser
|
||||
DouyinEcpmConfig *douyinEcpmConfig
|
||||
GameScore *gameScore
|
||||
)
|
||||
|
||||
func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
*Q = *Use(db, opts...)
|
||||
AppAccount = &Q.AppAccount
|
||||
AppUser = &Q.AppUser
|
||||
DouyinEcpmConfig = &Q.DouyinEcpmConfig
|
||||
GameScore = &Q.GameScore
|
||||
}
|
||||
|
||||
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AppAccount: newAppAccount(db, opts...),
|
||||
AppUser: newAppUser(db, opts...),
|
||||
DouyinEcpmConfig: newDouyinEcpmConfig(db, opts...),
|
||||
GameScore: newGameScore(db, opts...),
|
||||
}
|
||||
}
|
||||
@ -44,9 +35,6 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
type Query struct {
|
||||
db *gorm.DB
|
||||
|
||||
AppAccount appAccount
|
||||
AppUser appUser
|
||||
DouyinEcpmConfig douyinEcpmConfig
|
||||
GameScore gameScore
|
||||
}
|
||||
|
||||
@ -55,9 +43,6 @@ func (q *Query) Available() bool { return q.db != nil }
|
||||
func (q *Query) clone(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AppAccount: q.AppAccount.clone(db),
|
||||
AppUser: q.AppUser.clone(db),
|
||||
DouyinEcpmConfig: q.DouyinEcpmConfig.clone(db),
|
||||
GameScore: q.GameScore.clone(db),
|
||||
}
|
||||
}
|
||||
@ -73,25 +58,16 @@ func (q *Query) WriteDB() *Query {
|
||||
func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
AppAccount: q.AppAccount.replaceDB(db),
|
||||
AppUser: q.AppUser.replaceDB(db),
|
||||
DouyinEcpmConfig: q.DouyinEcpmConfig.replaceDB(db),
|
||||
GameScore: q.GameScore.replaceDB(db),
|
||||
}
|
||||
}
|
||||
|
||||
type queryCtx struct {
|
||||
AppAccount IAppAccountDo
|
||||
AppUser IAppUserDo
|
||||
DouyinEcpmConfig IDouyinEcpmConfigDo
|
||||
GameScore IGameScoreDo
|
||||
}
|
||||
|
||||
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
return &queryCtx{
|
||||
AppAccount: q.AppAccount.WithContext(ctx),
|
||||
AppUser: q.AppUser.WithContext(ctx),
|
||||
DouyinEcpmConfig: q.DouyinEcpmConfig.WithContext(ctx),
|
||||
GameScore: q.GameScore.WithContext(ctx),
|
||||
}
|
||||
}
|
118
app/ranking_management/internal/gen/dao/query/gen_test.go
Normal file
118
app/ranking_management/internal/gen/dao/query/gen_test.go
Normal file
@ -0,0 +1,118 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Input struct {
|
||||
Args []interface{}
|
||||
}
|
||||
|
||||
type Expectation struct {
|
||||
Ret []interface{}
|
||||
}
|
||||
|
||||
type TestCase struct {
|
||||
Input
|
||||
Expectation
|
||||
}
|
||||
|
||||
const _gen_test_db_name = "gen_test.db"
|
||||
|
||||
var _gen_test_db *gorm.DB
|
||||
var _gen_test_once sync.Once
|
||||
|
||||
func init() {
|
||||
InitializeDB()
|
||||
_gen_test_db.AutoMigrate(&_another{})
|
||||
}
|
||||
|
||||
func InitializeDB() {
|
||||
_gen_test_once.Do(func() {
|
||||
var err error
|
||||
_gen_test_db, err = gorm.Open(sqlite.Open(_gen_test_db_name), &gorm.Config{})
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("open sqlite %q fail: %w", _gen_test_db_name, err))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func assert(t *testing.T, methodName string, res, exp interface{}) {
|
||||
if !reflect.DeepEqual(res, exp) {
|
||||
t.Errorf("%v() gotResult = %v, want %v", methodName, res, exp)
|
||||
}
|
||||
}
|
||||
|
||||
type _another struct {
|
||||
ID uint64 `gorm:"primaryKey"`
|
||||
}
|
||||
|
||||
func (*_another) TableName() string { return "another_for_unit_test" }
|
||||
|
||||
func Test_Available(t *testing.T) {
|
||||
if !Use(_gen_test_db).Available() {
|
||||
t.Errorf("query.Available() == false")
|
||||
}
|
||||
}
|
||||
|
||||
func Test_WithContext(t *testing.T) {
|
||||
query := Use(_gen_test_db)
|
||||
if !query.Available() {
|
||||
t.Errorf("query Use(_gen_test_db) fail: query.Available() == false")
|
||||
}
|
||||
|
||||
type Content string
|
||||
var key, value Content = "gen_tag", "unit_test"
|
||||
qCtx := query.WithContext(context.WithValue(context.Background(), key, value))
|
||||
|
||||
for _, ctx := range []context.Context{
|
||||
qCtx.GameScore.UnderlyingDB().Statement.Context,
|
||||
} {
|
||||
if v := ctx.Value(key); v != value {
|
||||
t.Errorf("get value from context fail, expect %q, got %q", value, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Transaction(t *testing.T) {
|
||||
query := Use(_gen_test_db)
|
||||
if !query.Available() {
|
||||
t.Errorf("query Use(_gen_test_db) fail: query.Available() == false")
|
||||
}
|
||||
|
||||
err := query.Transaction(func(tx *Query) error { return nil })
|
||||
if err != nil {
|
||||
t.Errorf("query.Transaction execute fail: %s", err)
|
||||
}
|
||||
|
||||
tx := query.Begin()
|
||||
|
||||
err = tx.SavePoint("point")
|
||||
if err != nil {
|
||||
t.Errorf("query tx SavePoint fail: %s", err)
|
||||
}
|
||||
err = tx.RollbackTo("point")
|
||||
if err != nil {
|
||||
t.Errorf("query tx RollbackTo fail: %s", err)
|
||||
}
|
||||
err = tx.Commit()
|
||||
if err != nil {
|
||||
t.Errorf("query tx Commit fail: %s", err)
|
||||
}
|
||||
|
||||
err = query.Begin().Rollback()
|
||||
if err != nil {
|
||||
t.Errorf("query tx Rollback fail: %s", err)
|
||||
}
|
||||
}
|
14
app/ranking_management/internal/gen/gen.yaml
Normal file
14
app/ranking_management/internal/gen/gen.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
version: "0.1"
|
||||
database:
|
||||
dsn : "root:youtu!0113@tcp(192.168.0.47:3306)/ecpm?charset=utf8mb4&parseTime=True&loc=Local"
|
||||
db : "mysql"
|
||||
tables :
|
||||
- "game_score"
|
||||
outPath : "./dao/query"
|
||||
outFile : ""
|
||||
withUnitTest : true
|
||||
modelPkgName : "model"
|
||||
fieldNullable : true
|
||||
fieldWithIndexTag : true
|
||||
fieldWithTypeTag : true
|
||||
fieldSignable : true
|
76
app/ranking_management/internal/gen/querier/querier.go
Normal file
76
app/ranking_management/internal/gen/querier/querier.go
Normal file
@ -0,0 +1,76 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/my_gorm/gen/querier"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func main() {
|
||||
g := gen.NewGenerator(gen.Config{
|
||||
OutPath: "./app/ranking_management/internal/gen/dao/query",
|
||||
Mode: gen.WithoutContext | gen.WithDefaultQuery | gen.WithQueryInterface, // generate mode
|
||||
WithUnitTest: true,
|
||||
})
|
||||
dsn := "root:youtu!0113@tcp(192.168.0.47:3306)/ecpm?charset=utf8&parseTime=True&loc=Local"
|
||||
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// gormdb, _ := gorm.Open(mysql.Open("root:@(127.0.0.1:3306)/demo?charset=utf8mb4&parseTime=True&loc=Local"))
|
||||
g.UseDB(db) // reuse your gorm db
|
||||
|
||||
//g.ApplyBasic(model.AppAccount{}, model.AppUser{}, model.DouyinEcpmConfig{}, model.GameScore{})
|
||||
// Generate Type Safe API with Dynamic SQL defined on Querier interface for `model.User` and `model.Company`
|
||||
g.ApplyInterface(func(querier.GameScoreQuerier) {}, model.GameScore{})
|
||||
|
||||
g.ApplyBasic(model.GameScore{})
|
||||
|
||||
// Generate the code
|
||||
g.Execute()
|
||||
|
||||
}
|
||||
|
||||
type GameScoreQuerier interface {
|
||||
/*
|
||||
|
||||
SELECT
|
||||
app_user.nickname,
|
||||
app_user.avatar,
|
||||
gs.score,
|
||||
gs.app_user_id,
|
||||
gs.t_rank
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
game_score.score,
|
||||
game_score.app_user_id,
|
||||
game_score.app_account,
|
||||
rank() OVER (ORDER BY game_score.score DESC) t_rank
|
||||
FROM
|
||||
game_score
|
||||
WHERE
|
||||
game_score.t = @t
|
||||
AND game_score.app_account = @appId
|
||||
) AS gs
|
||||
LEFT JOIN app_user ON app_user.id = gs.app_user_id
|
||||
WHERE
|
||||
gs.app_user_id = @userId
|
||||
LIMIT 1;
|
||||
*/
|
||||
GetUserRank(appId uint32, userId uint64, t uint32) (resp RankingData, err error)
|
||||
|
||||
//select DISTINCT app_account,t from game_score
|
||||
FindDistinctRanking() (resp []*gen.T, err error)
|
||||
}
|
||||
|
||||
type RankingData struct {
|
||||
Nickname string `json:"nickname" db:"nickname"` // 昵称
|
||||
Avatar string `json:"avatar" db:"avatar"` // 头像
|
||||
Score uint32 `json:"score" db:"score"` // 得分
|
||||
UserId uint64 `json:"userId" db:"app_user_id"` // 用户 ID
|
||||
Rank uint32 `json:"rank" db:"t_rank"` // 排名
|
||||
Self bool `json:"self" db:"-"` // 是否是自己
|
||||
}
|
@ -3,9 +3,10 @@ package logic
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/logic/rankings"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/svc"
|
||||
ranking_management2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/ranking_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/logic/rankings"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/svc"
|
||||
ranking_management2 "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/ranking_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
"gorm.io/gorm"
|
||||
"strconv"
|
||||
|
||||
@ -43,7 +44,7 @@ func (l *GetRankingListLogic) GetRankingList(in *ranking_management2.GetRankingL
|
||||
continue
|
||||
}
|
||||
//查询用户数据,FindOne带缓存
|
||||
user, err := l.svcCtx.Query.AppUser.Where(l.svcCtx.Query.AppUser.ID.Eq(uint64(userId))).Take()
|
||||
user, err := l.svcCtx.UserManagerClient.GetUserById(l.ctx, &user_management.UserId{UserId: uint64(userId)})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/ranking_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/ranking_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
@ -3,10 +3,10 @@ package logic
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/logic/rankings"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/ranking_management"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/logic/rankings"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/ranking_management"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
|
@ -7,9 +7,9 @@ package server
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/logic"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/ranking_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/logic"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/ranking_management"
|
||||
)
|
||||
|
||||
type RankingManagementServer struct {
|
||||
|
@ -2,11 +2,17 @@ package svc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/config"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/logic/rankings"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/query"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/gen/dao/query"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/logic/rankings"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management_client"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/my_gorm"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/discov"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@ -15,6 +21,7 @@ type ServiceContext struct {
|
||||
Config config.Config
|
||||
Query *query.Query
|
||||
RedisRanking *rankings.Ranking
|
||||
UserManagerClient user_management_client.UserManagement
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
@ -24,17 +31,31 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
||||
|
||||
//初始化redis client
|
||||
redisClient := redis.NewClient(&redis.Options{
|
||||
Addr: c.RedisHost,
|
||||
Addr: c.Redis[0].Host,
|
||||
})
|
||||
//初始化数据库
|
||||
//todo
|
||||
db, err := my_gorm.NewDBWithCache(mysql.Open(c.Mysql.Dsn), &gorm.Config{}, redisClient)
|
||||
db, err := my_gorm.NewDBWithCache(mysql.Open(c.Mysql), &gorm.Config{}, redisClient)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
svc.Query = query.Use(db)
|
||||
|
||||
// 初始化用户客户端
|
||||
clientConf := zrpc.RpcClientConf{}
|
||||
err = conf.FillDefault(&clientConf) // 填充默认值,比如 trace 透传等,参考服务配置说明
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
clientConf.Token = "user_management.rpc.key"
|
||||
clientConf.App = "user_management.rpc"
|
||||
clientConf.Etcd = discov.EtcdConf{ // 通过 etcd 服务发现
|
||||
Hosts: []string{viper.GetString(config.EtcdAddrKey)},
|
||||
Key: "user_management.rpc",
|
||||
}
|
||||
|
||||
svc.UserManagerClient = user_management.NewUserManagementClient(zrpc.MustNewClient(clientConf).Conn())
|
||||
|
||||
//初始化排行榜对象
|
||||
svc.InitRankings(redisClient)
|
||||
|
||||
|
@ -1,27 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/config"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/server"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/ranking_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/server"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/ranking_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/ranking_management.yaml", "the config file")
|
||||
const ServiceName = "ranking_management"
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
err := config.GetConfig(&c, ServiceName)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c.RpcServerConf.Name = ServiceName + ".rpc"
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
@ -33,6 +36,6 @@ func main() {
|
||||
})
|
||||
defer s.Stop()
|
||||
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.RpcServerConf.ListenOn)
|
||||
s.Start()
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ package ranking_management_client
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/ranking_management/ranking_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/ranking_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
|
33
app/user_management/Dockerfile
Normal file
33
app/user_management/Dockerfile
Normal file
@ -0,0 +1,33 @@
|
||||
FROM golang:alpine AS builder
|
||||
|
||||
LABEL stage=gobuilder
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
RUN apk update --no-cache && apk add --no-cache tzdata
|
||||
RUN apk add --no-cache git
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
ADD go.mod .
|
||||
ADD go.sum .
|
||||
RUN go env -w GOPRIVATE=gitea.youtukeji.com.cn
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
|
||||
RUN go build -ldflags="-s -w" -o /app/user_management ./app/user_management/user_management.go
|
||||
|
||||
|
||||
FROM alpine
|
||||
|
||||
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/user_management /app/server
|
||||
|
||||
EXPOSE 8888
|
||||
|
||||
CMD ["/app/server"]
|
14
app/user_management/etc/user_management.json
Normal file
14
app/user_management/etc/user_management.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"listenOn": "0.0.0.0:8080",
|
||||
"etcd": {
|
||||
"Hosts": [
|
||||
"127.0.0.1:2379"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"Host": "127.0.0.1:6379"
|
||||
},
|
||||
"mysql": {
|
||||
"Dsn": "root:youtu!0113@tcp(localhost:3306)/ecpm?charset=utf8mb4&parseTime=True&loc=Local"
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
Name: usermanagement.rpc
|
||||
Name: user_management.rpc
|
||||
ListenOn: 0.0.0.0:8080
|
||||
Etcd:
|
||||
Hosts:
|
||||
- 127.0.0.1:2379
|
||||
Key: usermanagement.rpc
|
||||
Key: user_management.rpc
|
||||
|
25
app/user_management/internal/gen/dao/model/user.gen.go
Normal file
25
app/user_management/internal/gen/dao/model/user.gen.go
Normal file
@ -0,0 +1,25 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const TableNameUser = "user"
|
||||
|
||||
// User mapped from table <user>
|
||||
type User struct {
|
||||
ID uint64 `gorm:"column:id;type:bigint unsigned;primaryKey;autoIncrement:true;index:idx_app_user_id,priority:1" json:"id"`
|
||||
Nickname string `gorm:"column:nickname;type:varchar(255);not null;comment:昵称" json:"nickname"` // 昵称
|
||||
Avatar string `gorm:"column:avatar;type:varchar(255);not null;comment:头像" json:"avatar"` // 头像
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// TableName User's table name
|
||||
func (*User) TableName() string {
|
||||
return TableNameUser
|
||||
}
|
93
app/user_management/internal/gen/dao/query/gen.go
Normal file
93
app/user_management/internal/gen/dao/query/gen.go
Normal file
@ -0,0 +1,93 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"gorm.io/gen"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
)
|
||||
|
||||
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
User: newUser(db, opts...),
|
||||
}
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
db *gorm.DB
|
||||
|
||||
User user
|
||||
}
|
||||
|
||||
func (q *Query) Available() bool { return q.db != nil }
|
||||
|
||||
func (q *Query) clone(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
User: q.User.clone(db),
|
||||
}
|
||||
}
|
||||
|
||||
func (q *Query) ReadDB() *Query {
|
||||
return q.ReplaceDB(q.db.Clauses(dbresolver.Read))
|
||||
}
|
||||
|
||||
func (q *Query) WriteDB() *Query {
|
||||
return q.ReplaceDB(q.db.Clauses(dbresolver.Write))
|
||||
}
|
||||
|
||||
func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
User: q.User.replaceDB(db),
|
||||
}
|
||||
}
|
||||
|
||||
type queryCtx struct {
|
||||
User *userDo
|
||||
}
|
||||
|
||||
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
return &queryCtx{
|
||||
User: q.User.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error {
|
||||
return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...)
|
||||
}
|
||||
|
||||
func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx {
|
||||
tx := q.db.Begin(opts...)
|
||||
return &QueryTx{Query: q.clone(tx), Error: tx.Error}
|
||||
}
|
||||
|
||||
type QueryTx struct {
|
||||
*Query
|
||||
Error error
|
||||
}
|
||||
|
||||
func (q *QueryTx) Commit() error {
|
||||
return q.db.Commit().Error
|
||||
}
|
||||
|
||||
func (q *QueryTx) Rollback() error {
|
||||
return q.db.Rollback().Error
|
||||
}
|
||||
|
||||
func (q *QueryTx) SavePoint(name string) error {
|
||||
return q.db.SavePoint(name).Error
|
||||
}
|
||||
|
||||
func (q *QueryTx) RollbackTo(name string) error {
|
||||
return q.db.RollbackTo(name).Error
|
||||
}
|
118
app/user_management/internal/gen/dao/query/gen_test.go
Normal file
118
app/user_management/internal/gen/dao/query/gen_test.go
Normal file
@ -0,0 +1,118 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Input struct {
|
||||
Args []interface{}
|
||||
}
|
||||
|
||||
type Expectation struct {
|
||||
Ret []interface{}
|
||||
}
|
||||
|
||||
type TestCase struct {
|
||||
Input
|
||||
Expectation
|
||||
}
|
||||
|
||||
const _gen_test_db_name = "gen_test.db"
|
||||
|
||||
var _gen_test_db *gorm.DB
|
||||
var _gen_test_once sync.Once
|
||||
|
||||
func init() {
|
||||
InitializeDB()
|
||||
_gen_test_db.AutoMigrate(&_another{})
|
||||
}
|
||||
|
||||
func InitializeDB() {
|
||||
_gen_test_once.Do(func() {
|
||||
var err error
|
||||
_gen_test_db, err = gorm.Open(sqlite.Open(_gen_test_db_name), &gorm.Config{})
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("open sqlite %q fail: %w", _gen_test_db_name, err))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func assert(t *testing.T, methodName string, res, exp interface{}) {
|
||||
if !reflect.DeepEqual(res, exp) {
|
||||
t.Errorf("%v() gotResult = %v, want %v", methodName, res, exp)
|
||||
}
|
||||
}
|
||||
|
||||
type _another struct {
|
||||
ID uint64 `gorm:"primaryKey"`
|
||||
}
|
||||
|
||||
func (*_another) TableName() string { return "another_for_unit_test" }
|
||||
|
||||
func Test_Available(t *testing.T) {
|
||||
if !Use(_gen_test_db).Available() {
|
||||
t.Errorf("query.Available() == false")
|
||||
}
|
||||
}
|
||||
|
||||
func Test_WithContext(t *testing.T) {
|
||||
query := Use(_gen_test_db)
|
||||
if !query.Available() {
|
||||
t.Errorf("query Use(_gen_test_db) fail: query.Available() == false")
|
||||
}
|
||||
|
||||
type Content string
|
||||
var key, value Content = "gen_tag", "unit_test"
|
||||
qCtx := query.WithContext(context.WithValue(context.Background(), key, value))
|
||||
|
||||
for _, ctx := range []context.Context{
|
||||
qCtx.User.UnderlyingDB().Statement.Context,
|
||||
} {
|
||||
if v := ctx.Value(key); v != value {
|
||||
t.Errorf("get value from context fail, expect %q, got %q", value, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Test_Transaction(t *testing.T) {
|
||||
query := Use(_gen_test_db)
|
||||
if !query.Available() {
|
||||
t.Errorf("query Use(_gen_test_db) fail: query.Available() == false")
|
||||
}
|
||||
|
||||
err := query.Transaction(func(tx *Query) error { return nil })
|
||||
if err != nil {
|
||||
t.Errorf("query.Transaction execute fail: %s", err)
|
||||
}
|
||||
|
||||
tx := query.Begin()
|
||||
|
||||
err = tx.SavePoint("point")
|
||||
if err != nil {
|
||||
t.Errorf("query tx SavePoint fail: %s", err)
|
||||
}
|
||||
err = tx.RollbackTo("point")
|
||||
if err != nil {
|
||||
t.Errorf("query tx RollbackTo fail: %s", err)
|
||||
}
|
||||
err = tx.Commit()
|
||||
if err != nil {
|
||||
t.Errorf("query tx Commit fail: %s", err)
|
||||
}
|
||||
|
||||
err = query.Begin().Rollback()
|
||||
if err != nil {
|
||||
t.Errorf("query tx Rollback fail: %s", err)
|
||||
}
|
||||
}
|
343
app/user_management/internal/gen/dao/query/user.gen.go
Normal file
343
app/user_management/internal/gen/dao/query/user.gen.go
Normal file
@ -0,0 +1,343 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/gen/dao/model"
|
||||
)
|
||||
|
||||
func newUser(db *gorm.DB, opts ...gen.DOOption) user {
|
||||
_user := user{}
|
||||
|
||||
_user.userDo.UseDB(db, opts...)
|
||||
_user.userDo.UseModel(&model.User{})
|
||||
|
||||
tableName := _user.userDo.TableName()
|
||||
_user.ALL = field.NewAsterisk(tableName)
|
||||
_user.ID = field.NewUint64(tableName, "id")
|
||||
_user.Nickname = field.NewString(tableName, "nickname")
|
||||
_user.Avatar = field.NewString(tableName, "avatar")
|
||||
_user.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_user.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
|
||||
_user.fillFieldMap()
|
||||
|
||||
return _user
|
||||
}
|
||||
|
||||
type user struct {
|
||||
userDo userDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint64
|
||||
Nickname field.String // 昵称
|
||||
Avatar field.String // 头像
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (u user) Table(newTableName string) *user {
|
||||
u.userDo.UseTable(newTableName)
|
||||
return u.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (u user) As(alias string) *user {
|
||||
u.userDo.DO = *(u.userDo.As(alias).(*gen.DO))
|
||||
return u.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (u *user) updateTableName(table string) *user {
|
||||
u.ALL = field.NewAsterisk(table)
|
||||
u.ID = field.NewUint64(table, "id")
|
||||
u.Nickname = field.NewString(table, "nickname")
|
||||
u.Avatar = field.NewString(table, "avatar")
|
||||
u.CreatedAt = field.NewTime(table, "created_at")
|
||||
u.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
|
||||
u.fillFieldMap()
|
||||
|
||||
return u
|
||||
}
|
||||
|
||||
func (u *user) WithContext(ctx context.Context) *userDo { return u.userDo.WithContext(ctx) }
|
||||
|
||||
func (u user) TableName() string { return u.userDo.TableName() }
|
||||
|
||||
func (u user) Alias() string { return u.userDo.Alias() }
|
||||
|
||||
func (u user) Columns(cols ...field.Expr) gen.Columns { return u.userDo.Columns(cols...) }
|
||||
|
||||
func (u *user) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := u.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (u *user) fillFieldMap() {
|
||||
u.fieldMap = make(map[string]field.Expr, 5)
|
||||
u.fieldMap["id"] = u.ID
|
||||
u.fieldMap["nickname"] = u.Nickname
|
||||
u.fieldMap["avatar"] = u.Avatar
|
||||
u.fieldMap["created_at"] = u.CreatedAt
|
||||
u.fieldMap["updated_at"] = u.UpdatedAt
|
||||
}
|
||||
|
||||
func (u user) clone(db *gorm.DB) user {
|
||||
u.userDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return u
|
||||
}
|
||||
|
||||
func (u user) replaceDB(db *gorm.DB) user {
|
||||
u.userDo.ReplaceDB(db)
|
||||
return u
|
||||
}
|
||||
|
||||
type userDo struct{ gen.DO }
|
||||
|
||||
func (u userDo) Debug() *userDo {
|
||||
return u.withDO(u.DO.Debug())
|
||||
}
|
||||
|
||||
func (u userDo) WithContext(ctx context.Context) *userDo {
|
||||
return u.withDO(u.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (u userDo) ReadDB() *userDo {
|
||||
return u.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (u userDo) WriteDB() *userDo {
|
||||
return u.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (u userDo) Session(config *gorm.Session) *userDo {
|
||||
return u.withDO(u.DO.Session(config))
|
||||
}
|
||||
|
||||
func (u userDo) Clauses(conds ...clause.Expression) *userDo {
|
||||
return u.withDO(u.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (u userDo) Returning(value interface{}, columns ...string) *userDo {
|
||||
return u.withDO(u.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (u userDo) Not(conds ...gen.Condition) *userDo {
|
||||
return u.withDO(u.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (u userDo) Or(conds ...gen.Condition) *userDo {
|
||||
return u.withDO(u.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (u userDo) Select(conds ...field.Expr) *userDo {
|
||||
return u.withDO(u.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (u userDo) Where(conds ...gen.Condition) *userDo {
|
||||
return u.withDO(u.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (u userDo) Order(conds ...field.Expr) *userDo {
|
||||
return u.withDO(u.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (u userDo) Distinct(cols ...field.Expr) *userDo {
|
||||
return u.withDO(u.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (u userDo) Omit(cols ...field.Expr) *userDo {
|
||||
return u.withDO(u.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (u userDo) Join(table schema.Tabler, on ...field.Expr) *userDo {
|
||||
return u.withDO(u.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (u userDo) LeftJoin(table schema.Tabler, on ...field.Expr) *userDo {
|
||||
return u.withDO(u.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (u userDo) RightJoin(table schema.Tabler, on ...field.Expr) *userDo {
|
||||
return u.withDO(u.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (u userDo) Group(cols ...field.Expr) *userDo {
|
||||
return u.withDO(u.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (u userDo) Having(conds ...gen.Condition) *userDo {
|
||||
return u.withDO(u.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (u userDo) Limit(limit int) *userDo {
|
||||
return u.withDO(u.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (u userDo) Offset(offset int) *userDo {
|
||||
return u.withDO(u.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (u userDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *userDo {
|
||||
return u.withDO(u.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (u userDo) Unscoped() *userDo {
|
||||
return u.withDO(u.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (u userDo) Create(values ...*model.User) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return u.DO.Create(values)
|
||||
}
|
||||
|
||||
func (u userDo) CreateInBatches(values []*model.User, batchSize int) error {
|
||||
return u.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (u userDo) Save(values ...*model.User) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return u.DO.Save(values)
|
||||
}
|
||||
|
||||
func (u userDo) First() (*model.User, error) {
|
||||
if result, err := u.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.User), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userDo) Take() (*model.User, error) {
|
||||
if result, err := u.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.User), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userDo) Last() (*model.User, error) {
|
||||
if result, err := u.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.User), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userDo) Find() ([]*model.User, error) {
|
||||
result, err := u.DO.Find()
|
||||
return result.([]*model.User), err
|
||||
}
|
||||
|
||||
func (u userDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.User, err error) {
|
||||
buf := make([]*model.User, 0, batchSize)
|
||||
err = u.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (u userDo) FindInBatches(result *[]*model.User, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return u.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (u userDo) Attrs(attrs ...field.AssignExpr) *userDo {
|
||||
return u.withDO(u.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (u userDo) Assign(attrs ...field.AssignExpr) *userDo {
|
||||
return u.withDO(u.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (u userDo) Joins(fields ...field.RelationField) *userDo {
|
||||
for _, _f := range fields {
|
||||
u = *u.withDO(u.DO.Joins(_f))
|
||||
}
|
||||
return &u
|
||||
}
|
||||
|
||||
func (u userDo) Preload(fields ...field.RelationField) *userDo {
|
||||
for _, _f := range fields {
|
||||
u = *u.withDO(u.DO.Preload(_f))
|
||||
}
|
||||
return &u
|
||||
}
|
||||
|
||||
func (u userDo) FirstOrInit() (*model.User, error) {
|
||||
if result, err := u.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.User), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userDo) FirstOrCreate() (*model.User, error) {
|
||||
if result, err := u.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.User), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (u userDo) FindByPage(offset int, limit int) (result []*model.User, count int64, err error) {
|
||||
result, err = u.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = u.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (u userDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = u.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = u.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (u userDo) Scan(result interface{}) (err error) {
|
||||
return u.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (u userDo) Delete(models ...*model.User) (result gen.ResultInfo, err error) {
|
||||
return u.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (u *userDo) withDO(do gen.Dao) *userDo {
|
||||
u.DO = *do.(*gen.DO)
|
||||
return u
|
||||
}
|
145
app/user_management/internal/gen/dao/query/user.gen_test.go
Normal file
145
app/user_management/internal/gen/dao/query/user.gen_test.go
Normal file
@ -0,0 +1,145 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/gen/dao/model"
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
func init() {
|
||||
InitializeDB()
|
||||
err := _gen_test_db.AutoMigrate(&model.User{})
|
||||
if err != nil {
|
||||
fmt.Printf("Error: AutoMigrate(&model.User{}) fail: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_userQuery(t *testing.T) {
|
||||
user := newUser(_gen_test_db)
|
||||
user = *user.As(user.TableName())
|
||||
_do := user.WithContext(context.Background()).Debug()
|
||||
|
||||
primaryKey := field.NewString(user.TableName(), clause.PrimaryKey)
|
||||
_, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete()
|
||||
if err != nil {
|
||||
t.Error("clean table <user> fail:", err)
|
||||
return
|
||||
}
|
||||
|
||||
_, ok := user.GetFieldByName("")
|
||||
if ok {
|
||||
t.Error("GetFieldByName(\"\") from user success")
|
||||
}
|
||||
|
||||
err = _do.Create(&model.User{})
|
||||
if err != nil {
|
||||
t.Error("create item in table <user> fail:", err)
|
||||
}
|
||||
|
||||
err = _do.Save(&model.User{})
|
||||
if err != nil {
|
||||
t.Error("create item in table <user> fail:", err)
|
||||
}
|
||||
|
||||
err = _do.CreateInBatches([]*model.User{{}, {}}, 10)
|
||||
if err != nil {
|
||||
t.Error("create item in table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Select(user.ALL).Take()
|
||||
if err != nil {
|
||||
t.Error("Take() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.First()
|
||||
if err != nil {
|
||||
t.Error("First() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Last()
|
||||
if err != nil {
|
||||
t.Error("First() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil })
|
||||
if err != nil {
|
||||
t.Error("FindInBatch() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.User{}, 10, func(tx gen.Dao, batch int) error { return nil })
|
||||
if err != nil {
|
||||
t.Error("FindInBatches() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Select(user.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find()
|
||||
if err != nil {
|
||||
t.Error("Find() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Distinct(primaryKey).Take()
|
||||
if err != nil {
|
||||
t.Error("select Distinct() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Select(user.ALL).Omit(primaryKey).Take()
|
||||
if err != nil {
|
||||
t.Error("Omit() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Group(primaryKey).Find()
|
||||
if err != nil {
|
||||
t.Error("Group() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find()
|
||||
if err != nil {
|
||||
t.Error("Scopes() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, _, err = _do.FindByPage(0, 1)
|
||||
if err != nil {
|
||||
t.Error("FindByPage() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.ScanByPage(&model.User{}, 0, 1)
|
||||
if err != nil {
|
||||
t.Error("ScanByPage() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit()
|
||||
if err != nil {
|
||||
t.Error("FirstOrInit() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate()
|
||||
if err != nil {
|
||||
t.Error("FirstOrCreate() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
var _a _another
|
||||
var _aPK = field.NewString(_a.TableName(), "id")
|
||||
|
||||
err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{})
|
||||
if err != nil {
|
||||
t.Error("Join() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{})
|
||||
if err != nil {
|
||||
t.Error("LeftJoin() on table <user> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Not().Or().Clauses().Take()
|
||||
if err != nil {
|
||||
t.Error("Not/Or/Clauses on table <user> fail:", err)
|
||||
}
|
||||
}
|
14
app/user_management/internal/gen/gen.yaml
Normal file
14
app/user_management/internal/gen/gen.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
version: "0.1"
|
||||
database:
|
||||
dsn : "root:youtu!0113@tcp(192.168.0.47:3306)/ecpm?charset=utf8mb4&parseTime=True&loc=Local"
|
||||
db : "mysql"
|
||||
tables :
|
||||
- "user"
|
||||
outPath : "./dao/query"
|
||||
outFile : ""
|
||||
withUnitTest : true
|
||||
modelPkgName : "model"
|
||||
fieldNullable : true
|
||||
fieldWithIndexTag : true
|
||||
fieldWithTypeTag : true
|
||||
fieldSignable : true
|
@ -0,0 +1,39 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateEmptyUserLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateEmptyUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateEmptyUserLogic {
|
||||
return &CreateEmptyUserLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateEmptyUserLogic) CreateEmptyUser(_ *user_management.Empty) (*user_management.UserId, error) {
|
||||
userId, err := l.svcCtx.IDGen.NextID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = l.svcCtx.Query.User.WithContext(l.ctx).Create(&model.User{
|
||||
ID: userId,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &user_management.UserId{UserId: userId}, nil
|
||||
}
|
43
app/user_management/internal/logic/create_user_logic.go
Normal file
43
app/user_management/internal/logic/create_user_logic.go
Normal file
@ -0,0 +1,43 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/gen/dao/model"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateUserLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewCreateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateUserLogic {
|
||||
return &CreateUserLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// CreateUser 创建用户
|
||||
func (l *CreateUserLogic) CreateUser(in *user_management.CreateUserRequest) (res *user_management.UserId, err error) {
|
||||
user := l.svcCtx.Query.User
|
||||
userModel := model.User{
|
||||
Nickname: in.Nickname,
|
||||
Avatar: in.Avatar,
|
||||
}
|
||||
userModel.ID, err = l.svcCtx.IDGen.NextID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = user.WithContext(l.ctx).Create(&userModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &user_management.UserId{UserId: userModel.ID}, nil
|
||||
}
|
44
app/user_management/internal/logic/get_user_by_id_logic.go
Normal file
44
app/user_management/internal/logic/get_user_by_id_logic.go
Normal file
@ -0,0 +1,44 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetUserByIdLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetUserByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserByIdLogic {
|
||||
return &GetUserByIdLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// GetUserById 通过 ID 获取用户
|
||||
func (l *GetUserByIdLogic) GetUserById(in *user_management.UserId) (*user_management.User, error) {
|
||||
|
||||
if in.GetUserId() == 0 {
|
||||
return &user_management.User{}, errors.New("userId is empty")
|
||||
}
|
||||
|
||||
user, err := l.svcCtx.Query.User.WithContext(l.ctx).Where(l.svcCtx.Query.User.ID.Eq(in.UserId)).First()
|
||||
if err != nil {
|
||||
return &user_management.User{}, err
|
||||
}
|
||||
|
||||
return &user_management.User{
|
||||
ID: user.ID,
|
||||
Nickname: user.Nickname,
|
||||
Avatar: user.Avatar,
|
||||
}, nil
|
||||
}
|
@ -2,8 +2,8 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/user_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
@ -23,7 +23,5 @@ func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic {
|
||||
}
|
||||
|
||||
func (l *PingLogic) Ping(in *user_management.Request) (*user_management.Response, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &user_management.Response{}, nil
|
||||
return &user_management.Response{Pong: in.Ping}, nil
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SetAppAccountLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewSetAppAccountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetAppAccountLogic {
|
||||
return &SetAppAccountLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *SetAppAccountLogic) SetAppAccount(in *user_management.SetAppUserRequest) (*user_management.Response, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &user_management.Response{}, nil
|
||||
}
|
42
app/user_management/internal/logic/set_user_logic.go
Normal file
42
app/user_management/internal/logic/set_user_logic.go
Normal file
@ -0,0 +1,42 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SetUserLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewSetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetUserLogic {
|
||||
return &SetUserLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// SetUser 设置用户信息
|
||||
func (l *SetUserLogic) SetUser(in *user_management.SetUserRequest) (*user_management.SetUserResponse, error) {
|
||||
if in.UserId == 0 || in.Nickname == "" || in.Avatar == "" {
|
||||
return nil, errors.New("参数错误")
|
||||
}
|
||||
user := l.svcCtx.Query.User
|
||||
update, err := user.WithContext(l.ctx).Where(user.ID.Eq(in.UserId)).Update(user.Avatar, user.Nickname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if update.Error == nil {
|
||||
return nil, update.Error
|
||||
}
|
||||
|
||||
return &user_management.SetUserResponse{RowsAffected: update.RowsAffected}, nil
|
||||
}
|
@ -6,14 +6,15 @@ package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
logic2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/internal/logic"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/internal/svc"
|
||||
user_management2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/logic"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
)
|
||||
|
||||
type UserManagementServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
user_management2.UnimplementedUserManagementServer
|
||||
user_management.UnimplementedUserManagementServer
|
||||
}
|
||||
|
||||
func NewUserManagementServer(svcCtx *svc.ServiceContext) *UserManagementServer {
|
||||
@ -22,12 +23,31 @@ func NewUserManagementServer(svcCtx *svc.ServiceContext) *UserManagementServer {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *UserManagementServer) Ping(ctx context.Context, in *user_management2.Request) (*user_management2.Response, error) {
|
||||
l := logic2.NewPingLogic(ctx, s.svcCtx)
|
||||
func (s *UserManagementServer) Ping(ctx context.Context, in *user_management.Request) (*user_management.Response, error) {
|
||||
l := logic.NewPingLogic(ctx, s.svcCtx)
|
||||
return l.Ping(in)
|
||||
}
|
||||
|
||||
func (s *UserManagementServer) SetAppAccount(ctx context.Context, in *user_management2.SetAppUserRequest) (*user_management2.Response, error) {
|
||||
l := logic2.NewSetAppAccountLogic(ctx, s.svcCtx)
|
||||
return l.SetAppAccount(in)
|
||||
// SetUser 设置用户信息
|
||||
func (s *UserManagementServer) SetUser(ctx context.Context, in *user_management.SetUserRequest) (*user_management.SetUserResponse, error) {
|
||||
l := logic.NewSetUserLogic(ctx, s.svcCtx)
|
||||
return l.SetUser(in)
|
||||
}
|
||||
|
||||
// CreateUser 获取用户或者创建用户
|
||||
func (s *UserManagementServer) CreateUser(ctx context.Context, in *user_management.CreateUserRequest) (*user_management.UserId, error) {
|
||||
l := logic.NewCreateUserLogic(ctx, s.svcCtx)
|
||||
return l.CreateUser(in)
|
||||
}
|
||||
|
||||
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
||||
func (s *UserManagementServer) CreateEmptyUser(ctx context.Context, in *user_management.Empty) (*user_management.UserId, error) {
|
||||
l := logic.NewCreateEmptyUserLogic(ctx, s.svcCtx)
|
||||
return l.CreateEmptyUser(in)
|
||||
}
|
||||
|
||||
// GetUserById 通过 ID 获取用户
|
||||
func (s *UserManagementServer) GetUserById(ctx context.Context, in *user_management.UserId) (*user_management.User, error) {
|
||||
l := logic.NewGetUserByIdLogic(ctx, s.svcCtx)
|
||||
return l.GetUserById(in)
|
||||
}
|
||||
|
@ -1,15 +1,39 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/internal/config"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/gen/dao/query"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/id_gen"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/my_gorm"
|
||||
"github.com/sony/sonyflake"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
Query *query.Query
|
||||
IDGen *sonyflake.Sonyflake
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
svc := &ServiceContext{
|
||||
Config: c,
|
||||
IDGen: id_gen.New(),
|
||||
}
|
||||
|
||||
//初始化redis client
|
||||
redisClient := redis.NewClient(&redis.Options{
|
||||
Addr: c.Redis[0].Host,
|
||||
})
|
||||
//初始化数据库
|
||||
db, err := my_gorm.NewDBWithCache(mysql.Open(c.Mysql), &gorm.Config{}, redisClient)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
svc.Query = query.Use(db)
|
||||
return svc
|
||||
}
|
||||
|
@ -3,25 +3,29 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/internal/config"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/internal/server"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/server"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/user_management.yaml", "the config file")
|
||||
const ServiceName = "user_management"
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
err := config.GetConfig(&c, ServiceName)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
c.RpcServerConf.Name = ServiceName + ".rpc"
|
||||
|
||||
ctx := svc.NewServiceContext(c)
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
@ -33,6 +37,6 @@ func main() {
|
||||
})
|
||||
defer s.Stop()
|
||||
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
||||
fmt.Printf("Starting rpc server at %s...\n", c.RpcServerConf.ListenOn)
|
||||
s.Start()
|
||||
}
|
||||
|
@ -11,13 +11,45 @@ message Response {
|
||||
string pong = 1;
|
||||
}
|
||||
|
||||
message SetAppUserRequest{
|
||||
message SetUserRequest{
|
||||
uint64 UserId = 1;//用户id
|
||||
string Nickname = 2;//昵称
|
||||
string Avatar = 3;//头像
|
||||
}
|
||||
|
||||
message SetUserResponse{
|
||||
int64 RowsAffected = 1;
|
||||
}
|
||||
|
||||
message CreateUserRequest{
|
||||
string Nickname = 1;
|
||||
string Avatar = 2;
|
||||
}
|
||||
|
||||
service User_management {
|
||||
message UserId{
|
||||
uint64 UserId = 1;
|
||||
}
|
||||
|
||||
message Empty {}//空结构体
|
||||
|
||||
message User {
|
||||
uint64 ID = 1;
|
||||
string Nickname = 2;
|
||||
string Avatar = 3;
|
||||
}
|
||||
|
||||
service user_management {
|
||||
rpc Ping(Request) returns(Response);
|
||||
|
||||
rpc SetAppAccount (SetAppUserRequest) returns(Response);
|
||||
//SetUser 设置用户信息
|
||||
rpc SetUser (SetUserRequest) returns(SetUserResponse);
|
||||
|
||||
//CreateUser 获取用户或者创建用户
|
||||
rpc CreateUser(CreateUserRequest) returns(UserId);
|
||||
|
||||
//CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
||||
rpc CreateEmptyUser(Empty) returns(UserId);
|
||||
|
||||
//GetUserById 通过 ID 获取用户
|
||||
rpc GetUserById(UserId) returns(User);
|
||||
}
|
||||
|
@ -109,28 +109,29 @@ func (x *Response) GetPong() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type SetAppUserRequest struct {
|
||||
type SetUserRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Nickname string `protobuf:"bytes,1,opt,name=Nickname,proto3" json:"Nickname,omitempty"`
|
||||
Avatar string `protobuf:"bytes,2,opt,name=Avatar,proto3" json:"Avatar,omitempty"`
|
||||
UserId uint64 `protobuf:"varint,1,opt,name=UserId,proto3" json:"UserId,omitempty"` //用户id
|
||||
Nickname string `protobuf:"bytes,2,opt,name=Nickname,proto3" json:"Nickname,omitempty"` //昵称
|
||||
Avatar string `protobuf:"bytes,3,opt,name=Avatar,proto3" json:"Avatar,omitempty"` //头像
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SetAppUserRequest) Reset() {
|
||||
*x = SetAppUserRequest{}
|
||||
func (x *SetUserRequest) Reset() {
|
||||
*x = SetUserRequest{}
|
||||
mi := &file_user_management_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SetAppUserRequest) String() string {
|
||||
func (x *SetUserRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SetAppUserRequest) ProtoMessage() {}
|
||||
func (*SetUserRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SetAppUserRequest) ProtoReflect() protoreflect.Message {
|
||||
func (x *SetUserRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_management_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -142,19 +143,262 @@ func (x *SetAppUserRequest) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SetAppUserRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SetAppUserRequest) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use SetUserRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SetUserRequest) Descriptor() ([]byte, []int) {
|
||||
return file_user_management_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *SetAppUserRequest) GetNickname() string {
|
||||
func (x *SetUserRequest) GetUserId() uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *SetUserRequest) GetNickname() string {
|
||||
if x != nil {
|
||||
return x.Nickname
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SetAppUserRequest) GetAvatar() string {
|
||||
func (x *SetUserRequest) GetAvatar() string {
|
||||
if x != nil {
|
||||
return x.Avatar
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SetUserResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
RowsAffected int64 `protobuf:"varint,1,opt,name=RowsAffected,proto3" json:"RowsAffected,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SetUserResponse) Reset() {
|
||||
*x = SetUserResponse{}
|
||||
mi := &file_user_management_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SetUserResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SetUserResponse) ProtoMessage() {}
|
||||
|
||||
func (x *SetUserResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_management_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SetUserResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SetUserResponse) Descriptor() ([]byte, []int) {
|
||||
return file_user_management_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *SetUserResponse) GetRowsAffected() int64 {
|
||||
if x != nil {
|
||||
return x.RowsAffected
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type CreateUserRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Nickname string `protobuf:"bytes,1,opt,name=Nickname,proto3" json:"Nickname,omitempty"`
|
||||
Avatar string `protobuf:"bytes,2,opt,name=Avatar,proto3" json:"Avatar,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CreateUserRequest) Reset() {
|
||||
*x = CreateUserRequest{}
|
||||
mi := &file_user_management_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CreateUserRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateUserRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CreateUserRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_management_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CreateUserRequest) Descriptor() ([]byte, []int) {
|
||||
return file_user_management_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *CreateUserRequest) GetNickname() string {
|
||||
if x != nil {
|
||||
return x.Nickname
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateUserRequest) GetAvatar() string {
|
||||
if x != nil {
|
||||
return x.Avatar
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UserId struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId uint64 `protobuf:"varint,1,opt,name=UserId,proto3" json:"UserId,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UserId) Reset() {
|
||||
*x = UserId{}
|
||||
mi := &file_user_management_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UserId) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UserId) ProtoMessage() {}
|
||||
|
||||
func (x *UserId) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_management_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UserId.ProtoReflect.Descriptor instead.
|
||||
func (*UserId) Descriptor() ([]byte, []int) {
|
||||
return file_user_management_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *UserId) GetUserId() uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type Empty struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Empty) Reset() {
|
||||
*x = Empty{}
|
||||
mi := &file_user_management_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Empty) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Empty) ProtoMessage() {}
|
||||
|
||||
func (x *Empty) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_management_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Empty.ProtoReflect.Descriptor instead.
|
||||
func (*Empty) Descriptor() ([]byte, []int) {
|
||||
return file_user_management_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
type User struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
|
||||
Nickname string `protobuf:"bytes,2,opt,name=Nickname,proto3" json:"Nickname,omitempty"`
|
||||
Avatar string `protobuf:"bytes,3,opt,name=Avatar,proto3" json:"Avatar,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *User) Reset() {
|
||||
*x = User{}
|
||||
mi := &file_user_management_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *User) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*User) ProtoMessage() {}
|
||||
|
||||
func (x *User) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_management_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use User.ProtoReflect.Descriptor instead.
|
||||
func (*User) Descriptor() ([]byte, []int) {
|
||||
return file_user_management_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *User) GetID() uint64 {
|
||||
if x != nil {
|
||||
return x.ID
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *User) GetNickname() string {
|
||||
if x != nil {
|
||||
return x.Nickname
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *User) GetAvatar() string {
|
||||
if x != nil {
|
||||
return x.Avatar
|
||||
}
|
||||
@ -170,23 +414,53 @@ var file_user_management_proto_rawDesc = string([]byte{
|
||||
0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x04, 0x70, 0x69, 0x6e, 0x67, 0x22, 0x1e, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x22, 0x47, 0x0a, 0x11, 0x53, 0x65, 0x74, 0x41, 0x70,
|
||||
0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x76, 0x61, 0x74,
|
||||
0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72,
|
||||
0x32, 0x9e, 0x01, 0x0a, 0x0f, 0x55, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x2e, 0x75,
|
||||
0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61,
|
||||
0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x4e, 0x0a, 0x0d, 0x53, 0x65, 0x74, 0x41, 0x70, 0x70, 0x41, 0x63, 0x63, 0x6f, 0x75,
|
||||
0x6e, 0x74, 0x12, 0x22, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x74, 0x41, 0x70, 0x70, 0x55, 0x73, 0x65, 0x72, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61,
|
||||
0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x42, 0x13, 0x5a, 0x11, 0x2e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61,
|
||||
0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x09, 0x52, 0x04, 0x70, 0x6f, 0x6e, 0x67, 0x22, 0x5c, 0x0a, 0x0e, 0x53, 0x65, 0x74, 0x55, 0x73,
|
||||
0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65,
|
||||
0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49,
|
||||
0x64, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41,
|
||||
0x76, 0x61, 0x74, 0x61, 0x72, 0x22, 0x35, 0x0a, 0x0f, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x6f, 0x77, 0x73,
|
||||
0x41, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c,
|
||||
0x52, 0x6f, 0x77, 0x73, 0x41, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x22, 0x47, 0x0a, 0x11,
|
||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41,
|
||||
0x76, 0x61, 0x74, 0x61, 0x72, 0x22, 0x20, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52,
|
||||
0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79,
|
||||
0x22, 0x4a, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x6b,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x6b,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x32, 0xea, 0x02, 0x0a,
|
||||
0x0f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74,
|
||||
0x12, 0x3b, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f,
|
||||
0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a,
|
||||
0x07, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f,
|
||||
0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x74, 0x55, 0x73,
|
||||
0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x75, 0x73, 0x65, 0x72,
|
||||
0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x74, 0x55,
|
||||
0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x43,
|
||||
0x72, 0x65, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x75, 0x73, 0x65, 0x72,
|
||||
0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61,
|
||||
0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
|
||||
0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e,
|
||||
0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x42, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
|
||||
0x45, 0x6d, 0x70, 0x74, 0x79, 0x55, 0x73, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x75, 0x73, 0x65, 0x72,
|
||||
0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6d, 0x70, 0x74,
|
||||
0x79, 0x1a, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d,
|
||||
0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x0b, 0x47, 0x65,
|
||||
0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x79, 0x49, 0x64, 0x12, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72,
|
||||
0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73, 0x65, 0x72,
|
||||
0x49, 0x64, 0x1a, 0x15, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65,
|
||||
0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x42, 0x13, 0x5a, 0x11, 0x2e, 0x2f, 0x75,
|
||||
0x73, 0x65, 0x72, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
|
||||
var (
|
||||
@ -201,19 +475,30 @@ func file_user_management_proto_rawDescGZIP() []byte {
|
||||
return file_user_management_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_user_management_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_user_management_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_user_management_proto_goTypes = []any{
|
||||
(*Request)(nil), // 0: user_management.Request
|
||||
(*Response)(nil), // 1: user_management.Response
|
||||
(*SetAppUserRequest)(nil), // 2: user_management.SetAppUserRequest
|
||||
(*SetUserRequest)(nil), // 2: user_management.SetUserRequest
|
||||
(*SetUserResponse)(nil), // 3: user_management.SetUserResponse
|
||||
(*CreateUserRequest)(nil), // 4: user_management.CreateUserRequest
|
||||
(*UserId)(nil), // 5: user_management.UserId
|
||||
(*Empty)(nil), // 6: user_management.Empty
|
||||
(*User)(nil), // 7: user_management.User
|
||||
}
|
||||
var file_user_management_proto_depIdxs = []int32{
|
||||
0, // 0: user_management.User_management.Ping:input_type -> user_management.Request
|
||||
2, // 1: user_management.User_management.SetAppAccount:input_type -> user_management.SetAppUserRequest
|
||||
1, // 2: user_management.User_management.Ping:output_type -> user_management.Response
|
||||
1, // 3: user_management.User_management.SetAppAccount:output_type -> user_management.Response
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] is the sub-list for method input_type
|
||||
0, // 0: user_management.user_management.Ping:input_type -> user_management.Request
|
||||
2, // 1: user_management.user_management.SetUser:input_type -> user_management.SetUserRequest
|
||||
4, // 2: user_management.user_management.CreateUser:input_type -> user_management.CreateUserRequest
|
||||
6, // 3: user_management.user_management.CreateEmptyUser:input_type -> user_management.Empty
|
||||
5, // 4: user_management.user_management.GetUserById:input_type -> user_management.UserId
|
||||
1, // 5: user_management.user_management.Ping:output_type -> user_management.Response
|
||||
3, // 6: user_management.user_management.SetUser:output_type -> user_management.SetUserResponse
|
||||
5, // 7: user_management.user_management.CreateUser:output_type -> user_management.UserId
|
||||
5, // 8: user_management.user_management.CreateEmptyUser:output_type -> user_management.UserId
|
||||
7, // 9: user_management.user_management.GetUserById:output_type -> user_management.User
|
||||
5, // [5:10] is the sub-list for method output_type
|
||||
0, // [0:5] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
@ -230,7 +515,7 @@ func file_user_management_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_user_management_proto_rawDesc), len(file_user_management_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
@ -19,8 +19,11 @@ import (
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
UserManagement_Ping_FullMethodName = "/user_management.User_management/Ping"
|
||||
UserManagement_SetAppAccount_FullMethodName = "/user_management.User_management/SetAppAccount"
|
||||
UserManagement_Ping_FullMethodName = "/user_management.user_management/Ping"
|
||||
UserManagement_SetUser_FullMethodName = "/user_management.user_management/SetUser"
|
||||
UserManagement_CreateUser_FullMethodName = "/user_management.user_management/CreateUser"
|
||||
UserManagement_CreateEmptyUser_FullMethodName = "/user_management.user_management/CreateEmptyUser"
|
||||
UserManagement_GetUserById_FullMethodName = "/user_management.user_management/GetUserById"
|
||||
)
|
||||
|
||||
// UserManagementClient is the client API for UserManagement service.
|
||||
@ -28,7 +31,14 @@ const (
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type UserManagementClient interface {
|
||||
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
|
||||
SetAppAccount(ctx context.Context, in *SetAppUserRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
// SetUser 设置用户信息
|
||||
SetUser(ctx context.Context, in *SetUserRequest, opts ...grpc.CallOption) (*SetUserResponse, error)
|
||||
// CreateUser 获取用户或者创建用户
|
||||
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserId, error)
|
||||
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
||||
CreateEmptyUser(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserId, error)
|
||||
// GetUserById 通过 ID 获取用户
|
||||
GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
|
||||
}
|
||||
|
||||
type userManagementClient struct {
|
||||
@ -49,10 +59,40 @@ func (c *userManagementClient) Ping(ctx context.Context, in *Request, opts ...gr
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userManagementClient) SetAppAccount(ctx context.Context, in *SetAppUserRequest, opts ...grpc.CallOption) (*Response, error) {
|
||||
func (c *userManagementClient) SetUser(ctx context.Context, in *SetUserRequest, opts ...grpc.CallOption) (*SetUserResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, UserManagement_SetAppAccount_FullMethodName, in, out, cOpts...)
|
||||
out := new(SetUserResponse)
|
||||
err := c.cc.Invoke(ctx, UserManagement_SetUser_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userManagementClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserId, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(UserId)
|
||||
err := c.cc.Invoke(ctx, UserManagement_CreateUser_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userManagementClient) CreateEmptyUser(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserId, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(UserId)
|
||||
err := c.cc.Invoke(ctx, UserManagement_CreateEmptyUser_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userManagementClient) GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(User)
|
||||
err := c.cc.Invoke(ctx, UserManagement_GetUserById_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -64,7 +104,14 @@ func (c *userManagementClient) SetAppAccount(ctx context.Context, in *SetAppUser
|
||||
// for forward compatibility.
|
||||
type UserManagementServer interface {
|
||||
Ping(context.Context, *Request) (*Response, error)
|
||||
SetAppAccount(context.Context, *SetAppUserRequest) (*Response, error)
|
||||
// SetUser 设置用户信息
|
||||
SetUser(context.Context, *SetUserRequest) (*SetUserResponse, error)
|
||||
// CreateUser 获取用户或者创建用户
|
||||
CreateUser(context.Context, *CreateUserRequest) (*UserId, error)
|
||||
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
||||
CreateEmptyUser(context.Context, *Empty) (*UserId, error)
|
||||
// GetUserById 通过 ID 获取用户
|
||||
GetUserById(context.Context, *UserId) (*User, error)
|
||||
mustEmbedUnimplementedUserManagementServer()
|
||||
}
|
||||
|
||||
@ -78,8 +125,17 @@ type UnimplementedUserManagementServer struct{}
|
||||
func (UnimplementedUserManagementServer) Ping(context.Context, *Request) (*Response, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
|
||||
}
|
||||
func (UnimplementedUserManagementServer) SetAppAccount(context.Context, *SetAppUserRequest) (*Response, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetAppAccount not implemented")
|
||||
func (UnimplementedUserManagementServer) SetUser(context.Context, *SetUserRequest) (*SetUserResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetUser not implemented")
|
||||
}
|
||||
func (UnimplementedUserManagementServer) CreateUser(context.Context, *CreateUserRequest) (*UserId, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented")
|
||||
}
|
||||
func (UnimplementedUserManagementServer) CreateEmptyUser(context.Context, *Empty) (*UserId, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateEmptyUser not implemented")
|
||||
}
|
||||
func (UnimplementedUserManagementServer) GetUserById(context.Context, *UserId) (*User, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserById not implemented")
|
||||
}
|
||||
func (UnimplementedUserManagementServer) mustEmbedUnimplementedUserManagementServer() {}
|
||||
func (UnimplementedUserManagementServer) testEmbeddedByValue() {}
|
||||
@ -120,20 +176,74 @@ func _UserManagement_Ping_Handler(srv interface{}, ctx context.Context, dec func
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserManagement_SetAppAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetAppUserRequest)
|
||||
func _UserManagement_SetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetUserRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserManagementServer).SetAppAccount(ctx, in)
|
||||
return srv.(UserManagementServer).SetUser(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: UserManagement_SetAppAccount_FullMethodName,
|
||||
FullMethod: UserManagement_SetUser_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserManagementServer).SetAppAccount(ctx, req.(*SetAppUserRequest))
|
||||
return srv.(UserManagementServer).SetUser(ctx, req.(*SetUserRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserManagement_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateUserRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserManagementServer).CreateUser(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: UserManagement_CreateUser_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserManagementServer).CreateUser(ctx, req.(*CreateUserRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserManagement_CreateEmptyUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Empty)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserManagementServer).CreateEmptyUser(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: UserManagement_CreateEmptyUser_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserManagementServer).CreateEmptyUser(ctx, req.(*Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserManagement_GetUserById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UserId)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserManagementServer).GetUserById(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: UserManagement_GetUserById_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserManagementServer).GetUserById(ctx, req.(*UserId))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@ -142,7 +252,7 @@ func _UserManagement_SetAppAccount_Handler(srv interface{}, ctx context.Context,
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var UserManagement_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "user_management.User_management",
|
||||
ServiceName: "user_management.user_management",
|
||||
HandlerType: (*UserManagementServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
@ -150,8 +260,20 @@ var UserManagement_ServiceDesc = grpc.ServiceDesc{
|
||||
Handler: _UserManagement_Ping_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SetAppAccount",
|
||||
Handler: _UserManagement_SetAppAccount_Handler,
|
||||
MethodName: "SetUser",
|
||||
Handler: _UserManagement_SetUser_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateUser",
|
||||
Handler: _UserManagement_CreateUser_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CreateEmptyUser",
|
||||
Handler: _UserManagement_CreateEmptyUser_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUserById",
|
||||
Handler: _UserManagement_GetUserById_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
|
@ -6,20 +6,33 @@ package user_management_client
|
||||
|
||||
import (
|
||||
"context"
|
||||
user_management2 "gitea.youtukeji.com.cn/xiabin/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_management/user_management"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
Request = user_management2.Request
|
||||
Response = user_management2.Response
|
||||
SetAppUserRequest = user_management2.SetAppUserRequest
|
||||
CreateUserRequest = user_management.CreateUserRequest
|
||||
Empty = user_management.Empty
|
||||
Request = user_management.Request
|
||||
Response = user_management.Response
|
||||
SetUserRequest = user_management.SetUserRequest
|
||||
SetUserResponse = user_management.SetUserResponse
|
||||
User = user_management.User
|
||||
UserId = user_management.UserId
|
||||
|
||||
UserManagement interface {
|
||||
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
|
||||
SetAppAccount(ctx context.Context, in *SetAppUserRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
// SetUser 设置用户信息
|
||||
SetUser(ctx context.Context, in *SetUserRequest, opts ...grpc.CallOption) (*SetUserResponse, error)
|
||||
// CreateUser 获取用户或者创建用户
|
||||
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserId, error)
|
||||
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
||||
CreateEmptyUser(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserId, error)
|
||||
// GetUserById 通过 ID 获取用户
|
||||
GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
|
||||
}
|
||||
|
||||
defaultUserManagement struct {
|
||||
@ -34,11 +47,30 @@ func NewUserManagement(cli zrpc.Client) UserManagement {
|
||||
}
|
||||
|
||||
func (m *defaultUserManagement) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
|
||||
client := user_management2.NewUserManagementClient(m.cli.Conn())
|
||||
client := user_management.NewUserManagementClient(m.cli.Conn())
|
||||
return client.Ping(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultUserManagement) SetAppAccount(ctx context.Context, in *SetAppUserRequest, opts ...grpc.CallOption) (*Response, error) {
|
||||
client := user_management2.NewUserManagementClient(m.cli.Conn())
|
||||
return client.SetAppAccount(ctx, in, opts...)
|
||||
// SetUser 设置用户信息
|
||||
func (m *defaultUserManagement) SetUser(ctx context.Context, in *SetUserRequest, opts ...grpc.CallOption) (*SetUserResponse, error) {
|
||||
client := user_management.NewUserManagementClient(m.cli.Conn())
|
||||
return client.SetUser(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// CreateUser 获取用户或者创建用户
|
||||
func (m *defaultUserManagement) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserId, error) {
|
||||
client := user_management.NewUserManagementClient(m.cli.Conn())
|
||||
return client.CreateUser(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
|
||||
func (m *defaultUserManagement) CreateEmptyUser(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserId, error) {
|
||||
client := user_management.NewUserManagementClient(m.cli.Conn())
|
||||
return client.CreateEmptyUser(ctx, in, opts...)
|
||||
}
|
||||
|
||||
// GetUserById 通过 ID 获取用户
|
||||
func (m *defaultUserManagement) GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error) {
|
||||
client := user_management.NewUserManagementClient(m.cli.Conn())
|
||||
return client.GetUserById(ctx, in, opts...)
|
||||
}
|
||||
|
39
docker-compose.yaml
Normal file
39
docker-compose.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
version: "3"
|
||||
services:
|
||||
user:
|
||||
image: user_manager
|
||||
container_name: user
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
||||
network_mode: host
|
||||
|
||||
auth:
|
||||
image: auth_service
|
||||
container_name: auth
|
||||
depends_on:
|
||||
- user
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
||||
network_mode: host
|
||||
|
||||
douyin_ecpm_calculation:
|
||||
image: douyin_ecpm_calculation_service
|
||||
container_name: douyin_ecpm_calculation
|
||||
depends_on:
|
||||
- auth
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
||||
network_mode: host
|
||||
|
||||
ranking:
|
||||
image: ranking_management
|
||||
container_name: ranking
|
||||
depends_on:
|
||||
- auth
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
restart: always
|
||||
network_mode: host
|
49
go.mod
49
go.mod
@ -1,4 +1,4 @@
|
||||
module gitea.youtukeji.com.cn/xiabin/youtu_grpc
|
||||
module gitea.youtukeji.com.cn/youtu/youtu_grpc
|
||||
|
||||
go 1.23.4
|
||||
|
||||
@ -9,10 +9,14 @@ require (
|
||||
github.com/go-gorm/caches/v4 v4.0.5
|
||||
github.com/redis/go-redis/v9 v9.7.0
|
||||
github.com/silenceper/wechat/v2 v2.1.7
|
||||
github.com/sony/sonyflake v1.2.0
|
||||
github.com/spf13/viper v1.20.0-alpha.6
|
||||
github.com/spf13/viper/remote v1.20.0-alpha.6
|
||||
github.com/zeromicro/go-zero v1.8.0
|
||||
go.etcd.io/etcd/client/v3 v3.5.18
|
||||
google.golang.org/grpc v1.70.0
|
||||
google.golang.org/protobuf v1.36.5
|
||||
gorm.io/driver/mysql v1.5.7
|
||||
gorm.io/driver/sqlite v1.4.3
|
||||
gorm.io/gen v0.3.26
|
||||
gorm.io/gorm v1.25.12
|
||||
@ -20,7 +24,14 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.115.0 // indirect
|
||||
cloud.google.com/go/auth v0.7.2 // indirect
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.3 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.5.2 // indirect
|
||||
cloud.google.com/go/firestore v1.15.0 // indirect
|
||||
cloud.google.com/go/longrunning v0.5.9 // indirect
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/armon/go-metrics v0.4.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
@ -31,6 +42,8 @@ require (
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
@ -39,14 +52,28 @@ require (
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/go-redis/redis/v8 v8.11.5 // indirect
|
||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.0.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/gnostic-models v0.6.9 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/s2a-go v0.1.7 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.12.5 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0 // indirect
|
||||
github.com/hashicorp/consul/api v1.29.2 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-hclog v1.5.0 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/hashicorp/serf v0.10.1 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
@ -56,9 +83,14 @@ require (
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.15 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/nats-io/nats.go v1.36.0 // indirect
|
||||
github.com/nats-io/nkeys v0.4.7 // indirect
|
||||
github.com/nats-io/nuid v1.0.1 // indirect
|
||||
github.com/openzipkin/zipkin-go v0.4.3 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
@ -66,11 +98,22 @@ require (
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.62.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/sagikazarmark/crypt v0.24.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.6.0 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/afero v1.11.0 // indirect
|
||||
github.com/spf13/cast v1.7.1 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.18 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.18 // indirect
|
||||
go.etcd.io/etcd/client/v2 v2.305.15 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
|
||||
go.opentelemetry.io/otel v1.34.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect
|
||||
@ -86,6 +129,7 @@ require (
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/crypto v0.32.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
|
||||
golang.org/x/mod v0.21.0 // indirect
|
||||
golang.org/x/net v0.34.0 // indirect
|
||||
golang.org/x/oauth2 v0.26.0 // indirect
|
||||
@ -95,6 +139,8 @@ require (
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
golang.org/x/time v0.10.0 // indirect
|
||||
golang.org/x/tools v0.26.0 // indirect
|
||||
google.golang.org/api v0.189.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20240722135656-d784300faade // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250204164813-702378808489 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250204164813-702378808489 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||
@ -102,7 +148,6 @@ require (
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c // indirect
|
||||
gorm.io/driver/mysql v1.5.7 // indirect
|
||||
gorm.io/hints v1.1.0 // indirect
|
||||
k8s.io/api v0.32.1 // indirect
|
||||
k8s.io/apimachinery v0.32.1 // indirect
|
||||
|
285
go.sum
285
go.sum
@ -1,15 +1,43 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14=
|
||||
cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU=
|
||||
cloud.google.com/go/auth v0.7.2 h1:uiha352VrCDMXg+yoBtaD0tUF4Kv9vrtrWPYXwutnDE=
|
||||
cloud.google.com/go/auth v0.7.2/go.mod h1:VEc4p5NNxycWQTMQEDQF0bd6aTMb6VgYDXEwiJJQAbs=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.3 h1:MlxF+Pd3OmSudg/b1yZ5lJwoXCEaeedAguodky1PcKI=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.3/go.mod h1:tMQXOfZzFuNuUxOypHlQEXgdfX5cuhwU+ffUuXRJE8I=
|
||||
cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo=
|
||||
cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k=
|
||||
cloud.google.com/go/firestore v1.15.0 h1:/k8ppuWOtNuDHt2tsRV42yI21uaGnKDEQnRFeBpbFF8=
|
||||
cloud.google.com/go/firestore v1.15.0/go.mod h1:GWOxFXcv8GZUtYpWHw/w6IuYNux/BtmeVTMmjrm4yhk=
|
||||
cloud.google.com/go/longrunning v0.5.9 h1:haH9pAuXdPAMqHvzX0zlWQigXT7B0+CL4/2nXXdBo5k=
|
||||
cloud.google.com/go/longrunning v0.5.9/go.mod h1:HD+0l9/OOW0za6UWdKJtXoFAX/BGg/3Wj8p10NeWF7c=
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
gitea.youtukeji.com.cn/youtu/openapi-helper v0.0.0-20250123094517-b5871b3f4784 h1:Ey/s51gRB3rpN/TCXY1rAqZulktSlkdXrxyfBtnEtAc=
|
||||
gitea.youtukeji.com.cn/youtu/openapi-helper v0.0.0-20250123094517-b5871b3f4784/go.mod h1:o3XiYjUmxptrwcYPbTwNc2SQSOeOj7qbQPdNNVU0H5w=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
|
||||
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302 h1:uvdUDbHQHO85qeSydJtItA4T55Pw6BtAejd0APRJOCE=
|
||||
github.com/alicebob/gopher-json v0.0.0-20230218143504-906a9b012302/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
|
||||
github.com/alicebob/miniredis/v2 v2.30.0/go.mod h1:84TWKZlxYkfgMucPBf5SOQBYJceZeQRFIaQgNMiCX6Q=
|
||||
github.com/alicebob/miniredis/v2 v2.34.0 h1:mBFWMaJSNL9RwdGRyEDoAAv8OQc5UlEhLDQggTglU/0=
|
||||
github.com/alicebob/miniredis/v2 v2.34.0/go.mod h1:kWShP4b58T1CW0Y5dViCd5ztzrDqRWqM3nksiyXk5s8=
|
||||
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||
github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA=
|
||||
github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 h1:N7oVaKyGp8bttX0bfZGmcGkjz7DLQXhAn3DNd3T0ous=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874/go.mod h1:r5xuitiExdLAJ09PR7vBVENGvp4ZuTBeWTGtxuX3K+c=
|
||||
@ -19,12 +47,18 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
|
||||
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
||||
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
|
||||
@ -37,16 +71,32 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU=
|
||||
github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
|
||||
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
|
||||
github.com/go-gorm/caches/v4 v4.0.5 h1:Sdj9vxbEM0sCmv5+s5o6GzoVMuraWF0bjJJvUU+7c1U=
|
||||
github.com/go-gorm/caches/v4 v4.0.5/go.mod h1:Ms8LnWVoW4GkTofpDzFH8OfDGNTjLxQDyxBmRN67Ujw=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
@ -63,35 +113,54 @@ github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
||||
github.com/go-viper/mapstructure/v2 v2.0.0 h1:dhn8MZ1gZ0mzeodTG3jt5Vj/o87xZKuNAprG2mQfMfc=
|
||||
github.com/go-viper/mapstructure/v2 v2.0.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
|
||||
github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
|
||||
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=
|
||||
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
|
||||
github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw=
|
||||
github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
@ -102,12 +171,65 @@ github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
|
||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo=
|
||||
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
|
||||
github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o=
|
||||
github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
|
||||
github.com/googleapis/gax-go/v2 v2.12.5 h1:8gw9KZK8TiVKB6q3zHY3SBzLnrGp6HQjyfYBYGmXdxA=
|
||||
github.com/googleapis/gax-go/v2 v2.12.5/go.mod h1:BUDKcWo+RaKq5SC9vVYL0wLADa3VcfswbOMMRmB9H3E=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0 h1:VD1gqscl4nYs1YxVuSdemTrSgTKrwOWDK0FVFMqm+Cg=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.0/go.mod h1:4EgsQoS4TOhJizV+JTFg40qx1Ofh3XmXEQNBpgvNT40=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
|
||||
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
|
||||
github.com/hashicorp/consul/api v1.29.2 h1:aYyRn8EdE2mSfG14S1+L9Qkjtz8RzmaWh6AcNGRNwPw=
|
||||
github.com/hashicorp/consul/api v1.29.2/go.mod h1:0YObcaLNDSbtlgzIRtmRXI1ZkeuK0trCBxwZQ4MYnIk=
|
||||
github.com/hashicorp/consul/proto-public v0.6.2 h1:+DA/3g/IiKlJZb88NBn0ZgXrxJp2NlvCZdEyl+qxvL0=
|
||||
github.com/hashicorp/consul/proto-public v0.6.2/go.mod h1:cXXbOg74KBNGajC+o8RlA502Esf0R9prcoJgiOX/2Tg=
|
||||
github.com/hashicorp/consul/sdk v0.16.1 h1:V8TxTnImoPD5cj0U9Spl0TUxcytjcbbJeADFF07KdHg=
|
||||
github.com/hashicorp/consul/sdk v0.16.1/go.mod h1:fSXvwxB2hmh1FMZCNl6PwX0Q/1wdWtHJcZ7Ea5tns0s=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
||||
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
|
||||
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
|
||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI=
|
||||
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
|
||||
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
|
||||
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||
github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
|
||||
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
|
||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
||||
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI=
|
||||
github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
|
||||
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||
github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc=
|
||||
github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM=
|
||||
github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0=
|
||||
github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY=
|
||||
github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
|
||||
@ -134,36 +256,73 @@ github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
|
||||
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
||||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/microsoft/go-mssqldb v0.17.0 h1:Fto83dMZPnYv1Zwx5vHHxpNraeEaUlQ/hhHLgZiaenE=
|
||||
github.com/microsoft/go-mssqldb v0.17.0/go.mod h1:OkoNGhGEs8EZqchVTtochlXruEhEOaO4S0d2sB5aeGQ=
|
||||
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
|
||||
github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY=
|
||||
github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
|
||||
github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/nats-io/nats.go v1.36.0 h1:suEUPuWzTSse/XhESwqLxXGuj8vGRuPRoG7MoRN/qyU=
|
||||
github.com/nats-io/nats.go v1.36.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8=
|
||||
github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=
|
||||
github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDmGD0nc=
|
||||
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
@ -184,48 +343,98 @@ github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
|
||||
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
|
||||
github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg=
|
||||
github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
|
||||
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
|
||||
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
|
||||
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
||||
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
|
||||
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
||||
github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io=
|
||||
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
|
||||
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
|
||||
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
|
||||
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
||||
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/sagikazarmark/crypt v0.24.0 h1:v/RbcfZT1U6CfGXV+I1WUtWUgo3ewpoSBHyUT6qIGfY=
|
||||
github.com/sagikazarmark/crypt v0.24.0/go.mod h1:RNCCVzIbELuCbLqhzOubaxqLiWnijPEVKWe5UBtEsaQ=
|
||||
github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk=
|
||||
github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/silenceper/wechat/v2 v2.1.7 h1:v4AC4pa6NRm7Pa2FJnmWABOxZ9hx3IIo20xKT4t1msY=
|
||||
github.com/silenceper/wechat/v2 v2.1.7/go.mod h1:7Iu3EhQYVtDUJAj+ZVRy8yom75ga7aDWv8RurLkVm0s=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/sony/sonyflake v1.2.0 h1:Pfr3A+ejSg+0SPqpoAmQgEtNDAhc2G1SUYk205qVMLQ=
|
||||
github.com/sony/sonyflake v1.2.0/go.mod h1:LORtCywH/cq10ZbyfhKrHYgAUGH7mOBa76enV9txy/Y=
|
||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
||||
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
||||
github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y=
|
||||
github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.20.0-alpha.6 h1:f65Cr/+2qk4GfHC0xqT/isoupQppwN5+VLRztUGTDbY=
|
||||
github.com/spf13/viper v1.20.0-alpha.6/go.mod h1:CGBZzv0c9fOUASm6rfus4wdeIjR/04NOLq1P4KRhX3k=
|
||||
github.com/spf13/viper/remote v1.20.0-alpha.6 h1:xvDY9yLwWiKAdFU15+Z4ff/HzQqeyJCh5JEF6ivRMy8=
|
||||
github.com/spf13/viper/remote v1.20.0-alpha.6/go.mod h1:GFJYdnpIqUyn52xuN0INS1D4cJ5qajQaIuUgs6ixaBY=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
|
||||
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
@ -241,10 +450,18 @@ go.etcd.io/etcd/api/v3 v3.5.18 h1:Q4oDAKnmwqTo5lafvB+afbgCDF7E35E4EYV2g+FNGhs=
|
||||
go.etcd.io/etcd/api/v3 v3.5.18/go.mod h1:uY03Ob2H50077J7Qq0DeehjM/A9S8PhVfbQ1mSaMopU=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.18 h1:mZPOYw4h8rTk7TeJ5+3udUkfVGBqc+GCjOJYd68QgNM=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.18/go.mod h1:BxVf2o5wXG9ZJV+/Cu7QNUiJYk4A29sAhoI5tIRsCu4=
|
||||
go.etcd.io/etcd/client/v2 v2.305.15 h1:VG2xbf8Vz1KJh65Ar2V5eDmfkp1bpzkSEHlhJM3usp8=
|
||||
go.etcd.io/etcd/client/v2 v2.305.15/go.mod h1:Ad5dRjPVb/n5yXgAWQ/hXzuXXkBk0Y658ocuXYaUU48=
|
||||
go.etcd.io/etcd/client/v3 v3.5.18 h1:nvvYmNHGumkDjZhTHgVU36A9pykGa2K4lAJ0yY7hcXA=
|
||||
go.etcd.io/etcd/client/v3 v3.5.18/go.mod h1:kmemwOsPU9broExyhYsBxX4spCTDX3yLgPMWtpBXG6E=
|
||||
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 h1:4Pp6oUg3+e/6M4C0A/3kJ2VYa++dsWVTtGgLVj5xtHg=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw=
|
||||
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
|
||||
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4=
|
||||
@ -277,13 +494,21 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
|
||||
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ=
|
||||
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
@ -291,23 +516,35 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
|
||||
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=
|
||||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
|
||||
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE=
|
||||
golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@ -316,26 +553,43 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
|
||||
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||
@ -346,6 +600,7 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
|
||||
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
@ -356,6 +611,11 @@ golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||
golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4=
|
||||
golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
@ -369,10 +629,24 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.189.0 h1:equMo30LypAkdkLMBqfeIqtyAnlyig1JSZArl4XPwdI=
|
||||
google.golang.org/api v0.189.0/go.mod h1:FLWGJKb0hb+pU2j+rJqwbnsF+ym+fQs73rbJ+KAUgy8=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto v0.0.0-20240722135656-d784300faade h1:lKFsS7wpngDgSCeFn7MoLy+wBDQZ1UQIJD4UNM1Qvkg=
|
||||
google.golang.org/genproto v0.0.0-20240722135656-d784300faade/go.mod h1:FfBgJBJg9GcpPvKIuHSZ/aE1g2ecGL74upMzGZjiGEY=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250204164813-702378808489 h1:fCuMM4fowGzigT89NCIsW57Pk9k2D12MMi2ODn+Nk+o=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250204164813-702378808489/go.mod h1:iYONQfRdizDB8JJBybql13nArx91jcUk7zCXEsOofM4=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250204164813-702378808489 h1:5bKytslY8ViY0Cj/ewmRtrWHW64bNF03cAatUUFCdFI=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250204164813-702378808489/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ=
|
||||
google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
@ -380,12 +654,17 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
||||
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4=
|
||||
@ -397,8 +676,10 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
@ -428,6 +709,8 @@ gorm.io/hints v1.1.0 h1:Lp4z3rxREufSdxn4qmkK3TLDltrM10FLTHiuqwDPvXw=
|
||||
gorm.io/hints v1.1.0/go.mod h1:lKQ0JjySsPBj3uslFzY3JhYDtqEwzm+G1hv8rWujB6Y=
|
||||
gorm.io/plugin/dbresolver v1.5.3 h1:wFwINGZZmttuu9h7XpvbDHd8Lf9bb8GNzp/NpAMV2wU=
|
||||
gorm.io/plugin/dbresolver v1.5.3/go.mod h1:TSrVhaUg2DZAWP3PrHlDlITEJmNOkL0tFTjvTEsQ4XE=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
k8s.io/api v0.32.1 h1:f562zw9cy+GvXzXf0CKlVQ7yHJVYzLfL6JAS4kOAaOc=
|
||||
k8s.io/api v0.32.1/go.mod h1:/Yi/BqkuueW1BgpoePYBRdDYfjPF5sgTr5+YqDZra5k=
|
||||
k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs=
|
||||
|
58
pkg/config/get_config.go
Normal file
58
pkg/config/get_config.go
Normal file
@ -0,0 +1,58 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/spf13/viper"
|
||||
_ "github.com/spf13/viper/remote"
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
)
|
||||
|
||||
const (
|
||||
TypeKey = "CONFIG_TYPE" // 配置文件类型
|
||||
TypeEtcd = "etcd"
|
||||
TypeEnv = "env"
|
||||
|
||||
EtcdPrefix = "/youtu/"
|
||||
EtcdAddrKey = "ETCD_ADDR"
|
||||
)
|
||||
|
||||
type Redis struct {
|
||||
Host string `json:"host"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type AppAccount struct {
|
||||
AppId string `json:"appId"`
|
||||
Secret string `json:"secret"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
RpcServerConf zrpc.RpcServerConf
|
||||
Mode string
|
||||
Mysql string
|
||||
Redis []Redis
|
||||
}
|
||||
|
||||
func init() {
|
||||
viper.SetDefault(EtcdAddrKey, "192.168.0.47:2379")
|
||||
viper.SetDefault(TypeKey, TypeEtcd)
|
||||
}
|
||||
|
||||
func GetConfig(c *Config, serverName string) (err error) {
|
||||
err = viper.AddRemoteProvider("etcd3", viper.GetString(EtcdAddrKey), EtcdPrefix+serverName+".rpc")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
viper.SetConfigType("json") // because there is no file extension in a stream of bytes, supported extensions are "json", "toml", "yaml", "yml", "properties", "props", "prop", "env", "dotenv"
|
||||
err = viper.ReadRemoteConfig()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = viper.Unmarshal(&c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
c.RpcServerConf.Name = serverName + ".rpc"
|
||||
c.RpcServerConf.ServiceConf.Mode = c.Mode
|
||||
return
|
||||
}
|
44
pkg/config/get_config_test.go
Normal file
44
pkg/config/get_config_test.go
Normal file
@ -0,0 +1,44 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestGetConfig(t *testing.T) {
|
||||
type args struct {
|
||||
c *Config
|
||||
serverName string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
// TODO: Add test cases.
|
||||
{"test", args{c: &Config{}, serverName: "test"}, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if err := GetConfig(tt.args.c, tt.args.serverName); (err != nil) != tt.wantErr {
|
||||
t.Errorf("GetConfig() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenConfig(t *testing.T) {
|
||||
var c Config
|
||||
c.RpcServerConf.ListenOn = "0.0.0.0:8081"
|
||||
c.Mode = "dev"
|
||||
c.Mysql = "root:youtu!0113@tcp(192.168.0.47:3306)/ecpm?charset=utf8mb4&parseTime=True&loc=Local"
|
||||
c.Redis = []Redis{{Host: "192.168.0.47:6379"}}
|
||||
c.RpcServerConf.Etcd.Hosts = append(c.RpcServerConf.Etcd.Hosts, "192.168.0.47:2379")
|
||||
c.RpcServerConf.Etcd.Key = "user_management.rpc"
|
||||
b, err := json.Marshal(c)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fmt.Println(string(b))
|
||||
}
|
16
pkg/id_gen/sonyflake.go
Normal file
16
pkg/id_gen/sonyflake.go
Normal file
@ -0,0 +1,16 @@
|
||||
package id_gen
|
||||
|
||||
import (
|
||||
"github.com/sony/sonyflake"
|
||||
"time"
|
||||
)
|
||||
|
||||
var st = time.Date(2025, 2, 8, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
func New() (cli *sonyflake.Sonyflake) {
|
||||
return sonyflake.NewSonyflake(sonyflake.Settings{
|
||||
StartTime: st, //开始时间,早于当前时间,固定值
|
||||
MachineID: nil, //获取MachineID的函数,为空使用默认值
|
||||
CheckMachineID: nil, //获取CheckMachineID的函数,为空使用默认值
|
||||
})
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const TableNameAppUser = "app_user"
|
||||
|
||||
// AppUser mapped from table <app_user>
|
||||
type AppUser struct {
|
||||
ID uint64 `gorm:"column:id;type:bigint unsigned;primaryKey;autoIncrement:true;index:idx_app_user_id,priority:1" json:"id"`
|
||||
AppAccountID uint32 `gorm:"column:app_account_id;type:int unsigned;not null;uniqueIndex:app_account_id_open_id,priority:1;comment:app_account表外键" json:"app_account_id"` // app_account表外键
|
||||
Openid string `gorm:"column:openid;type:varchar(255);not null;uniqueIndex:app_account_id_open_id,priority:2" json:"openid"`
|
||||
Unionid string `gorm:"column:unionid;type:varchar(255);not null" json:"unionid"`
|
||||
Nickname string `gorm:"column:nickname;type:varchar(255);not null;comment:昵称" json:"nickname"` // 昵称
|
||||
Avatar string `gorm:"column:avatar;type:varchar(255);not null;comment:头像" json:"avatar"` // 头像
|
||||
AnonymousOpenid string `gorm:"column:anonymous_openid;type:varchar(255);not null;comment:匿名openid" json:"anonymous_openid"` // 匿名openid
|
||||
IsGetNicknameAndAvatar bool `gorm:"column:is_get_nickname_and_avatar;type:tinyint(1);not null;default:0;comment:是否获取到昵称和头像(初始化)" json:"is_get_nickname_and_avatar"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
}
|
||||
|
||||
// TableName AppUser's table name
|
||||
func (*AppUser) TableName() string {
|
||||
return TableNameAppUser
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package model
|
||||
|
||||
const TableNameDouyinEcpmConfig = "douyin_ecpm_config"
|
||||
|
||||
// DouyinEcpmConfig mapped from table <douyin_ecpm_config>
|
||||
type DouyinEcpmConfig struct {
|
||||
ID uint32 `gorm:"column:id;type:int unsigned;primaryKey;autoIncrement:true" json:"id"`
|
||||
AppAccountID uint32 `gorm:"column:app_account_id;type:int unsigned;not null;index:app_account_id,priority:1" json:"app_account_id"`
|
||||
EcpmValue uint32 `gorm:"column:ecpm_value;type:int unsigned;not null;comment:值" json:"ecpm_value"` // 值
|
||||
EcpmView uint32 `gorm:"column:ecpm_view;type:int unsigned;not null;comment:浏览次数" json:"ecpm_view"` // 浏览次数
|
||||
}
|
||||
|
||||
// TableName DouyinEcpmConfig's table name
|
||||
func (*DouyinEcpmConfig) TableName() string {
|
||||
return TableNameDouyinEcpmConfig
|
||||
}
|
@ -1,392 +0,0 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/model"
|
||||
)
|
||||
|
||||
func newDouyinEcpmConfig(db *gorm.DB, opts ...gen.DOOption) douyinEcpmConfig {
|
||||
_douyinEcpmConfig := douyinEcpmConfig{}
|
||||
|
||||
_douyinEcpmConfig.douyinEcpmConfigDo.UseDB(db, opts...)
|
||||
_douyinEcpmConfig.douyinEcpmConfigDo.UseModel(&model.DouyinEcpmConfig{})
|
||||
|
||||
tableName := _douyinEcpmConfig.douyinEcpmConfigDo.TableName()
|
||||
_douyinEcpmConfig.ALL = field.NewAsterisk(tableName)
|
||||
_douyinEcpmConfig.ID = field.NewUint32(tableName, "id")
|
||||
_douyinEcpmConfig.AppAccountID = field.NewUint32(tableName, "app_account_id")
|
||||
_douyinEcpmConfig.EcpmValue = field.NewUint32(tableName, "ecpm_value")
|
||||
_douyinEcpmConfig.EcpmView = field.NewUint32(tableName, "ecpm_view")
|
||||
|
||||
_douyinEcpmConfig.fillFieldMap()
|
||||
|
||||
return _douyinEcpmConfig
|
||||
}
|
||||
|
||||
type douyinEcpmConfig struct {
|
||||
douyinEcpmConfigDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Uint32
|
||||
AppAccountID field.Uint32
|
||||
EcpmValue field.Uint32
|
||||
EcpmView field.Uint32
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfig) Table(newTableName string) *douyinEcpmConfig {
|
||||
d.douyinEcpmConfigDo.UseTable(newTableName)
|
||||
return d.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfig) As(alias string) *douyinEcpmConfig {
|
||||
d.douyinEcpmConfigDo.DO = *(d.douyinEcpmConfigDo.As(alias).(*gen.DO))
|
||||
return d.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (d *douyinEcpmConfig) updateTableName(table string) *douyinEcpmConfig {
|
||||
d.ALL = field.NewAsterisk(table)
|
||||
d.ID = field.NewUint32(table, "id")
|
||||
d.AppAccountID = field.NewUint32(table, "app_account_id")
|
||||
d.EcpmValue = field.NewUint32(table, "ecpm_value")
|
||||
d.EcpmView = field.NewUint32(table, "ecpm_view")
|
||||
|
||||
d.fillFieldMap()
|
||||
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *douyinEcpmConfig) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := d.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (d *douyinEcpmConfig) fillFieldMap() {
|
||||
d.fieldMap = make(map[string]field.Expr, 4)
|
||||
d.fieldMap["id"] = d.ID
|
||||
d.fieldMap["app_account_id"] = d.AppAccountID
|
||||
d.fieldMap["ecpm_value"] = d.EcpmValue
|
||||
d.fieldMap["ecpm_view"] = d.EcpmView
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfig) clone(db *gorm.DB) douyinEcpmConfig {
|
||||
d.douyinEcpmConfigDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return d
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfig) replaceDB(db *gorm.DB) douyinEcpmConfig {
|
||||
d.douyinEcpmConfigDo.ReplaceDB(db)
|
||||
return d
|
||||
}
|
||||
|
||||
type douyinEcpmConfigDo struct{ gen.DO }
|
||||
|
||||
type IDouyinEcpmConfigDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IDouyinEcpmConfigDo
|
||||
WithContext(ctx context.Context) IDouyinEcpmConfigDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IDouyinEcpmConfigDo
|
||||
WriteDB() IDouyinEcpmConfigDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IDouyinEcpmConfigDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IDouyinEcpmConfigDo
|
||||
Not(conds ...gen.Condition) IDouyinEcpmConfigDo
|
||||
Or(conds ...gen.Condition) IDouyinEcpmConfigDo
|
||||
Select(conds ...field.Expr) IDouyinEcpmConfigDo
|
||||
Where(conds ...gen.Condition) IDouyinEcpmConfigDo
|
||||
Order(conds ...field.Expr) IDouyinEcpmConfigDo
|
||||
Distinct(cols ...field.Expr) IDouyinEcpmConfigDo
|
||||
Omit(cols ...field.Expr) IDouyinEcpmConfigDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IDouyinEcpmConfigDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IDouyinEcpmConfigDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IDouyinEcpmConfigDo
|
||||
Group(cols ...field.Expr) IDouyinEcpmConfigDo
|
||||
Having(conds ...gen.Condition) IDouyinEcpmConfigDo
|
||||
Limit(limit int) IDouyinEcpmConfigDo
|
||||
Offset(offset int) IDouyinEcpmConfigDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IDouyinEcpmConfigDo
|
||||
Unscoped() IDouyinEcpmConfigDo
|
||||
Create(values ...*model.DouyinEcpmConfig) error
|
||||
CreateInBatches(values []*model.DouyinEcpmConfig, batchSize int) error
|
||||
Save(values ...*model.DouyinEcpmConfig) error
|
||||
First() (*model.DouyinEcpmConfig, error)
|
||||
Take() (*model.DouyinEcpmConfig, error)
|
||||
Last() (*model.DouyinEcpmConfig, error)
|
||||
Find() ([]*model.DouyinEcpmConfig, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.DouyinEcpmConfig, err error)
|
||||
FindInBatches(result *[]*model.DouyinEcpmConfig, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.DouyinEcpmConfig) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IDouyinEcpmConfigDo
|
||||
Assign(attrs ...field.AssignExpr) IDouyinEcpmConfigDo
|
||||
Joins(fields ...field.RelationField) IDouyinEcpmConfigDo
|
||||
Preload(fields ...field.RelationField) IDouyinEcpmConfigDo
|
||||
FirstOrInit() (*model.DouyinEcpmConfig, error)
|
||||
FirstOrCreate() (*model.DouyinEcpmConfig, error)
|
||||
FindByPage(offset int, limit int) (result []*model.DouyinEcpmConfig, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IDouyinEcpmConfigDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Debug() IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Debug())
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) WithContext(ctx context.Context) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) ReadDB() IDouyinEcpmConfigDo {
|
||||
return d.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) WriteDB() IDouyinEcpmConfigDo {
|
||||
return d.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Session(config *gorm.Session) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Session(config))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Clauses(conds ...clause.Expression) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Returning(value interface{}, columns ...string) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Not(conds ...gen.Condition) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Or(conds ...gen.Condition) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Select(conds ...field.Expr) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Where(conds ...gen.Condition) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Order(conds ...field.Expr) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Distinct(cols ...field.Expr) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Omit(cols ...field.Expr) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Join(table schema.Tabler, on ...field.Expr) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) LeftJoin(table schema.Tabler, on ...field.Expr) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) RightJoin(table schema.Tabler, on ...field.Expr) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Group(cols ...field.Expr) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Having(conds ...gen.Condition) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Limit(limit int) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Offset(offset int) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Unscoped() IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Create(values ...*model.DouyinEcpmConfig) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return d.DO.Create(values)
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) CreateInBatches(values []*model.DouyinEcpmConfig, batchSize int) error {
|
||||
return d.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (d douyinEcpmConfigDo) Save(values ...*model.DouyinEcpmConfig) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return d.DO.Save(values)
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) First() (*model.DouyinEcpmConfig, error) {
|
||||
if result, err := d.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.DouyinEcpmConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Take() (*model.DouyinEcpmConfig, error) {
|
||||
if result, err := d.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.DouyinEcpmConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Last() (*model.DouyinEcpmConfig, error) {
|
||||
if result, err := d.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.DouyinEcpmConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Find() ([]*model.DouyinEcpmConfig, error) {
|
||||
result, err := d.DO.Find()
|
||||
return result.([]*model.DouyinEcpmConfig), err
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.DouyinEcpmConfig, err error) {
|
||||
buf := make([]*model.DouyinEcpmConfig, 0, batchSize)
|
||||
err = d.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) FindInBatches(result *[]*model.DouyinEcpmConfig, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return d.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Attrs(attrs ...field.AssignExpr) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Assign(attrs ...field.AssignExpr) IDouyinEcpmConfigDo {
|
||||
return d.withDO(d.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Joins(fields ...field.RelationField) IDouyinEcpmConfigDo {
|
||||
for _, _f := range fields {
|
||||
d = *d.withDO(d.DO.Joins(_f))
|
||||
}
|
||||
return &d
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Preload(fields ...field.RelationField) IDouyinEcpmConfigDo {
|
||||
for _, _f := range fields {
|
||||
d = *d.withDO(d.DO.Preload(_f))
|
||||
}
|
||||
return &d
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) FirstOrInit() (*model.DouyinEcpmConfig, error) {
|
||||
if result, err := d.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.DouyinEcpmConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) FirstOrCreate() (*model.DouyinEcpmConfig, error) {
|
||||
if result, err := d.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.DouyinEcpmConfig), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) FindByPage(offset int, limit int) (result []*model.DouyinEcpmConfig, count int64, err error) {
|
||||
result, err = d.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = d.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = d.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = d.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Scan(result interface{}) (err error) {
|
||||
return d.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (d douyinEcpmConfigDo) Delete(models ...*model.DouyinEcpmConfig) (result gen.ResultInfo, err error) {
|
||||
return d.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (d *douyinEcpmConfigDo) withDO(do gen.Dao) *douyinEcpmConfigDo {
|
||||
d.DO = *do.(*gen.DO)
|
||||
return d
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/gen/dao/model"
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
func init() {
|
||||
InitializeDB()
|
||||
err := _gen_test_db.AutoMigrate(&model.DouyinEcpmConfig{})
|
||||
if err != nil {
|
||||
fmt.Printf("Error: AutoMigrate(&model.DouyinEcpmConfig{}) fail: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_douyinEcpmConfigQuery(t *testing.T) {
|
||||
douyinEcpmConfig := newDouyinEcpmConfig(_gen_test_db)
|
||||
douyinEcpmConfig = *douyinEcpmConfig.As(douyinEcpmConfig.TableName())
|
||||
_do := douyinEcpmConfig.WithContext(context.Background()).Debug()
|
||||
|
||||
primaryKey := field.NewString(douyinEcpmConfig.TableName(), clause.PrimaryKey)
|
||||
_, err := _do.Unscoped().Where(primaryKey.IsNotNull()).Delete()
|
||||
if err != nil {
|
||||
t.Error("clean table <douyin_ecpm_config> fail:", err)
|
||||
return
|
||||
}
|
||||
|
||||
_, ok := douyinEcpmConfig.GetFieldByName("")
|
||||
if ok {
|
||||
t.Error("GetFieldByName(\"\") from douyinEcpmConfig success")
|
||||
}
|
||||
|
||||
err = _do.Create(&model.DouyinEcpmConfig{})
|
||||
if err != nil {
|
||||
t.Error("create item in table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
err = _do.Save(&model.DouyinEcpmConfig{})
|
||||
if err != nil {
|
||||
t.Error("create item in table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
err = _do.CreateInBatches([]*model.DouyinEcpmConfig{{}, {}}, 10)
|
||||
if err != nil {
|
||||
t.Error("create item in table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Select(douyinEcpmConfig.ALL).Take()
|
||||
if err != nil {
|
||||
t.Error("Take() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.First()
|
||||
if err != nil {
|
||||
t.Error("First() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Last()
|
||||
if err != nil {
|
||||
t.Error("First() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Where(primaryKey.IsNotNull()).FindInBatch(10, func(tx gen.Dao, batch int) error { return nil })
|
||||
if err != nil {
|
||||
t.Error("FindInBatch() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
err = _do.Where(primaryKey.IsNotNull()).FindInBatches(&[]*model.DouyinEcpmConfig{}, 10, func(tx gen.Dao, batch int) error { return nil })
|
||||
if err != nil {
|
||||
t.Error("FindInBatches() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Select(douyinEcpmConfig.ALL).Where(primaryKey.IsNotNull()).Order(primaryKey.Desc()).Find()
|
||||
if err != nil {
|
||||
t.Error("Find() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Distinct(primaryKey).Take()
|
||||
if err != nil {
|
||||
t.Error("select Distinct() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Select(douyinEcpmConfig.ALL).Omit(primaryKey).Take()
|
||||
if err != nil {
|
||||
t.Error("Omit() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Group(primaryKey).Find()
|
||||
if err != nil {
|
||||
t.Error("Group() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Scopes(func(dao gen.Dao) gen.Dao { return dao.Where(primaryKey.IsNotNull()) }).Find()
|
||||
if err != nil {
|
||||
t.Error("Scopes() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, _, err = _do.FindByPage(0, 1)
|
||||
if err != nil {
|
||||
t.Error("FindByPage() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.ScanByPage(&model.DouyinEcpmConfig{}, 0, 1)
|
||||
if err != nil {
|
||||
t.Error("ScanByPage() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrInit()
|
||||
if err != nil {
|
||||
t.Error("FirstOrInit() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Attrs(primaryKey).Assign(primaryKey).FirstOrCreate()
|
||||
if err != nil {
|
||||
t.Error("FirstOrCreate() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
var _a _another
|
||||
var _aPK = field.NewString(_a.TableName(), "id")
|
||||
|
||||
err = _do.Join(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{})
|
||||
if err != nil {
|
||||
t.Error("Join() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
err = _do.LeftJoin(&_a, primaryKey.EqCol(_aPK)).Scan(map[string]interface{}{})
|
||||
if err != nil {
|
||||
t.Error("LeftJoin() on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
|
||||
_, err = _do.Not().Or().Clauses().Take()
|
||||
if err != nil {
|
||||
t.Error("Not/Or/Clauses on table <douyin_ecpm_config> fail:", err)
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package my_gorm
|
||||
|
||||
import (
|
||||
redisCacher "gitea.youtukeji.com.cn/xiabin/youtu_grpc/pkg/my_gorm/redis"
|
||||
redisCacher "gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/my_gorm/redis"
|
||||
"github.com/go-gorm/caches/v4"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"gorm.io/gorm"
|
||||
|
Loading…
x
Reference in New Issue
Block a user