refactor(middleware): 重构权限中间件以统一上下文管理
- 引入 utils.UserContext 结构体统一管理用户上下文信息 - 创建新的上下文键 UserContent 用于存储用户信息 - 移除分散的 context.Value 调用,改用结构化数据传递 - 修正 context.WithValue 返回值未被正确使用的逻辑错误 - 更新 logout_logic.go 中的 Token 和用户ID获取方式 - 删除冗余的 Token 清理和提取函数 - 新增 context_util.go 文件提供上下文工具方法 - 简化 logout 接口中的上下文数据访问逻辑
This commit is contained in:
parent
0c7be05f3f
commit
76a0f62a51
|
|
@ -0,0 +1,109 @@
|
|||
# Custom configuration | 独立配置
|
||||
# Service name | 项目名称
|
||||
SERVICE=Pay
|
||||
# Service name in specific style | 项目经过style格式化的名称
|
||||
SERVICE_STYLE=pay
|
||||
# Service name in lowercase | 项目名称全小写格式
|
||||
SERVICE_LOWER=pay
|
||||
# Service name in snake format | 项目名称下划线格式
|
||||
SERVICE_SNAKE=pay
|
||||
# Service name in snake format | 项目名称短杠格式
|
||||
SERVICE_DASH=pay
|
||||
|
||||
# The project version, if you don't use git, you should set it manually | 项目版本,如果不使用git请手动设置
|
||||
VERSION=$(shell git describe --tags --always)
|
||||
|
||||
# The project file name style | 项目文件命名风格
|
||||
PROJECT_STYLE=go_zero
|
||||
|
||||
# Whether to use i18n | 是否启用 i18n
|
||||
PROJECT_I18N=true
|
||||
|
||||
# The suffix after build or compile | 构建后缀
|
||||
PROJECT_BUILD_SUFFIX=rpc
|
||||
|
||||
|
||||
# Ent enabled features | Ent 启用的官方特性
|
||||
ENT_FEATURE=sql/execquery,intercept
|
||||
|
||||
|
||||
# The arch of the build | 构建的架构
|
||||
GOARCH=amd64
|
||||
|
||||
# The repository of docker | Docker 仓库地址
|
||||
DOCKER_REPO=docker.io/xxx
|
||||
|
||||
# ---- You may not need to modify the codes below | 下面的代码大概率不需要更改 ----
|
||||
|
||||
model=all
|
||||
group=all
|
||||
|
||||
GO ?= go
|
||||
GOFMT ?= gofmt "-s"
|
||||
GOFILES := $(shell find . -name "*.go")
|
||||
LDFLAGS := -s -w
|
||||
|
||||
.PHONY: test
|
||||
test: # Run test for the project | 运行项目测试
|
||||
go test -v --cover ./internal/..
|
||||
|
||||
.PHONY: fmt
|
||||
fmt: # Format the codes | 格式化代码
|
||||
$(GOFMT) -w $(GOFILES)
|
||||
|
||||
.PHONY: lint
|
||||
lint: # Run go linter | 运行代码错误分析
|
||||
golangci-lint run -D staticcheck
|
||||
|
||||
.PHONY: tools
|
||||
tools: # Install the necessary tools | 安装必要的工具
|
||||
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest;
|
||||
|
||||
.PHONY: docker
|
||||
docker: # Build the docker image | 构建 docker 镜像
|
||||
docker build -f Dockerfile -t $(DOCKER_REPO)/$(SERVICE_DASH)-$(PROJECT_BUILD_SUFFIX):$(VERSION) .
|
||||
@echo "Build docker successfully"
|
||||
|
||||
.PHONY: publish-docker
|
||||
publish-docker: # Publish docker image | 发布 docker 镜像
|
||||
docker push $(DOCKER_REPO)/$(SERVICE_DASH)-$(PROJECT_BUILD_SUFFIX):$(VERSION)
|
||||
@echo "Publish docker successfully"
|
||||
|
||||
.PHONY: gen-rpc
|
||||
gen-rpc: # Generate RPC files from proto | 生成 RPC 的代码
|
||||
goctls rpc protoc ./$(SERVICE_STYLE).proto --go_out=./types --go-grpc_out=./types --zrpc_out=. --style=$(PROJECT_STYLE)
|
||||
ifeq ($(shell uname -s), Darwin)
|
||||
sed -i "" 's/,omitempty//g' ./types/$(SERVICE_LOWER)/*.pb.go
|
||||
else
|
||||
sed -i 's/,omitempty//g' ./types/$(SERVICE_LOWER)/*.pb.go
|
||||
endif
|
||||
@echo "Generate RPC codes successfully"
|
||||
|
||||
.PHONY: gen-ent
|
||||
gen-ent: # Generate Ent codes | 生成 Ent 的代码
|
||||
go run -mod=mod entgo.io/ent/cmd/ent generate --template glob="./ent/template/*.tmpl" ./ent/schema --feature $(ENT_FEATURE)
|
||||
@echo "Generate Ent codes successfully"
|
||||
|
||||
.PHONY: gen-rpc-ent-logic
|
||||
gen-rpc-ent-logic: # Generate logic code from Ent, need model and group params | 根据 Ent 生成逻辑代码, 需要设置 model 和 group
|
||||
goctls rpc ent --schema=./ent/schema --style=$(PROJECT_STYLE) --multiple=false --service_name=$(SERVICE) --output=./ --model=$(model) --group=$(group) --proto_out=./desc/$(shell echo $(model) | tr A-Z a-z).proto --i18n=$(PROJECT_I18N) --overwrite=true
|
||||
@echo "Generate logic codes from Ent successfully"
|
||||
|
||||
.PHONY: build-win
|
||||
build-win: # Build project for Windows | 构建Windows下的可执行文件
|
||||
env CGO_ENABLED=0 GOOS=windows GOARCH=$(GOARCH) go build -ldflags "$(LDFLAGS)" -trimpath -o $(SERVICE_STYLE)_$(PROJECT_BUILD_SUFFIX).exe $(SERVICE_STYLE).go
|
||||
@echo "Build project for Windows successfully"
|
||||
|
||||
.PHONY: build-mac
|
||||
build-mac: # Build project for MacOS | 构建MacOS下的可执行文件
|
||||
env CGO_ENABLED=0 GOOS=darwin GOARCH=$(GOARCH) go build -ldflags "$(LDFLAGS)" -trimpath -o $(SERVICE_STYLE)_$(PROJECT_BUILD_SUFFIX) $(SERVICE_STYLE).go
|
||||
@echo "Build project for MacOS successfully"
|
||||
|
||||
.PHONY: build-linux
|
||||
build-linux: # Build project for Linux | 构建Linux下的可执行文件
|
||||
env CGO_ENABLED=0 GOOS=linux GOARCH=$(GOARCH) go build -ldflags "$(LDFLAGS)" -trimpath -o $(SERVICE_STYLE)_$(PROJECT_BUILD_SUFFIX) $(SERVICE_STYLE).go
|
||||
@echo "Build project for Linux successfully"
|
||||
|
||||
.PHONY: help
|
||||
help: # Show help | 显示帮助
|
||||
@grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package pay;
|
||||
|
||||
option go_package = "./pay";
|
||||
|
||||
|
||||
|
||||
// base message
|
||||
message Empty {}
|
||||
|
||||
message IDReq {
|
||||
uint64 id = 1;
|
||||
}
|
||||
|
||||
message IDsReq {
|
||||
repeated uint64 ids = 1;
|
||||
}
|
||||
|
||||
message UUIDsReq {
|
||||
repeated string ids = 1;
|
||||
}
|
||||
|
||||
message UUIDReq {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message BaseResp {
|
||||
string msg = 1;
|
||||
}
|
||||
|
||||
message PageInfoReq {
|
||||
uint64 page = 1;
|
||||
uint64 page_size = 2;
|
||||
}
|
||||
|
||||
message BaseMsg {
|
||||
string msg = 1;
|
||||
}
|
||||
|
||||
message BaseIDResp {
|
||||
uint64 id = 1;
|
||||
string msg = 2;
|
||||
}
|
||||
|
||||
message BaseUUIDResp {
|
||||
string id = 1;
|
||||
string msg = 2;
|
||||
}
|
||||
|
||||
service Pay {
|
||||
// group: base
|
||||
rpc InitDatabase(Empty) returns (BaseResp);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package mixins
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/mixin"
|
||||
//"mingyang-admin-app/ent/intercept"
|
||||
)
|
||||
|
||||
// SoftDeleteMixin implements the soft delete pattern for schemas.
|
||||
type SoftDeleteMixin struct {
|
||||
mixin.Schema
|
||||
}
|
||||
|
||||
// Fields of the SoftDeleteMixin.
|
||||
func (SoftDeleteMixin) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Time("deleted_at").
|
||||
Optional().
|
||||
Comment("Delete Time | 删除日期"),
|
||||
}
|
||||
}
|
||||
|
||||
type softDeleteKey struct{}
|
||||
|
||||
// SkipSoftDelete returns a new context that skips the soft-delete interceptor/mutators.
|
||||
func SkipSoftDelete(parent context.Context) context.Context {
|
||||
return context.WithValue(parent, softDeleteKey{}, true)
|
||||
}
|
||||
|
||||
// Interceptors of the SoftDeleteMixin.
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package schema
|
||||
|
||||
import "entgo.io/ent"
|
||||
|
||||
type App struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (App) Fields() []ent.Field {
|
||||
return []ent.Field{}
|
||||
}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
{{/*
|
||||
Copyright 2022-present Ryan SU (github.com/suyuan32). All rights reserved.
|
||||
This source code is licensed under the Apache 2.0 license found
|
||||
in the LICENSE file in the root directory of this source tree.
|
||||
*/}}
|
||||
|
||||
{{ define "pagination" }}
|
||||
{{- /*gotype: entgo.io/ent/entc/gen.Graph*/ -}}
|
||||
|
||||
{{ template "header" $ }}
|
||||
{{ $pkg := base $.Config.Package }}
|
||||
{{ template "import" $ }}
|
||||
|
||||
const errInvalidPage = "INVALID_PAGE"
|
||||
|
||||
const (
|
||||
listField = "list"
|
||||
pageNumField = "pageNum"
|
||||
pageSizeField = "pageSize"
|
||||
)
|
||||
|
||||
type PageDetails struct {
|
||||
Page uint64 `json:"page"`
|
||||
Size uint64 `json:"size"`
|
||||
Total uint64 `json:"total"`
|
||||
}
|
||||
|
||||
// OrderDirection defines the directions in which to order a list of items.
|
||||
type OrderDirection string
|
||||
|
||||
const (
|
||||
// OrderDirectionAsc specifies an ascending order.
|
||||
OrderDirectionAsc OrderDirection = "ASC"
|
||||
// OrderDirectionDesc specifies a descending order.
|
||||
OrderDirectionDesc OrderDirection = "DESC"
|
||||
)
|
||||
|
||||
// Validate the order direction value.
|
||||
func (o OrderDirection) Validate() error {
|
||||
if o != OrderDirectionAsc && o != OrderDirectionDesc {
|
||||
return fmt.Errorf("%s is not a valid OrderDirection", o)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer interface.
|
||||
func (o OrderDirection) String() string {
|
||||
return string(o)
|
||||
}
|
||||
|
||||
func (o OrderDirection) reverse() OrderDirection {
|
||||
if o == OrderDirectionDesc {
|
||||
return OrderDirectionAsc
|
||||
}
|
||||
return OrderDirectionDesc
|
||||
}
|
||||
|
||||
const errInvalidPagination = "INVALID_PAGINATION"
|
||||
|
||||
{{ range $node := $.Nodes -}}
|
||||
{{- if ne $node.Name "CasbinRule" }}
|
||||
{{ $pager := print $node.Name "Pager" }}
|
||||
{{ $order := print $node.Name "Order"}}
|
||||
{{ $query := print $node.Name "Query"}}
|
||||
{{ $orderField := print $node.Name "OrderField"}}
|
||||
type {{ $pager }} struct {
|
||||
Order {{ lower $node.Name }}.OrderOption
|
||||
Filter func(*{{ $query }}) (*{{ $query }}, error)
|
||||
}
|
||||
|
||||
{{ $opt := print $node.Name "PaginateOption" }}
|
||||
// {{ $opt }} enables pagination customization.
|
||||
type {{ $opt }} func(*{{ $pager }})
|
||||
|
||||
|
||||
{{ $newPager := print "new" $node.Name "Pager" -}}
|
||||
{{- $defaultOrder := print "Default" $node.Name "Order" }}
|
||||
|
||||
{{ range $f := $node.Fields -}}
|
||||
{{- if eq $node.HasOneFieldID true}}
|
||||
// {{ $defaultOrder }} is the default ordering of {{ $node.Name }}.
|
||||
var {{ $defaultOrder }} = Desc({{ lower $node.Name }}.FieldID)
|
||||
{{- break}}
|
||||
{{- else}}
|
||||
// {{ $defaultOrder }} is the default ordering of {{ $node.Name }}.
|
||||
var {{ $defaultOrder }} = Desc({{ lower $node.Name }}.Field{{ $f.StructField }})
|
||||
{{- break}}
|
||||
{{- end}}
|
||||
{{end}}
|
||||
|
||||
func {{ $newPager }}(opts []{{ $opt }}) (*{{ $pager }}, error) {
|
||||
pager := &{{ $pager }}{}
|
||||
for _, opt := range opts {
|
||||
opt(pager)
|
||||
}
|
||||
if pager.Order == nil {
|
||||
pager.Order = {{ $defaultOrder }}
|
||||
}
|
||||
return pager, nil
|
||||
}
|
||||
|
||||
|
||||
func (p *{{ $pager }}) ApplyFilter(query *{{ $query }}) (*{{ $query }}, error) {
|
||||
if p.Filter != nil {
|
||||
return p.Filter(query)
|
||||
}
|
||||
return query, nil
|
||||
}
|
||||
|
||||
{{ $pageList := print $node.Name "PageList" -}}
|
||||
{{ $name := $node.Name }}
|
||||
|
||||
// {{ $pageList }} is {{ $name }} PageList result.
|
||||
type {{ $pageList }} struct {
|
||||
List []*{{ $name }} `json:"list"`
|
||||
PageDetails *PageDetails `json:"pageDetails"`
|
||||
}
|
||||
|
||||
|
||||
{{ $r := $node.Receiver -}}
|
||||
{{ $queryName := print $node.QueryName -}}
|
||||
|
||||
func ({{ $r }} *{{ $queryName }}) Page(
|
||||
ctx context.Context, pageNum uint64, pageSize uint64, opts ...{{ $opt }},
|
||||
) (*{{ $pageList }}, error) {
|
||||
|
||||
pager, err := {{ $newPager }}(opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if {{ $r }}, err = pager.ApplyFilter({{ $r }}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ret := &{{ $pageList }}{}
|
||||
|
||||
ret.PageDetails = &PageDetails{
|
||||
Page: pageNum,
|
||||
Size: pageSize,
|
||||
}
|
||||
|
||||
query := {{ $r }}.Clone()
|
||||
query.ctx.Fields = nil
|
||||
count, err := query.Count(ctx)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ret.PageDetails.Total = uint64(count)
|
||||
|
||||
if pager.Order != nil {
|
||||
{{ $r }} = {{ $r }}.Order(pager.Order)
|
||||
} else {
|
||||
{{ $r }} = {{ $r }}.Order({{ $defaultOrder }})
|
||||
}
|
||||
|
||||
{{ $r }} = {{ $r }}.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
|
||||
list, err := {{ $r }}.All(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ret.List = list
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
{{- end}}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
{{/*
|
||||
Copyright 2022-present Ryan SU (github.com/suyuan32). All rights reserved.
|
||||
This source code is licensed under the Apache 2.0 license found
|
||||
in the LICENSE file in the root directory of this source tree.
|
||||
*/}}
|
||||
|
||||
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
|
||||
|
||||
|
||||
{{ define "set_not_nil" }}
|
||||
|
||||
{{/* Add the base header for the generated file */}}
|
||||
{{ $pkg := base $.Config.Package }}
|
||||
{{ template "header" $ }}
|
||||
|
||||
{{/* Loop over all updaters and implement the "SetNotNil" method for all optional fields */}}
|
||||
{{ range $n := $.Nodes }}
|
||||
{{ range $f := $n.MutableFields }}
|
||||
{{ $set := print "Set" $f.StructField }}
|
||||
|
||||
{{ range $updater := list $n.UpdateName $n.UpdateOneName $n.CreateName}}
|
||||
// set field if value's pointer is not nil.
|
||||
func ({{ $n.Receiver }} *{{ $updater }}) SetNotNil{{ $f.StructField }}(value {{if not (hasPrefix $f.Type.String "[]") }}*{{end}}{{ $f.Type }}) *{{ $updater }} {
|
||||
if value != nil {
|
||||
return {{ $n.Receiver }}.{{ $set }}({{if not (hasPrefix $f.Type.String "[]") }}*{{end}}value)
|
||||
}
|
||||
return {{ $n.Receiver }}
|
||||
}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
Name: pay.rpc
|
||||
ListenOn: 0.0.0.0:10000
|
||||
|
||||
|
||||
Log:
|
||||
ServiceName: payRpcLogger
|
||||
Mode: file
|
||||
Path: /home/data/logs/pay/rpc
|
||||
Encoding: json
|
||||
Level: info
|
||||
Compress: false
|
||||
KeepDays: 7
|
||||
StackCoolDownMillis: 100
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
Name: rpc.rpc
|
||||
ListenOn: 0.0.0.0:8080
|
||||
Etcd:
|
||||
Hosts:
|
||||
- 127.0.0.1:2379
|
||||
Key: rpc.rpc
|
||||
|
|
@ -9,6 +9,7 @@ require (
|
|||
)
|
||||
|
||||
require (
|
||||
entgo.io/ent v0.14.5 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
|
|
|
|||
34
rpc/go.sum
34
rpc/go.sum
|
|
@ -1,9 +1,19 @@
|
|||
ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9 h1:E0wvcUXTkgyN4wy4LGtNzMNGMytJN8afmIWXJVMi4cc=
|
||||
ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9/go.mod h1:Oe1xWPuu5q9LzyrWfbZmEZxFYeu4BHTyzfjeW2aZp/w=
|
||||
entgo.io/ent v0.14.5 h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=
|
||||
entgo.io/ent v0.14.5/go.mod h1:zTzLmWtPvGpmSwtkaayM2cm5m819NdM7z7tYPq3vN0U=
|
||||
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
|
||||
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
|
||||
github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI=
|
||||
github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
|
||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
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/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0=
|
||||
github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||
|
|
@ -33,6 +43,8 @@ github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
|||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
|
||||
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
|
||||
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
|
||||
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||
|
|
@ -67,6 +79,10 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 h1:NmZ1PKzSTQbuGHw9DGPFomqkkLW
|
|||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3/go.mod h1:zQrxl1YP88HQlA6i9c63DSVPFklWpGX4OWAc9bFuaH4=
|
||||
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/hcl/v2 v2.18.1 h1:6nxnOJFku1EuSawSD81fuviYUV8DxFr3fp2dUi3ZYSo=
|
||||
github.com/hashicorp/hcl/v2 v2.18.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
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.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
|
|
@ -90,6 +106,10 @@ github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHP
|
|||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
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-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
||||
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
||||
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=
|
||||
|
|
@ -98,6 +118,8 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFd
|
|||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/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/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4=
|
||||
github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
|
||||
github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg=
|
||||
|
|
@ -123,10 +145,14 @@ github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4
|
|||
github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw=
|
||||
github.com/redis/go-redis/v9 v9.16.0 h1:OotgqgLSRCmzfqChbQyG1PHC3tLNR89DG4jdOERSEP4=
|
||||
github.com/redis/go-redis/v9 v9.16.0/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||
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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
|
|
@ -144,6 +170,10 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
|
|||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
|
||||
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
|
||||
github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8=
|
||||
github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
|
||||
github.com/zclconf/go-cty-yaml v1.1.0 h1:nP+jp0qPHv2IhUVqmQSzjvqAWcObN0KBkUl2rWBdig0=
|
||||
github.com/zclconf/go-cty-yaml v1.1.0/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs=
|
||||
github.com/zeromicro/go-zero v1.9.1 h1:GZCl4jun/ZgZHnSvX3SSNDHf+tEGmEQ8x2Z23xjHa9g=
|
||||
github.com/zeromicro/go-zero v1.9.1/go.mod h1:bHOl7Xr7EV/iHZWEqsUNJwFc/9WgAMrPpPagYvOaMtY=
|
||||
go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk=
|
||||
|
|
@ -197,6 +227,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
|
|||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
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.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
|
||||
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
|
|
@ -208,6 +240,8 @@ golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwE
|
|||
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=
|
||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/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-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package base
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"mingyang-admin-pay/rpc/internal/svc"
|
||||
"mingyang-admin-pay/rpc/types/pay"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type InitDatabaseLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewInitDatabaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InitDatabaseLogic {
|
||||
return &InitDatabaseLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *InitDatabaseLogic) InitDatabase(in *pay.Empty) (*pay.BaseResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pay.BaseResp{}, nil
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"mingyang-admin-pay/rpc/internal/svc"
|
||||
"mingyang-admin-pay/rpc/rpc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type PingLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic {
|
||||
return &PingLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *PingLogic) Ping(in *rpc.Request) (*rpc.Response, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &rpc.Response{}, nil
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
// Source: pay.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"mingyang-admin-pay/rpc/internal/logic/base"
|
||||
"mingyang-admin-pay/rpc/internal/svc"
|
||||
"mingyang-admin-pay/rpc/types/pay"
|
||||
)
|
||||
|
||||
type PayServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
pay.UnimplementedPayServer
|
||||
}
|
||||
|
||||
func NewPayServer(svcCtx *svc.ServiceContext) *PayServer {
|
||||
return &PayServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PayServer) InitDatabase(ctx context.Context, in *pay.Empty) (*pay.BaseResp, error) {
|
||||
l := base.NewInitDatabaseLogic(ctx, s.svcCtx)
|
||||
return l.InitDatabase(in)
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
// Source: rpc.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"mingyang-admin-pay/rpc/internal/logic"
|
||||
"mingyang-admin-pay/rpc/internal/svc"
|
||||
"mingyang-admin-pay/rpc/rpc"
|
||||
)
|
||||
|
||||
type RpcServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
rpc.UnimplementedRpcServer
|
||||
}
|
||||
|
||||
func NewRpcServer(svcCtx *svc.ServiceContext) *RpcServer {
|
||||
return &RpcServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *RpcServer) Ping(ctx context.Context, in *rpc.Request) (*rpc.Response, error) {
|
||||
l := logic.NewPingLogic(ctx, s.svcCtx)
|
||||
return l.Ping(in)
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package svc
|
||||
|
||||
import (
|
||||
"mingyang-admin-pay/rpc/internal/config"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"mingyang-admin-pay/rpc/internal/config"
|
||||
"mingyang-admin-pay/rpc/internal/server"
|
||||
"mingyang-admin-pay/rpc/internal/svc"
|
||||
"mingyang-admin-pay/rpc/rpc"
|
||||
"mingyang-admin-pay/rpc/types/pay"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/conf"
|
||||
"github.com/zeromicro/go-zero/core/service"
|
||||
|
|
@ -16,17 +16,17 @@ import (
|
|||
"google.golang.org/grpc/reflection"
|
||||
)
|
||||
|
||||
var configFile = flag.String("f", "etc/rpc.yaml", "the config file")
|
||||
var configFile = flag.String("f", "etc/pay.yaml", "the config file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
var c config.Config
|
||||
conf.MustLoad(*configFile, &c)
|
||||
conf.MustLoad(*configFile, &c, conf.UseEnv())
|
||||
ctx := svc.NewServiceContext(c)
|
||||
|
||||
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
|
||||
rpc.RegisterRpcServer(grpcServer, server.NewRpcServer(ctx))
|
||||
pay.RegisterAppServer(grpcServer, server.NewAppServer(ctx))
|
||||
|
||||
if c.Mode == service.DevMode || c.Mode == service.TestMode {
|
||||
reflection.Register(grpcServer)
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package pay;
|
||||
option go_package = "./pay";
|
||||
|
||||
message BaseIDResp {
|
||||
uint64 id = 1;
|
||||
string msg = 2;
|
||||
}
|
||||
|
||||
message BaseMsg {
|
||||
string msg = 1;
|
||||
}
|
||||
|
||||
message BaseResp {
|
||||
string msg = 1;
|
||||
}
|
||||
|
||||
message BaseUUIDResp {
|
||||
string id = 1;
|
||||
string msg = 2;
|
||||
}
|
||||
|
||||
// base message
|
||||
message Empty {}
|
||||
|
||||
message IDReq {
|
||||
uint64 id = 1;
|
||||
}
|
||||
|
||||
message IDsReq {
|
||||
repeated uint64 ids = 1;
|
||||
}
|
||||
|
||||
message PageInfoReq {
|
||||
uint64 page = 1;
|
||||
uint64 page_size = 2;
|
||||
}
|
||||
|
||||
message UUIDReq {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message UUIDsReq {
|
||||
repeated string ids = 1;
|
||||
}
|
||||
|
||||
service Pay {
|
||||
// group: base
|
||||
rpc InitDatabase(Empty) returns (BaseResp);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
// Source: pay.proto
|
||||
|
||||
package payclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"mingyang-admin-pay/rpc/types/pay"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
BaseIDResp = pay.BaseIDResp
|
||||
BaseMsg = pay.BaseMsg
|
||||
BaseResp = pay.BaseResp
|
||||
BaseUUIDResp = pay.BaseUUIDResp
|
||||
Empty = pay.Empty
|
||||
IDReq = pay.IDReq
|
||||
IDsReq = pay.IDsReq
|
||||
PageInfoReq = pay.PageInfoReq
|
||||
UUIDReq = pay.UUIDReq
|
||||
UUIDsReq = pay.UUIDsReq
|
||||
|
||||
Pay interface {
|
||||
InitDatabase(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*BaseResp, error)
|
||||
}
|
||||
|
||||
defaultPay struct {
|
||||
cli zrpc.Client
|
||||
}
|
||||
)
|
||||
|
||||
func NewPay(cli zrpc.Client) Pay {
|
||||
return &defaultPay{
|
||||
cli: cli,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultPay) InitDatabase(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*BaseResp, error) {
|
||||
client := pay.NewPayClient(m.cli.Conn())
|
||||
return client.InitDatabase(ctx, in, opts...)
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package rpc;
|
||||
option go_package="./rpc";
|
||||
|
||||
message Request {
|
||||
string ping = 1;
|
||||
}
|
||||
|
||||
message Response {
|
||||
string pong = 1;
|
||||
}
|
||||
|
||||
service Rpc {
|
||||
rpc Ping(Request) returns(Response);
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
// Source: rpc.proto
|
||||
|
||||
package rpcclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"mingyang-admin-pay/rpc/rpc"
|
||||
|
||||
"github.com/zeromicro/go-zero/zrpc"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type (
|
||||
Request = rpc.Request
|
||||
Response = rpc.Response
|
||||
|
||||
Rpc interface {
|
||||
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
|
||||
}
|
||||
|
||||
defaultRpc struct {
|
||||
cli zrpc.Client
|
||||
}
|
||||
)
|
||||
|
||||
func NewRpc(cli zrpc.Client) Rpc {
|
||||
return &defaultRpc{
|
||||
cli: cli,
|
||||
}
|
||||
}
|
||||
|
||||
func (m *defaultRpc) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
|
||||
client := rpc.NewRpcClient(m.cli.Conn())
|
||||
return client.Ping(ctx, in, opts...)
|
||||
}
|
||||
|
|
@ -0,0 +1,570 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.10
|
||||
// protoc v3.19.4
|
||||
// source: pay.proto
|
||||
|
||||
package pay
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type BaseIDResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
|
||||
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *BaseIDResp) Reset() {
|
||||
*x = BaseIDResp{}
|
||||
mi := &file_pay_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *BaseIDResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BaseIDResp) ProtoMessage() {}
|
||||
|
||||
func (x *BaseIDResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pay_proto_msgTypes[0]
|
||||
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 BaseIDResp.ProtoReflect.Descriptor instead.
|
||||
func (*BaseIDResp) Descriptor() ([]byte, []int) {
|
||||
return file_pay_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *BaseIDResp) GetId() uint64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *BaseIDResp) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type BaseMsg struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *BaseMsg) Reset() {
|
||||
*x = BaseMsg{}
|
||||
mi := &file_pay_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *BaseMsg) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BaseMsg) ProtoMessage() {}
|
||||
|
||||
func (x *BaseMsg) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pay_proto_msgTypes[1]
|
||||
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 BaseMsg.ProtoReflect.Descriptor instead.
|
||||
func (*BaseMsg) Descriptor() ([]byte, []int) {
|
||||
return file_pay_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *BaseMsg) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type BaseResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *BaseResp) Reset() {
|
||||
*x = BaseResp{}
|
||||
mi := &file_pay_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *BaseResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BaseResp) ProtoMessage() {}
|
||||
|
||||
func (x *BaseResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pay_proto_msgTypes[2]
|
||||
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 BaseResp.ProtoReflect.Descriptor instead.
|
||||
func (*BaseResp) Descriptor() ([]byte, []int) {
|
||||
return file_pay_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *BaseResp) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type BaseUUIDResp struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
|
||||
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *BaseUUIDResp) Reset() {
|
||||
*x = BaseUUIDResp{}
|
||||
mi := &file_pay_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *BaseUUIDResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BaseUUIDResp) ProtoMessage() {}
|
||||
|
||||
func (x *BaseUUIDResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pay_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 BaseUUIDResp.ProtoReflect.Descriptor instead.
|
||||
func (*BaseUUIDResp) Descriptor() ([]byte, []int) {
|
||||
return file_pay_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *BaseUUIDResp) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *BaseUUIDResp) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// base message
|
||||
type Empty struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Empty) Reset() {
|
||||
*x = Empty{}
|
||||
mi := &file_pay_proto_msgTypes[4]
|
||||
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_pay_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 Empty.ProtoReflect.Descriptor instead.
|
||||
func (*Empty) Descriptor() ([]byte, []int) {
|
||||
return file_pay_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
type IDReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *IDReq) Reset() {
|
||||
*x = IDReq{}
|
||||
mi := &file_pay_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *IDReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*IDReq) ProtoMessage() {}
|
||||
|
||||
func (x *IDReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pay_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 IDReq.ProtoReflect.Descriptor instead.
|
||||
func (*IDReq) Descriptor() ([]byte, []int) {
|
||||
return file_pay_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *IDReq) GetId() uint64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type IDsReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Ids []uint64 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *IDsReq) Reset() {
|
||||
*x = IDsReq{}
|
||||
mi := &file_pay_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *IDsReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*IDsReq) ProtoMessage() {}
|
||||
|
||||
func (x *IDsReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pay_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 IDsReq.ProtoReflect.Descriptor instead.
|
||||
func (*IDsReq) Descriptor() ([]byte, []int) {
|
||||
return file_pay_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *IDsReq) GetIds() []uint64 {
|
||||
if x != nil {
|
||||
return x.Ids
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PageInfoReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Page uint64 `protobuf:"varint,1,opt,name=page,proto3" json:"page"`
|
||||
PageSize uint64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *PageInfoReq) Reset() {
|
||||
*x = PageInfoReq{}
|
||||
mi := &file_pay_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *PageInfoReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PageInfoReq) ProtoMessage() {}
|
||||
|
||||
func (x *PageInfoReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pay_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 PageInfoReq.ProtoReflect.Descriptor instead.
|
||||
func (*PageInfoReq) Descriptor() ([]byte, []int) {
|
||||
return file_pay_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *PageInfoReq) GetPage() uint64 {
|
||||
if x != nil {
|
||||
return x.Page
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PageInfoReq) GetPageSize() uint64 {
|
||||
if x != nil {
|
||||
return x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type UUIDReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UUIDReq) Reset() {
|
||||
*x = UUIDReq{}
|
||||
mi := &file_pay_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UUIDReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UUIDReq) ProtoMessage() {}
|
||||
|
||||
func (x *UUIDReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pay_proto_msgTypes[8]
|
||||
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 UUIDReq.ProtoReflect.Descriptor instead.
|
||||
func (*UUIDReq) Descriptor() ([]byte, []int) {
|
||||
return file_pay_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *UUIDReq) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type UUIDsReq struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *UUIDsReq) Reset() {
|
||||
*x = UUIDsReq{}
|
||||
mi := &file_pay_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *UUIDsReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UUIDsReq) ProtoMessage() {}
|
||||
|
||||
func (x *UUIDsReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pay_proto_msgTypes[9]
|
||||
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 UUIDsReq.ProtoReflect.Descriptor instead.
|
||||
func (*UUIDsReq) Descriptor() ([]byte, []int) {
|
||||
return file_pay_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *UUIDsReq) GetIds() []string {
|
||||
if x != nil {
|
||||
return x.Ids
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_pay_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_pay_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\tpay.proto\x12\x03pay\".\n" +
|
||||
"\n" +
|
||||
"BaseIDResp\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x04R\x02id\x12\x10\n" +
|
||||
"\x03msg\x18\x02 \x01(\tR\x03msg\"\x1b\n" +
|
||||
"\aBaseMsg\x12\x10\n" +
|
||||
"\x03msg\x18\x01 \x01(\tR\x03msg\"\x1c\n" +
|
||||
"\bBaseResp\x12\x10\n" +
|
||||
"\x03msg\x18\x01 \x01(\tR\x03msg\"0\n" +
|
||||
"\fBaseUUIDResp\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\x12\x10\n" +
|
||||
"\x03msg\x18\x02 \x01(\tR\x03msg\"\a\n" +
|
||||
"\x05Empty\"\x17\n" +
|
||||
"\x05IDReq\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x04R\x02id\"\x1a\n" +
|
||||
"\x06IDsReq\x12\x10\n" +
|
||||
"\x03ids\x18\x01 \x03(\x04R\x03ids\">\n" +
|
||||
"\vPageInfoReq\x12\x12\n" +
|
||||
"\x04page\x18\x01 \x01(\x04R\x04page\x12\x1b\n" +
|
||||
"\tpage_size\x18\x02 \x01(\x04R\bpageSize\"\x19\n" +
|
||||
"\aUUIDReq\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\"\x1c\n" +
|
||||
"\bUUIDsReq\x12\x10\n" +
|
||||
"\x03ids\x18\x01 \x03(\tR\x03ids20\n" +
|
||||
"\x03Pay\x12)\n" +
|
||||
"\fInitDatabase\x12\n" +
|
||||
".pay.Empty\x1a\r.pay.BaseRespB\aZ\x05./payb\x06proto3"
|
||||
|
||||
var (
|
||||
file_pay_proto_rawDescOnce sync.Once
|
||||
file_pay_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_pay_proto_rawDescGZIP() []byte {
|
||||
file_pay_proto_rawDescOnce.Do(func() {
|
||||
file_pay_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pay_proto_rawDesc), len(file_pay_proto_rawDesc)))
|
||||
})
|
||||
return file_pay_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_pay_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_pay_proto_goTypes = []any{
|
||||
(*BaseIDResp)(nil), // 0: pay.BaseIDResp
|
||||
(*BaseMsg)(nil), // 1: pay.BaseMsg
|
||||
(*BaseResp)(nil), // 2: pay.BaseResp
|
||||
(*BaseUUIDResp)(nil), // 3: pay.BaseUUIDResp
|
||||
(*Empty)(nil), // 4: pay.Empty
|
||||
(*IDReq)(nil), // 5: pay.IDReq
|
||||
(*IDsReq)(nil), // 6: pay.IDsReq
|
||||
(*PageInfoReq)(nil), // 7: pay.PageInfoReq
|
||||
(*UUIDReq)(nil), // 8: pay.UUIDReq
|
||||
(*UUIDsReq)(nil), // 9: pay.UUIDsReq
|
||||
}
|
||||
var file_pay_proto_depIdxs = []int32{
|
||||
4, // 0: pay.Pay.InitDatabase:input_type -> pay.Empty
|
||||
2, // 1: pay.Pay.InitDatabase:output_type -> pay.BaseResp
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] 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
|
||||
}
|
||||
|
||||
func init() { file_pay_proto_init() }
|
||||
func file_pay_proto_init() {
|
||||
if File_pay_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_pay_proto_rawDesc), len(file_pay_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_pay_proto_goTypes,
|
||||
DependencyIndexes: file_pay_proto_depIdxs,
|
||||
MessageInfos: file_pay_proto_msgTypes,
|
||||
}.Build()
|
||||
File_pay_proto = out.File
|
||||
file_pay_proto_goTypes = nil
|
||||
file_pay_proto_depIdxs = nil
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v3.19.4
|
||||
// source: pay.proto
|
||||
|
||||
package pay
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
Pay_InitDatabase_FullMethodName = "/pay.Pay/InitDatabase"
|
||||
)
|
||||
|
||||
// PayClient is the client API for Pay service.
|
||||
//
|
||||
// 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 PayClient interface {
|
||||
// group: base
|
||||
InitDatabase(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*BaseResp, error)
|
||||
}
|
||||
|
||||
type payClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewPayClient(cc grpc.ClientConnInterface) PayClient {
|
||||
return &payClient{cc}
|
||||
}
|
||||
|
||||
func (c *payClient) InitDatabase(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*BaseResp, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(BaseResp)
|
||||
err := c.cc.Invoke(ctx, Pay_InitDatabase_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// PayServer is the server API for Pay service.
|
||||
// All implementations must embed UnimplementedPayServer
|
||||
// for forward compatibility.
|
||||
type PayServer interface {
|
||||
// group: base
|
||||
InitDatabase(context.Context, *Empty) (*BaseResp, error)
|
||||
mustEmbedUnimplementedPayServer()
|
||||
}
|
||||
|
||||
// UnimplementedPayServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedPayServer struct{}
|
||||
|
||||
func (UnimplementedPayServer) InitDatabase(context.Context, *Empty) (*BaseResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method InitDatabase not implemented")
|
||||
}
|
||||
func (UnimplementedPayServer) mustEmbedUnimplementedPayServer() {}
|
||||
func (UnimplementedPayServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafePayServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to PayServer will
|
||||
// result in compilation errors.
|
||||
type UnsafePayServer interface {
|
||||
mustEmbedUnimplementedPayServer()
|
||||
}
|
||||
|
||||
func RegisterPayServer(s grpc.ServiceRegistrar, srv PayServer) {
|
||||
// If the following call pancis, it indicates UnimplementedPayServer 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.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&Pay_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Pay_InitDatabase_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.(PayServer).InitDatabase(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Pay_InitDatabase_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PayServer).InitDatabase(ctx, req.(*Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Pay_ServiceDesc is the grpc.ServiceDesc for Pay service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Pay_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pay.Pay",
|
||||
HandlerType: (*PayServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "InitDatabase",
|
||||
Handler: _Pay_InitDatabase_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "pay.proto",
|
||||
}
|
||||
Loading…
Reference in New Issue