refactor: centralize protobuf and remove go-zero
This commit is contained in:
@@ -1,166 +0,0 @@
|
||||
# 更新日志
|
||||
|
||||
本文档记录了Initial Service项目的所有重要更改。
|
||||
|
||||
## [优化版本] - 2024-10-02
|
||||
|
||||
### 🚀 新增功能
|
||||
- **缓存系统**: 新增Redis缓存服务,提升API响应性能
|
||||
- **Docker支持**: 完整的容器化部署方案
|
||||
- **Makefile**: 完善的构建和开发工具链
|
||||
- **健康检查**: 增强的服务健康监控
|
||||
- **错误处理**: 完善的错误码定义和处理机制
|
||||
|
||||
### 🔧 优化改进
|
||||
- **输入验证**: 所有API接口增加严格的输入参数验证
|
||||
- **数据库查询**: 优化查询逻辑,添加索引和排序
|
||||
- **配置管理**: 改进配置优先级处理和去重机制
|
||||
- **版本检查**: 增强版本比较算法和更新文件管理
|
||||
- **地区数据**: 优化层级查询和默认参数处理
|
||||
- **测试代码**: 重构测试代码,提升测试覆盖率
|
||||
|
||||
### 🐛 修复问题
|
||||
- 修复Go版本兼容性问题
|
||||
- 修复数据类型不匹配问题
|
||||
- 修复循环导入问题
|
||||
- 修复测试代码中的导入错误
|
||||
- 修复数据库查询中的参数绑定问题
|
||||
|
||||
### 📚 文档更新
|
||||
- **README.md**: 全面重写,添加详细的使用指南
|
||||
- **API文档**: 完善接口说明和示例
|
||||
- **部署文档**: 添加Docker和Kubernetes部署指南
|
||||
- **开发文档**: 添加开发环境设置和贡献指南
|
||||
|
||||
### 🏗️ 架构改进
|
||||
- **缓存层**: 新增缓存抽象层,支持多种缓存策略
|
||||
- **错误处理**: 统一错误码和错误处理机制
|
||||
- **配置管理**: 优化配置加载和验证逻辑
|
||||
- **服务发现**: 支持微服务注册和发现
|
||||
|
||||
### 🔒 安全增强
|
||||
- **输入验证**: 严格的参数校验和类型检查
|
||||
- **错误信息**: 避免敏感信息泄露
|
||||
- **连接安全**: 支持TLS加密连接
|
||||
- **权限控制**: 预留权限验证接口
|
||||
|
||||
### 📊 性能优化
|
||||
- **缓存策略**: 多层缓存提升响应速度
|
||||
- **数据库优化**: 查询优化和索引建立
|
||||
- **连接池**: 合理的数据库连接池配置
|
||||
- **内存管理**: 优化内存使用和垃圾回收
|
||||
|
||||
### 🛠️ 开发工具
|
||||
- **Makefile**: 完整的构建、测试、部署工具链
|
||||
- **Docker**: 标准化的容器化部署
|
||||
- **CI/CD**: 改进的持续集成和部署流程
|
||||
- **代码检查**: 集成代码质量检查工具
|
||||
|
||||
### 📦 依赖更新
|
||||
- 更新所有Go依赖到最新稳定版本
|
||||
- 优化依赖管理和模块结构
|
||||
- 移除未使用的依赖包
|
||||
|
||||
### 🧪 测试改进
|
||||
- **单元测试**: 增加核心逻辑单元测试
|
||||
- **集成测试**: 完善gRPC接口集成测试
|
||||
- **性能测试**: 添加性能基准测试
|
||||
- **覆盖率**: 提升测试覆盖率到80%+
|
||||
|
||||
---
|
||||
|
||||
## 升级指南
|
||||
|
||||
### 从旧版本升级
|
||||
|
||||
1. **备份数据**
|
||||
```bash
|
||||
make backup-db
|
||||
```
|
||||
|
||||
2. **更新代码**
|
||||
```bash
|
||||
git pull origin main
|
||||
make deps
|
||||
```
|
||||
|
||||
3. **重新构建**
|
||||
```bash
|
||||
make build
|
||||
```
|
||||
|
||||
4. **更新配置**
|
||||
- 检查配置文件格式变更
|
||||
- 更新环境变量设置
|
||||
|
||||
5. **重启服务**
|
||||
```bash
|
||||
make docker-compose-down
|
||||
make docker-compose-up
|
||||
```
|
||||
|
||||
### 配置迁移
|
||||
|
||||
- Redis缓存配置现在是必需的
|
||||
- 数据库连接字符串格式保持不变
|
||||
- 新增APM监控配置(可选)
|
||||
|
||||
### API兼容性
|
||||
|
||||
- 所有现有API保持向后兼容
|
||||
- 响应格式保持不变
|
||||
- 新增输入验证可能影响无效请求
|
||||
|
||||
---
|
||||
|
||||
## 贡献者
|
||||
|
||||
- **David Yan** - 项目维护者和主要开发者
|
||||
- **BSM Team** - 代码审查和测试
|
||||
|
||||
---
|
||||
|
||||
## 技术栈
|
||||
|
||||
- **语言**: Go 1.25.1
|
||||
- **框架**: gRPC + HTTP Gateway
|
||||
- **数据库**: PostgreSQL 12+
|
||||
- **缓存**: Redis 6+
|
||||
- **容器**: Docker + Docker Compose
|
||||
- **构建**: Makefile + Buf
|
||||
- **监控**: ElasticAPM (可选)
|
||||
|
||||
---
|
||||
|
||||
## 性能指标
|
||||
|
||||
### 优化前后对比
|
||||
|
||||
| 指标 | 优化前 | 优化后 | 提升 |
|
||||
|------|--------|--------|------|
|
||||
| 配置查询 | 50ms | 5ms | 90% |
|
||||
| 国家数据 | 100ms | 10ms | 90% |
|
||||
| 地区数据 | 200ms | 20ms | 90% |
|
||||
| 内存使用 | 100MB | 80MB | 20% |
|
||||
| 启动时间 | 10s | 5s | 50% |
|
||||
|
||||
### 缓存命中率
|
||||
|
||||
- 配置数据: 95%+
|
||||
- 国家数据: 99%+
|
||||
- 地区数据: 90%+
|
||||
- 系统数据: 95%+
|
||||
|
||||
---
|
||||
|
||||
## 已知问题
|
||||
|
||||
目前没有已知的重大问题。
|
||||
|
||||
## 计划功能
|
||||
|
||||
- [ ] GraphQL API支持
|
||||
- [ ] 配置热更新
|
||||
- [ ] 多语言支持
|
||||
- [ ] 实时数据同步
|
||||
- [ ] 高级缓存策略
|
||||
@@ -1,73 +0,0 @@
|
||||
# 使用官方Go镜像作为构建环境
|
||||
FROM golang:1.26.5-alpine AS builder
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 安装必要的工具
|
||||
RUN apk add --no-cache git ca-certificates tzdata
|
||||
|
||||
# 设置Go环境变量
|
||||
ENV GO111MODULE=on \
|
||||
GOPROXY=https://goproxy.cn,direct \
|
||||
GOPRIVATE=git.apinb.com/* \
|
||||
GONOPROXY=git.apinb.com/* \
|
||||
GOINSECURE=git.apinb.com/* \
|
||||
GONOSUMDB=git.apinb.com/* \
|
||||
GOEXPERIMENT=jsonv2
|
||||
|
||||
# 复制go.mod和go.sum文件
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
# 下载依赖
|
||||
RUN go mod download
|
||||
|
||||
# 复制源代码
|
||||
COPY . .
|
||||
|
||||
# 构建应用
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||
-ldflags='-w -s -extldflags "-static"' \
|
||||
-a -installsuffix cgo \
|
||||
-o initial \
|
||||
./cmd/main/main.go
|
||||
|
||||
# 使用最小的alpine镜像作为运行环境
|
||||
FROM alpine:latest
|
||||
|
||||
# 安装必要的包
|
||||
RUN apk --no-cache add ca-certificates tzdata
|
||||
|
||||
# 设置时区
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
# 创建非root用户
|
||||
RUN addgroup -g 1001 -S appgroup && \
|
||||
adduser -u 1001 -S appuser -G appgroup
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 从构建阶段复制二进制文件
|
||||
COPY --from=builder /app/initial .
|
||||
|
||||
# 复制配置文件和其他必要文件
|
||||
COPY --from=builder /app/etc ./etc
|
||||
COPY --from=builder /app/swagger ./swagger
|
||||
|
||||
# 创建日志目录
|
||||
RUN mkdir -p /app/logs && \
|
||||
chown -R appuser:appgroup /app
|
||||
|
||||
# 切换到非root用户
|
||||
USER appuser
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 12101 12102
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:12102/health || exit 1
|
||||
|
||||
# 启动应用
|
||||
CMD ["./initial"]
|
||||
@@ -1,211 +0,0 @@
|
||||
# Initial Service Makefile
|
||||
|
||||
# 变量定义
|
||||
APP_NAME := initial
|
||||
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "v1.0.0")
|
||||
BUILD_TIME := $(shell date +%Y-%m-%d\ %H:%M:%S)
|
||||
GIT_COMMIT := $(shell git rev-parse HEAD 2>/dev/null || echo "unknown")
|
||||
GO_VERSION := $(shell go version | awk '{print $$3}')
|
||||
|
||||
# 构建标志
|
||||
LDFLAGS := -ldflags "-X main.Version=$(VERSION) -X main.BuildTime=$(BUILD_TIME) -X main.GitCommit=$(GIT_COMMIT) -w -s"
|
||||
BUILD_FLAGS := -trimpath $(LDFLAGS)
|
||||
|
||||
# 目录
|
||||
BUILD_DIR := build
|
||||
PROTO_DIR := proto
|
||||
PB_DIR := pb
|
||||
|
||||
# Go环境变量
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://goproxy.cn,direct
|
||||
export GOPRIVATE=git.apinb.com/*
|
||||
export GONOPROXY=git.apinb.com/*
|
||||
export GOINSECURE=git.apinb.com/*
|
||||
export GONOSUMDB=git.apinb.com/*
|
||||
export GOEXPERIMENT=jsonv2
|
||||
|
||||
.PHONY: help
|
||||
help: ## 显示帮助信息
|
||||
@echo "Initial Service - 可用的命令:"
|
||||
@echo ""
|
||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||
|
||||
.PHONY: deps
|
||||
deps: ## 下载依赖
|
||||
@echo "下载Go依赖..."
|
||||
go mod download
|
||||
go mod tidy
|
||||
|
||||
.PHONY: proto
|
||||
proto: ## 生成protobuf代码
|
||||
@echo "生成protobuf代码..."
|
||||
buf generate
|
||||
|
||||
.PHONY: build
|
||||
build: deps ## 构建应用
|
||||
@echo "构建应用..."
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 go build $(BUILD_FLAGS) -o $(BUILD_DIR)/$(APP_NAME) ./cmd/main/main.go
|
||||
@echo "构建完成: $(BUILD_DIR)/$(APP_NAME)"
|
||||
|
||||
.PHONY: build-linux
|
||||
build-linux: deps ## 构建Linux版本
|
||||
@echo "构建Linux版本..."
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(BUILD_FLAGS) -o $(BUILD_DIR)/$(APP_NAME)-linux-amd64 ./cmd/main/main.go
|
||||
@echo "构建完成: $(BUILD_DIR)/$(APP_NAME)-linux-amd64"
|
||||
|
||||
.PHONY: build-windows
|
||||
build-windows: deps ## 构建Windows版本
|
||||
@echo "构建Windows版本..."
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(BUILD_FLAGS) -o $(BUILD_DIR)/$(APP_NAME)-windows-amd64.exe ./cmd/main/main.go
|
||||
@echo "构建完成: $(BUILD_DIR)/$(APP_NAME)-windows-amd64.exe"
|
||||
|
||||
.PHONY: build-darwin
|
||||
build-darwin: deps ## 构建macOS版本
|
||||
@echo "构建macOS版本..."
|
||||
@mkdir -p $(BUILD_DIR)
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(BUILD_FLAGS) -o $(BUILD_DIR)/$(APP_NAME)-darwin-amd64 ./cmd/main/main.go
|
||||
@echo "构建完成: $(BUILD_DIR)/$(APP_NAME)-darwin-amd64"
|
||||
|
||||
.PHONY: build-all
|
||||
build-all: build-linux build-windows build-darwin ## 构建所有平台版本
|
||||
|
||||
.PHONY: run
|
||||
run: build ## 运行应用
|
||||
@echo "启动应用..."
|
||||
./$(BUILD_DIR)/$(APP_NAME)
|
||||
|
||||
.PHONY: dev
|
||||
dev: ## 开发模式运行
|
||||
@echo "开发模式启动..."
|
||||
go run ./cmd/main/main.go
|
||||
|
||||
.PHONY: test
|
||||
test: ## 运行测试
|
||||
@echo "运行测试..."
|
||||
go test -v ./...
|
||||
|
||||
.PHONY: test-coverage
|
||||
test-coverage: ## 运行测试并生成覆盖率报告
|
||||
@echo "运行测试覆盖率..."
|
||||
go test -v -coverprofile=coverage.out ./...
|
||||
go tool cover -html=coverage.out -o coverage.html
|
||||
@echo "覆盖率报告生成: coverage.html"
|
||||
|
||||
.PHONY: test-grpc
|
||||
test-grpc: ## 运行gRPC测试
|
||||
@echo "运行gRPC测试..."
|
||||
go run ./test/grpc/main.go
|
||||
|
||||
.PHONY: lint
|
||||
lint: ## 运行代码检查
|
||||
@echo "运行代码检查..."
|
||||
@if command -v golangci-lint >/dev/null 2>&1; then \
|
||||
golangci-lint run; \
|
||||
else \
|
||||
echo "golangci-lint 未安装,使用go vet..."; \
|
||||
go vet ./...; \
|
||||
fi
|
||||
|
||||
.PHONY: fmt
|
||||
fmt: ## 格式化代码
|
||||
@echo "格式化代码..."
|
||||
go fmt ./...
|
||||
@if command -v goimports >/dev/null 2>&1; then \
|
||||
goimports -w .; \
|
||||
fi
|
||||
|
||||
.PHONY: security
|
||||
security: ## 安全检查
|
||||
@echo "运行安全检查..."
|
||||
@if command -v gosec >/dev/null 2>&1; then \
|
||||
gosec ./...; \
|
||||
else \
|
||||
echo "gosec 未安装,请运行: go install github.com/securego/gosec/v2/cmd/gosec@latest"; \
|
||||
fi
|
||||
|
||||
.PHONY: docker-build
|
||||
docker-build: ## 构建Docker镜像
|
||||
@echo "构建Docker镜像..."
|
||||
docker build -t $(APP_NAME):$(VERSION) .
|
||||
docker tag $(APP_NAME):$(VERSION) $(APP_NAME):latest
|
||||
|
||||
.PHONY: docker-run
|
||||
docker-run: ## 运行Docker容器
|
||||
@echo "运行Docker容器..."
|
||||
docker run -d --name $(APP_NAME) -p 12101:12101 -p 12102:12102 $(APP_NAME):latest
|
||||
|
||||
.PHONY: docker-stop
|
||||
docker-stop: ## 停止Docker容器
|
||||
@echo "停止Docker容器..."
|
||||
docker stop $(APP_NAME) || true
|
||||
docker rm $(APP_NAME) || true
|
||||
|
||||
.PHONY: docker-compose-up
|
||||
docker-compose-up: ## 启动docker-compose服务
|
||||
@echo "启动docker-compose服务..."
|
||||
docker-compose up -d
|
||||
|
||||
.PHONY: docker-compose-down
|
||||
docker-compose-down: ## 停止docker-compose服务
|
||||
@echo "停止docker-compose服务..."
|
||||
docker-compose down
|
||||
|
||||
.PHONY: docker-compose-logs
|
||||
docker-compose-logs: ## 查看docker-compose日志
|
||||
docker-compose logs -f
|
||||
|
||||
.PHONY: clean
|
||||
clean: ## 清理构建文件
|
||||
@echo "清理构建文件..."
|
||||
rm -rf $(BUILD_DIR)
|
||||
rm -f coverage.out coverage.html
|
||||
docker system prune -f
|
||||
|
||||
.PHONY: install-tools
|
||||
install-tools: ## 安装开发工具
|
||||
@echo "安装开发工具..."
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
go install github.com/securego/gosec/v2/cmd/gosec@latest
|
||||
go install github.com/bufbuild/buf/cmd/buf@latest
|
||||
|
||||
.PHONY: mod-update
|
||||
mod-update: ## 更新依赖
|
||||
@echo "更新依赖..."
|
||||
go get -u ./...
|
||||
go mod tidy
|
||||
|
||||
.PHONY: version
|
||||
version: ## 显示版本信息
|
||||
@echo "应用名称: $(APP_NAME)"
|
||||
@echo "版本: $(VERSION)"
|
||||
@echo "构建时间: $(BUILD_TIME)"
|
||||
@echo "Git提交: $(GIT_COMMIT)"
|
||||
@echo "Go版本: $(GO_VERSION)"
|
||||
|
||||
.PHONY: swagger
|
||||
swagger: ## 生成Swagger文档
|
||||
@echo "Swagger文档已通过protobuf生成在swagger目录"
|
||||
|
||||
.PHONY: init-db
|
||||
init-db: ## 初始化数据库
|
||||
@echo "初始化数据库..."
|
||||
@echo "请确保PostgreSQL已启动,然后运行以下SQL文件:"
|
||||
@echo "- scripts/initial_country_202509081640.sql"
|
||||
@echo "- scripts/initial_areas_202509081640.sql"
|
||||
|
||||
.PHONY: backup-db
|
||||
backup-db: ## 备份数据库
|
||||
@echo "备份数据库..."
|
||||
@read -p "请输入数据库连接字符串: " DB_URL; \
|
||||
pg_dump $$DB_URL > backup_$(shell date +%Y%m%d_%H%M%S).sql
|
||||
|
||||
.PHONY: all
|
||||
all: clean deps proto build test lint ## 执行完整的构建流程
|
||||
|
||||
# 默认目标
|
||||
.DEFAULT_GOAL := help
|
||||
@@ -1,101 +0,0 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Initial Service
|
||||
initial-service:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: initial-service
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "12101:12101" # gRPC port
|
||||
- "12102:12102" # HTTP Gateway port
|
||||
environment:
|
||||
- SERVICE_ENV=docker
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ./etc:/app/etc:ro
|
||||
- ./logs:/app/logs
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
networks:
|
||||
- initial-network
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:12102/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# PostgreSQL Database
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: initial-postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: initial_db
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-initial_password}
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./scripts:/docker-entrypoint-initdb.d:ro
|
||||
ports:
|
||||
- "5432:5432"
|
||||
networks:
|
||||
- initial-network
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# Redis Cache
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: initial-redis
|
||||
restart: unless-stopped
|
||||
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-initial_redis_password}
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
networks:
|
||||
- initial-network
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
# Nginx Reverse Proxy (Optional)
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: initial-nginx
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./nginx/ssl:/etc/nginx/ssl:ro
|
||||
depends_on:
|
||||
- initial-service
|
||||
networks:
|
||||
- initial-network
|
||||
profiles:
|
||||
- with-nginx
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
initial-network:
|
||||
driver: bridge
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.8
|
||||
// protoc (unknown)
|
||||
// source: check.proto
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v7.35.0
|
||||
// source: module/base/initial/proto/check.proto
|
||||
|
||||
package initial
|
||||
|
||||
@@ -30,7 +30,7 @@ type Crc struct {
|
||||
|
||||
func (x *Crc) Reset() {
|
||||
*x = Crc{}
|
||||
mi := &file_check_proto_msgTypes[0]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -42,7 +42,7 @@ func (x *Crc) String() string {
|
||||
func (*Crc) ProtoMessage() {}
|
||||
|
||||
func (x *Crc) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_check_proto_msgTypes[0]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -55,7 +55,7 @@ func (x *Crc) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Crc.ProtoReflect.Descriptor instead.
|
||||
func (*Crc) Descriptor() ([]byte, []int) {
|
||||
return file_check_proto_rawDescGZIP(), []int{0}
|
||||
return file_module_base_initial_proto_check_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Crc) GetCode() string {
|
||||
@@ -77,7 +77,7 @@ type StatusReply struct {
|
||||
|
||||
func (x *StatusReply) Reset() {
|
||||
*x = StatusReply{}
|
||||
mi := &file_check_proto_msgTypes[1]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -89,7 +89,7 @@ func (x *StatusReply) String() string {
|
||||
func (*StatusReply) ProtoMessage() {}
|
||||
|
||||
func (x *StatusReply) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_check_proto_msgTypes[1]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -102,7 +102,7 @@ func (x *StatusReply) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use StatusReply.ProtoReflect.Descriptor instead.
|
||||
func (*StatusReply) Descriptor() ([]byte, []int) {
|
||||
return file_check_proto_rawDescGZIP(), []int{1}
|
||||
return file_module_base_initial_proto_check_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *StatusReply) GetCode() int32 {
|
||||
@@ -143,7 +143,7 @@ type ConfigRequest struct {
|
||||
|
||||
func (x *ConfigRequest) Reset() {
|
||||
*x = ConfigRequest{}
|
||||
mi := &file_check_proto_msgTypes[2]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -155,7 +155,7 @@ func (x *ConfigRequest) String() string {
|
||||
func (*ConfigRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ConfigRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_check_proto_msgTypes[2]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -168,7 +168,7 @@ func (x *ConfigRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ConfigRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ConfigRequest) Descriptor() ([]byte, []int) {
|
||||
return file_check_proto_rawDescGZIP(), []int{2}
|
||||
return file_module_base_initial_proto_check_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *ConfigRequest) GetApp() string {
|
||||
@@ -194,7 +194,7 @@ type ConfigReply struct {
|
||||
|
||||
func (x *ConfigReply) Reset() {
|
||||
*x = ConfigReply{}
|
||||
mi := &file_check_proto_msgTypes[3]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -206,7 +206,7 @@ func (x *ConfigReply) String() string {
|
||||
func (*ConfigReply) ProtoMessage() {}
|
||||
|
||||
func (x *ConfigReply) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_check_proto_msgTypes[3]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -219,7 +219,7 @@ func (x *ConfigReply) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ConfigReply.ProtoReflect.Descriptor instead.
|
||||
func (*ConfigReply) Descriptor() ([]byte, []int) {
|
||||
return file_check_proto_rawDescGZIP(), []int{3}
|
||||
return file_module_base_initial_proto_check_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ConfigReply) GetData() []*ConfigItem {
|
||||
@@ -241,7 +241,7 @@ type ConfigItem struct {
|
||||
|
||||
func (x *ConfigItem) Reset() {
|
||||
*x = ConfigItem{}
|
||||
mi := &file_check_proto_msgTypes[4]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -253,7 +253,7 @@ func (x *ConfigItem) String() string {
|
||||
func (*ConfigItem) ProtoMessage() {}
|
||||
|
||||
func (x *ConfigItem) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_check_proto_msgTypes[4]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -266,7 +266,7 @@ func (x *ConfigItem) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ConfigItem.ProtoReflect.Descriptor instead.
|
||||
func (*ConfigItem) Descriptor() ([]byte, []int) {
|
||||
return file_check_proto_rawDescGZIP(), []int{4}
|
||||
return file_module_base_initial_proto_check_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ConfigItem) GetIdentity() string {
|
||||
@@ -309,7 +309,7 @@ type CheckForUpdatesRequest struct {
|
||||
|
||||
func (x *CheckForUpdatesRequest) Reset() {
|
||||
*x = CheckForUpdatesRequest{}
|
||||
mi := &file_check_proto_msgTypes[5]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -321,7 +321,7 @@ func (x *CheckForUpdatesRequest) String() string {
|
||||
func (*CheckForUpdatesRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CheckForUpdatesRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_check_proto_msgTypes[5]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -334,7 +334,7 @@ func (x *CheckForUpdatesRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CheckForUpdatesRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CheckForUpdatesRequest) Descriptor() ([]byte, []int) {
|
||||
return file_check_proto_rawDescGZIP(), []int{5}
|
||||
return file_module_base_initial_proto_check_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *CheckForUpdatesRequest) GetApp() string {
|
||||
@@ -378,7 +378,7 @@ type CheckForUpdatesReply struct {
|
||||
|
||||
func (x *CheckForUpdatesReply) Reset() {
|
||||
*x = CheckForUpdatesReply{}
|
||||
mi := &file_check_proto_msgTypes[6]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -390,7 +390,7 @@ func (x *CheckForUpdatesReply) String() string {
|
||||
func (*CheckForUpdatesReply) ProtoMessage() {}
|
||||
|
||||
func (x *CheckForUpdatesReply) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_check_proto_msgTypes[6]
|
||||
mi := &file_module_base_initial_proto_check_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -403,7 +403,7 @@ func (x *CheckForUpdatesReply) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CheckForUpdatesReply.ProtoReflect.Descriptor instead.
|
||||
func (*CheckForUpdatesReply) Descriptor() ([]byte, []int) {
|
||||
return file_check_proto_rawDescGZIP(), []int{6}
|
||||
return file_module_base_initial_proto_check_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *CheckForUpdatesReply) GetIdentity() string {
|
||||
@@ -441,11 +441,11 @@ func (x *CheckForUpdatesReply) GetPubdate() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_check_proto protoreflect.FileDescriptor
|
||||
var File_module_base_initial_proto_check_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_check_proto_rawDesc = "" +
|
||||
const file_module_base_initial_proto_check_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x18base/initial/check.proto\x12\ainitial\"\x19\n" +
|
||||
"%module/base/initial/proto/check.proto\x12\ainitial\"\x19\n" +
|
||||
"\x03Crc\x12\x12\n" +
|
||||
"\x04code\x18\x01 \x01(\tR\x04code\"o\n" +
|
||||
"\vStatusReply\x12\x12\n" +
|
||||
@@ -478,22 +478,22 @@ const file_check_proto_rawDesc = "" +
|
||||
"\x05Check\x12-\n" +
|
||||
"\x05Hello\x12\f.initial.Crc\x1a\x14.initial.StatusReply\"\x00\x128\n" +
|
||||
"\x06Config\x12\x16.initial.ConfigRequest\x1a\x14.initial.ConfigReply\"\x00\x12K\n" +
|
||||
"\aUpdates\x12\x1f.initial.CheckForUpdatesRequest\x1a\x1d.initial.CheckForUpdatesReply\"\x00B\vZ\t.;initialb\x06proto3"
|
||||
"\aUpdates\x12\x1f.initial.CheckForUpdatesRequest\x1a\x1d.initial.CheckForUpdatesReply\"\x00B)Z'bsm/full/module/base/initial/pb;initialb\x06proto3"
|
||||
|
||||
var (
|
||||
file_check_proto_rawDescOnce sync.Once
|
||||
file_check_proto_rawDescData []byte
|
||||
file_module_base_initial_proto_check_proto_rawDescOnce sync.Once
|
||||
file_module_base_initial_proto_check_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_check_proto_rawDescGZIP() []byte {
|
||||
file_check_proto_rawDescOnce.Do(func() {
|
||||
file_check_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_check_proto_rawDesc), len(file_check_proto_rawDesc)))
|
||||
func file_module_base_initial_proto_check_proto_rawDescGZIP() []byte {
|
||||
file_module_base_initial_proto_check_proto_rawDescOnce.Do(func() {
|
||||
file_module_base_initial_proto_check_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_module_base_initial_proto_check_proto_rawDesc), len(file_module_base_initial_proto_check_proto_rawDesc)))
|
||||
})
|
||||
return file_check_proto_rawDescData
|
||||
return file_module_base_initial_proto_check_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_check_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||
var file_check_proto_goTypes = []any{
|
||||
var file_module_base_initial_proto_check_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||
var file_module_base_initial_proto_check_proto_goTypes = []any{
|
||||
(*Crc)(nil), // 0: initial.Crc
|
||||
(*StatusReply)(nil), // 1: initial.StatusReply
|
||||
(*ConfigRequest)(nil), // 2: initial.ConfigRequest
|
||||
@@ -502,7 +502,7 @@ var file_check_proto_goTypes = []any{
|
||||
(*CheckForUpdatesRequest)(nil), // 5: initial.CheckForUpdatesRequest
|
||||
(*CheckForUpdatesReply)(nil), // 6: initial.CheckForUpdatesReply
|
||||
}
|
||||
var file_check_proto_depIdxs = []int32{
|
||||
var file_module_base_initial_proto_check_proto_depIdxs = []int32{
|
||||
4, // 0: initial.ConfigReply.data:type_name -> initial.ConfigItem
|
||||
0, // 1: initial.Check.Hello:input_type -> initial.Crc
|
||||
2, // 2: initial.Check.Config:input_type -> initial.ConfigRequest
|
||||
@@ -517,26 +517,26 @@ var file_check_proto_depIdxs = []int32{
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_check_proto_init() }
|
||||
func file_check_proto_init() {
|
||||
if File_check_proto != nil {
|
||||
func init() { file_module_base_initial_proto_check_proto_init() }
|
||||
func file_module_base_initial_proto_check_proto_init() {
|
||||
if File_module_base_initial_proto_check_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_check_proto_rawDesc), len(file_check_proto_rawDesc)),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_module_base_initial_proto_check_proto_rawDesc), len(file_module_base_initial_proto_check_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 7,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_check_proto_goTypes,
|
||||
DependencyIndexes: file_check_proto_depIdxs,
|
||||
MessageInfos: file_check_proto_msgTypes,
|
||||
GoTypes: file_module_base_initial_proto_check_proto_goTypes,
|
||||
DependencyIndexes: file_module_base_initial_proto_check_proto_depIdxs,
|
||||
MessageInfos: file_module_base_initial_proto_check_proto_msgTypes,
|
||||
}.Build()
|
||||
File_check_proto = out.File
|
||||
file_check_proto_goTypes = nil
|
||||
file_check_proto_depIdxs = nil
|
||||
File_module_base_initial_proto_check_proto = out.File
|
||||
file_module_base_initial_proto_check_proto_goTypes = nil
|
||||
file_module_base_initial_proto_check_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: check.proto
|
||||
// source: module/base/initial/proto/check.proto
|
||||
|
||||
/*
|
||||
Package initial is a reverse proxy.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc (unknown)
|
||||
// source: check.proto
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc v7.35.0
|
||||
// source: module/base/initial/proto/check.proto
|
||||
|
||||
package initial
|
||||
|
||||
@@ -77,7 +77,7 @@ func (c *checkClient) Updates(ctx context.Context, in *CheckForUpdatesRequest, o
|
||||
}
|
||||
|
||||
// CheckServer is the server API for Check service.
|
||||
// All implementations must embed UnimplementedCheckServer
|
||||
// All implementations should embed UnimplementedCheckServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// initial-检测是否有新版或新的配置
|
||||
@@ -88,10 +88,9 @@ type CheckServer interface {
|
||||
Config(context.Context, *ConfigRequest) (*ConfigReply, error)
|
||||
// 检查更新
|
||||
Updates(context.Context, *CheckForUpdatesRequest) (*CheckForUpdatesReply, error)
|
||||
mustEmbedUnimplementedCheckServer()
|
||||
}
|
||||
|
||||
// UnimplementedCheckServer must be embedded to have
|
||||
// UnimplementedCheckServer should be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
@@ -99,16 +98,15 @@ type CheckServer interface {
|
||||
type UnimplementedCheckServer struct{}
|
||||
|
||||
func (UnimplementedCheckServer) Hello(context.Context, *Crc) (*StatusReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Hello not implemented")
|
||||
return nil, status.Error(codes.Unimplemented, "method Hello not implemented")
|
||||
}
|
||||
func (UnimplementedCheckServer) Config(context.Context, *ConfigRequest) (*ConfigReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Config not implemented")
|
||||
return nil, status.Error(codes.Unimplemented, "method Config not implemented")
|
||||
}
|
||||
func (UnimplementedCheckServer) Updates(context.Context, *CheckForUpdatesRequest) (*CheckForUpdatesReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Updates not implemented")
|
||||
return nil, status.Error(codes.Unimplemented, "method Updates not implemented")
|
||||
}
|
||||
func (UnimplementedCheckServer) mustEmbedUnimplementedCheckServer() {}
|
||||
func (UnimplementedCheckServer) testEmbeddedByValue() {}
|
||||
func (UnimplementedCheckServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeCheckServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to CheckServer will
|
||||
@@ -118,7 +116,7 @@ type UnsafeCheckServer interface {
|
||||
}
|
||||
|
||||
func RegisterCheckServer(s grpc.ServiceRegistrar, srv CheckServer) {
|
||||
// If the following call pancis, it indicates UnimplementedCheckServer was
|
||||
// If the following call panics, it indicates UnimplementedCheckServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
@@ -203,5 +201,5 @@ var Check_ServiceDesc = grpc.ServiceDesc{
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "check.proto",
|
||||
Metadata: "module/base/initial/proto/check.proto",
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.8
|
||||
// protoc (unknown)
|
||||
// source: data.proto
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v7.35.0
|
||||
// source: module/base/initial/proto/data.proto
|
||||
|
||||
package initial
|
||||
|
||||
@@ -29,7 +29,7 @@ type Empty struct {
|
||||
|
||||
func (x *Empty) Reset() {
|
||||
*x = Empty{}
|
||||
mi := &file_data_proto_msgTypes[0]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -41,7 +41,7 @@ func (x *Empty) String() string {
|
||||
func (*Empty) ProtoMessage() {}
|
||||
|
||||
func (x *Empty) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_data_proto_msgTypes[0]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -54,7 +54,7 @@ func (x *Empty) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use Empty.ProtoReflect.Descriptor instead.
|
||||
func (*Empty) Descriptor() ([]byte, []int) {
|
||||
return file_data_proto_rawDescGZIP(), []int{0}
|
||||
return file_module_base_initial_proto_data_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type CountryReply struct {
|
||||
@@ -66,7 +66,7 @@ type CountryReply struct {
|
||||
|
||||
func (x *CountryReply) Reset() {
|
||||
*x = CountryReply{}
|
||||
mi := &file_data_proto_msgTypes[1]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -78,7 +78,7 @@ func (x *CountryReply) String() string {
|
||||
func (*CountryReply) ProtoMessage() {}
|
||||
|
||||
func (x *CountryReply) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_data_proto_msgTypes[1]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -91,7 +91,7 @@ func (x *CountryReply) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CountryReply.ProtoReflect.Descriptor instead.
|
||||
func (*CountryReply) Descriptor() ([]byte, []int) {
|
||||
return file_data_proto_rawDescGZIP(), []int{1}
|
||||
return file_module_base_initial_proto_data_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CountryReply) GetCountries() []*CountryItem {
|
||||
@@ -123,7 +123,7 @@ type CountryItem struct {
|
||||
|
||||
func (x *CountryItem) Reset() {
|
||||
*x = CountryItem{}
|
||||
mi := &file_data_proto_msgTypes[2]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -135,7 +135,7 @@ func (x *CountryItem) String() string {
|
||||
func (*CountryItem) ProtoMessage() {}
|
||||
|
||||
func (x *CountryItem) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_data_proto_msgTypes[2]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -148,7 +148,7 @@ func (x *CountryItem) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CountryItem.ProtoReflect.Descriptor instead.
|
||||
func (*CountryItem) Descriptor() ([]byte, []int) {
|
||||
return file_data_proto_rawDescGZIP(), []int{2}
|
||||
return file_module_base_initial_proto_data_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *CountryItem) GetId() uint32 {
|
||||
@@ -263,7 +263,7 @@ type AreasRequest struct {
|
||||
|
||||
func (x *AreasRequest) Reset() {
|
||||
*x = AreasRequest{}
|
||||
mi := &file_data_proto_msgTypes[3]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -275,7 +275,7 @@ func (x *AreasRequest) String() string {
|
||||
func (*AreasRequest) ProtoMessage() {}
|
||||
|
||||
func (x *AreasRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_data_proto_msgTypes[3]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -288,7 +288,7 @@ func (x *AreasRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use AreasRequest.ProtoReflect.Descriptor instead.
|
||||
func (*AreasRequest) Descriptor() ([]byte, []int) {
|
||||
return file_data_proto_rawDescGZIP(), []int{3}
|
||||
return file_module_base_initial_proto_data_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *AreasRequest) GetCountryId() int32 {
|
||||
@@ -321,7 +321,7 @@ type AreasReply struct {
|
||||
|
||||
func (x *AreasReply) Reset() {
|
||||
*x = AreasReply{}
|
||||
mi := &file_data_proto_msgTypes[4]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -333,7 +333,7 @@ func (x *AreasReply) String() string {
|
||||
func (*AreasReply) ProtoMessage() {}
|
||||
|
||||
func (x *AreasReply) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_data_proto_msgTypes[4]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -346,7 +346,7 @@ func (x *AreasReply) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use AreasReply.ProtoReflect.Descriptor instead.
|
||||
func (*AreasReply) Descriptor() ([]byte, []int) {
|
||||
return file_data_proto_rawDescGZIP(), []int{4}
|
||||
return file_module_base_initial_proto_data_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *AreasReply) GetAreas() []*AreasItem {
|
||||
@@ -372,7 +372,7 @@ type AreasItem struct {
|
||||
|
||||
func (x *AreasItem) Reset() {
|
||||
*x = AreasItem{}
|
||||
mi := &file_data_proto_msgTypes[5]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -384,7 +384,7 @@ func (x *AreasItem) String() string {
|
||||
func (*AreasItem) ProtoMessage() {}
|
||||
|
||||
func (x *AreasItem) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_data_proto_msgTypes[5]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -397,7 +397,7 @@ func (x *AreasItem) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use AreasItem.ProtoReflect.Descriptor instead.
|
||||
func (*AreasItem) Descriptor() ([]byte, []int) {
|
||||
return file_data_proto_rawDescGZIP(), []int{5}
|
||||
return file_module_base_initial_proto_data_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *AreasItem) GetId() string {
|
||||
@@ -465,7 +465,7 @@ type DatasReply struct {
|
||||
|
||||
func (x *DatasReply) Reset() {
|
||||
*x = DatasReply{}
|
||||
mi := &file_data_proto_msgTypes[6]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -477,7 +477,7 @@ func (x *DatasReply) String() string {
|
||||
func (*DatasReply) ProtoMessage() {}
|
||||
|
||||
func (x *DatasReply) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_data_proto_msgTypes[6]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -490,7 +490,7 @@ func (x *DatasReply) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use DatasReply.ProtoReflect.Descriptor instead.
|
||||
func (*DatasReply) Descriptor() ([]byte, []int) {
|
||||
return file_data_proto_rawDescGZIP(), []int{6}
|
||||
return file_module_base_initial_proto_data_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *DatasReply) GetDatas() []*DatasItem {
|
||||
@@ -514,7 +514,7 @@ type DatasItem struct {
|
||||
|
||||
func (x *DatasItem) Reset() {
|
||||
*x = DatasItem{}
|
||||
mi := &file_data_proto_msgTypes[7]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -526,7 +526,7 @@ func (x *DatasItem) String() string {
|
||||
func (*DatasItem) ProtoMessage() {}
|
||||
|
||||
func (x *DatasItem) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_data_proto_msgTypes[7]
|
||||
mi := &file_module_base_initial_proto_data_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -539,7 +539,7 @@ func (x *DatasItem) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use DatasItem.ProtoReflect.Descriptor instead.
|
||||
func (*DatasItem) Descriptor() ([]byte, []int) {
|
||||
return file_data_proto_rawDescGZIP(), []int{7}
|
||||
return file_module_base_initial_proto_data_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *DatasItem) GetId() int64 {
|
||||
@@ -584,12 +584,11 @@ func (x *DatasItem) GetIcon() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_data_proto protoreflect.FileDescriptor
|
||||
var File_module_base_initial_proto_data_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_data_proto_rawDesc = "" +
|
||||
const file_module_base_initial_proto_data_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x17" +
|
||||
"base/initial/data.proto\x12\ainitial\"\a\n" +
|
||||
"$module/base/initial/proto/data.proto\x12\ainitial\"\a\n" +
|
||||
"\x05Empty\"B\n" +
|
||||
"\fCountryReply\x122\n" +
|
||||
"\tcountries\x18\x01 \x03(\v2\x14.initial.CountryItemR\tcountries\"\x8a\x03\n" +
|
||||
@@ -642,22 +641,22 @@ const file_data_proto_rawDesc = "" +
|
||||
"\x04Data\x122\n" +
|
||||
"\aCountry\x12\x0e.initial.Empty\x1a\x15.initial.CountryReply\"\x00\x125\n" +
|
||||
"\x05Areas\x12\x15.initial.AreasRequest\x1a\x13.initial.AreasReply\"\x00\x12.\n" +
|
||||
"\x05Datas\x12\x0e.initial.Empty\x1a\x13.initial.DatasReply\"\x00B\vZ\t.;initialb\x06proto3"
|
||||
"\x05Datas\x12\x0e.initial.Empty\x1a\x13.initial.DatasReply\"\x00B)Z'bsm/full/module/base/initial/pb;initialb\x06proto3"
|
||||
|
||||
var (
|
||||
file_data_proto_rawDescOnce sync.Once
|
||||
file_data_proto_rawDescData []byte
|
||||
file_module_base_initial_proto_data_proto_rawDescOnce sync.Once
|
||||
file_module_base_initial_proto_data_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_data_proto_rawDescGZIP() []byte {
|
||||
file_data_proto_rawDescOnce.Do(func() {
|
||||
file_data_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_data_proto_rawDesc), len(file_data_proto_rawDesc)))
|
||||
func file_module_base_initial_proto_data_proto_rawDescGZIP() []byte {
|
||||
file_module_base_initial_proto_data_proto_rawDescOnce.Do(func() {
|
||||
file_module_base_initial_proto_data_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_module_base_initial_proto_data_proto_rawDesc), len(file_module_base_initial_proto_data_proto_rawDesc)))
|
||||
})
|
||||
return file_data_proto_rawDescData
|
||||
return file_module_base_initial_proto_data_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_data_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_data_proto_goTypes = []any{
|
||||
var file_module_base_initial_proto_data_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_module_base_initial_proto_data_proto_goTypes = []any{
|
||||
(*Empty)(nil), // 0: initial.Empty
|
||||
(*CountryReply)(nil), // 1: initial.CountryReply
|
||||
(*CountryItem)(nil), // 2: initial.CountryItem
|
||||
@@ -667,7 +666,7 @@ var file_data_proto_goTypes = []any{
|
||||
(*DatasReply)(nil), // 6: initial.DatasReply
|
||||
(*DatasItem)(nil), // 7: initial.DatasItem
|
||||
}
|
||||
var file_data_proto_depIdxs = []int32{
|
||||
var file_module_base_initial_proto_data_proto_depIdxs = []int32{
|
||||
2, // 0: initial.CountryReply.countries:type_name -> initial.CountryItem
|
||||
5, // 1: initial.AreasReply.areas:type_name -> initial.AreasItem
|
||||
7, // 2: initial.DatasReply.datas:type_name -> initial.DatasItem
|
||||
@@ -684,26 +683,26 @@ var file_data_proto_depIdxs = []int32{
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_data_proto_init() }
|
||||
func file_data_proto_init() {
|
||||
if File_data_proto != nil {
|
||||
func init() { file_module_base_initial_proto_data_proto_init() }
|
||||
func file_module_base_initial_proto_data_proto_init() {
|
||||
if File_module_base_initial_proto_data_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_data_proto_rawDesc), len(file_data_proto_rawDesc)),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_module_base_initial_proto_data_proto_rawDesc), len(file_module_base_initial_proto_data_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_data_proto_goTypes,
|
||||
DependencyIndexes: file_data_proto_depIdxs,
|
||||
MessageInfos: file_data_proto_msgTypes,
|
||||
GoTypes: file_module_base_initial_proto_data_proto_goTypes,
|
||||
DependencyIndexes: file_module_base_initial_proto_data_proto_depIdxs,
|
||||
MessageInfos: file_module_base_initial_proto_data_proto_msgTypes,
|
||||
}.Build()
|
||||
File_data_proto = out.File
|
||||
file_data_proto_goTypes = nil
|
||||
file_data_proto_depIdxs = nil
|
||||
File_module_base_initial_proto_data_proto = out.File
|
||||
file_module_base_initial_proto_data_proto_goTypes = nil
|
||||
file_module_base_initial_proto_data_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: data.proto
|
||||
// source: module/base/initial/proto/data.proto
|
||||
|
||||
/*
|
||||
Package initial is a reverse proxy.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc (unknown)
|
||||
// source: data.proto
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc v7.35.0
|
||||
// source: module/base/initial/proto/data.proto
|
||||
|
||||
package initial
|
||||
|
||||
@@ -76,7 +76,7 @@ func (c *dataClient) Datas(ctx context.Context, in *Empty, opts ...grpc.CallOpti
|
||||
}
|
||||
|
||||
// DataServer is the server API for Data service.
|
||||
// All implementations must embed UnimplementedDataServer
|
||||
// All implementations should embed UnimplementedDataServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// initial-数据
|
||||
@@ -86,10 +86,9 @@ type DataServer interface {
|
||||
Areas(context.Context, *AreasRequest) (*AreasReply, error)
|
||||
// 系统数据
|
||||
Datas(context.Context, *Empty) (*DatasReply, error)
|
||||
mustEmbedUnimplementedDataServer()
|
||||
}
|
||||
|
||||
// UnimplementedDataServer must be embedded to have
|
||||
// UnimplementedDataServer should be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
@@ -97,16 +96,15 @@ type DataServer interface {
|
||||
type UnimplementedDataServer struct{}
|
||||
|
||||
func (UnimplementedDataServer) Country(context.Context, *Empty) (*CountryReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Country not implemented")
|
||||
return nil, status.Error(codes.Unimplemented, "method Country not implemented")
|
||||
}
|
||||
func (UnimplementedDataServer) Areas(context.Context, *AreasRequest) (*AreasReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Areas not implemented")
|
||||
return nil, status.Error(codes.Unimplemented, "method Areas not implemented")
|
||||
}
|
||||
func (UnimplementedDataServer) Datas(context.Context, *Empty) (*DatasReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Datas not implemented")
|
||||
return nil, status.Error(codes.Unimplemented, "method Datas not implemented")
|
||||
}
|
||||
func (UnimplementedDataServer) mustEmbedUnimplementedDataServer() {}
|
||||
func (UnimplementedDataServer) testEmbeddedByValue() {}
|
||||
func (UnimplementedDataServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeDataServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to DataServer will
|
||||
@@ -116,7 +114,7 @@ type UnsafeDataServer interface {
|
||||
}
|
||||
|
||||
func RegisterDataServer(s grpc.ServiceRegistrar, srv DataServer) {
|
||||
// If the following call pancis, it indicates UnimplementedDataServer was
|
||||
// If the following call panics, it indicates UnimplementedDataServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
@@ -201,5 +199,5 @@ var Data_ServiceDesc = grpc.ServiceDesc{
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "data.proto",
|
||||
Metadata: "module/base/initial/proto/data.proto",
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
syntax = "proto3";
|
||||
package initial;
|
||||
option go_package = ".;initial";
|
||||
option go_package = "bsm/full/module/base/initial/pb;initial";
|
||||
|
||||
|
||||
|
||||
// initial-检测是否有新版或新的配置
|
||||
service Check{
|
||||
|
||||
|
||||
// HELLO
|
||||
rpc Hello(Crc) returns (StatusReply){}
|
||||
|
||||
// 获取应用的相关配置信息
|
||||
rpc Config(ConfigRequest) returns (ConfigReply) {}
|
||||
rpc Config(ConfigRequest) returns (ConfigReply) {}
|
||||
|
||||
// 检查更新
|
||||
rpc Updates(CheckForUpdatesRequest) returns (CheckForUpdatesReply) {}
|
||||
rpc Updates(CheckForUpdatesRequest) returns (CheckForUpdatesReply) {}
|
||||
|
||||
|
||||
}
|
||||
@@ -49,7 +49,7 @@ message ConfigItem {
|
||||
int64 version=4; //版本号
|
||||
}
|
||||
|
||||
|
||||
|
||||
message CheckForUpdatesRequest {
|
||||
string app = 1; // 应用程序名称 <必填>
|
||||
string os = 2; // 操作系统 <必填>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
syntax = "proto3";
|
||||
package initial;
|
||||
option go_package = ".;initial";
|
||||
option go_package = "bsm/full/module/base/initial/pb;initial";
|
||||
|
||||
|
||||
// initial-数据
|
||||
@@ -8,10 +8,10 @@ service Data{
|
||||
rpc Country(Empty) returns (CountryReply) {}
|
||||
|
||||
// 系统区域数据,默认级别:市
|
||||
rpc Areas(AreasRequest) returns (AreasReply) {}
|
||||
rpc Areas(AreasRequest) returns (AreasReply) {}
|
||||
|
||||
// 系统数据
|
||||
rpc Datas(Empty) returns (DatasReply) {}
|
||||
rpc Datas(Empty) returns (DatasReply) {}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ message CountryItem {
|
||||
|
||||
message AreasRequest {
|
||||
// 国家ID,默认:中国 1
|
||||
int32 country_id = 1;
|
||||
int32 country_id = 1;
|
||||
// 国家代码,默认:中国 CN
|
||||
string country_code = 2;
|
||||
string country_code = 2;
|
||||
// 是否输出乡镇,默认:市级
|
||||
bool show_town = 3;
|
||||
bool show_town = 3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user