init
This commit is contained in:
commit
ee2718a1d0
17 files changed
+5264
No files matched your search
@@ -0,0 +1,4 @@
|
|||||||
|
.DS_Store
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
bin
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
PROTOC_GEN_GO_VERSION := v1.36.12
|
||||||
|
PROTOC_GEN_GO_GRPC_VERSION := v1.5.1
|
||||||
|
|
||||||
|
.PHONY: tools generate
|
||||||
|
|
||||||
|
tools:
|
||||||
|
go install google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GEN_GO_VERSION)
|
||||||
|
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(PROTOC_GEN_GO_GRPC_VERSION)
|
||||||
|
|
||||||
|
generate:
|
||||||
|
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative micro_layout/proto/user/user.proto xt-user/proto/user/user.proto
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
# proto
|
||||||
|
|
||||||
|
proto 公共文件
|
||||||
|
|
||||||
|
本地模块名为 `example.com/layout/proto`,Go 版本为 1.27.3。保持本目录与 `gin_layout`、`micro_layout` 同级,
|
||||||
|
两个服务通过 `replace example.com/layout/proto => ../proto` 引用。完整启动及调用说明见 [父目录 README](../README.md)。
|
||||||
|
|
||||||
|
示例协议位于 `micro_layout/proto/user/user.proto`,提供 `User.Create` 和 `User.QueryInfo`。
|
||||||
|
`micro_layout/client` 封装客户端;`discovery` 使用 etcd 官方 endpoints.Manager、租约续租及 resolver,
|
||||||
|
支持服务注册、自动发现、round_robin 和连接关闭。旧 `xt-user` 的接口和字段保持兼容,
|
||||||
|
只调整 go_package,并清理旧客户端中指向已删除模块的导入。
|
||||||
|
|
||||||
|
安装 protoc 后,执行 `make tools` 安装指定版本插件,再执行 `make generate` 生成两套 Go 协议文件。
|
||||||
|
|
||||||
|
### 注意事项
|
||||||
|
|
||||||
|
1. 可以新增接口
|
||||||
|
2. 可以新增字段
|
||||||
|
3. `不允许修改字段位置`
|
||||||
|
4. `不允许修改字段类型`,如果要升级字段,则采用新开字段,兼容老字段,并将老字段标记废弃
|
||||||
|
5. 标记废弃,在合适的位置上标注 `Deprecated: YYYYmmdd use XXXXXX instead.` 并说明替代的字段名或者方法名
|
||||||
|
6. 调整 request 和 response 结构体必须新开接口,兼容老字段,并将老接口标记废弃
|
||||||
|
7. 删接口和删字段必须隔 2 个版本
|
||||||
|
1. 老接口或者老字段标记废弃
|
||||||
|
2. 删除客户端的调用代码和字段,保留服务端接口和字段,发第一个版本
|
||||||
|
3. 发完第一个版本后,删除服务端的接口代码和字段,发第二个版本
|
||||||
|
4. 发完第一个版本后,删除 proto 里的接口和字段,如果有未上线分支更新 proto 遇到旧代码调用已删除接口,就 rebase 到最新 master 即可
|
||||||
|
8. 每一个 rpc 接口都应该定义对应的 Request 和 Response,考虑到将来扩展,不希望使用 google.protobuf.Empty 来替代 request 和 response 结构体定义
|
||||||
|
9. 为方便 go get proto,此代码仓库 `严禁 打 tag`
|
||||||
|
10. 查询单条记录用 Get 和 Query 做前缀皆可,查询多条记录统一用 Find 做前缀
|
||||||
|
11. 做一次 feature 调整时,尽量避免 proto 的反复提交修改,引用方项目的 go.mod 里可以临时采用 replace 方法实现本地测试,待稳定后再提交
|
||||||
|
12. 定义接口和参数思路
|
||||||
|
1. 只暴露业务相关的必要接口和参数
|
||||||
|
2. 有些接口觉得将来可能会用到,但现在用不到,这样的接口不要定义
|
||||||
|
1. 减少不必要的工作量
|
||||||
|
2. 可能这个接口将来永远都不会用到,但是后期迭代中可能会产生维护成本
|
||||||
|
3. 将来要删掉这类接口是件很漫长且困难的事,后面的人很难搞清楚到底有没有在引用
|
||||||
|
13. 微服务模块的目录名与代码仓库名一致,如果代码仓库名叫 kuaishou_jinniu 但是微服务名叫 kuaishou_magnetism ,想想如何让别的研发人员识别对应关系
|
||||||
|
|
||||||
|
### 官方文档
|
||||||
|
|
||||||
|
* [proto 3](https://protobuf.dev/programming-guides/proto3/)
|
||||||
|
|
||||||
|
### 推荐设计
|
||||||
|
|
||||||
|
查询单条记录的 Response 定义中将 exists 和 对象 平级,使用时,优先判断 exists 字段
|
||||||
|
|
||||||
|
```
|
||||||
|
message GetByOidResponse {
|
||||||
|
bool exists = 1;
|
||||||
|
ObjectInfo info = 2;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 废弃示例代码
|
||||||
|
|
||||||
|
标记某字段废弃
|
||||||
|
|
||||||
|
```
|
||||||
|
message QueryRequest {
|
||||||
|
int64 id = 1;
|
||||||
|
string app_id = 2 [deprecated = true];
|
||||||
|
repeated string app_ids = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryRequest {
|
||||||
|
int64 id = 1;
|
||||||
|
// Deprecated: 20240816 use app_ids instead.
|
||||||
|
string app_id = 2;
|
||||||
|
repeated string app_ids = 3;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
标记某接口废弃
|
||||||
|
|
||||||
|
```
|
||||||
|
rpc FindList(FindListRequest) returns (FindListResponse) {option deprecated = true;}
|
||||||
|
|
||||||
|
// Deprecated: 20240816 use FindListV2 instead.
|
||||||
|
rpc FindList(FindListRequest) returns (FindListResponse) {}
|
||||||
|
```
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package discovery
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
|
"go.etcd.io/etcd/client/v3/naming/resolver"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
_ "google.golang.org/grpc/balancer/roundrobin"
|
||||||
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Connection struct {
|
||||||
|
Conn *grpc.ClientConn
|
||||||
|
etcd *clientv3.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func Dial(cfg Config, service string) (*Connection, error) {
|
||||||
|
if err := ValidateService(service); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
etcd, err := NewClient(cfg)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), cfg.DialTimeout)
|
||||||
|
_, err = etcd.Get(ctx, service+"/", clientv3.WithPrefix(), clientv3.WithLimit(1))
|
||||||
|
cancel()
|
||||||
|
if err != nil {
|
||||||
|
_ = etcd.Close()
|
||||||
|
return nil, errors.New("connect etcd for service discovery failed")
|
||||||
|
}
|
||||||
|
builder, err := resolver.NewBuilder(etcd)
|
||||||
|
if err != nil {
|
||||||
|
_ = etcd.Close()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
conn, err := grpc.NewClient("etcd:///"+service,
|
||||||
|
grpc.WithResolvers(builder),
|
||||||
|
grpc.WithDefaultServiceConfig(`{"loadBalancingConfig":[{"round_robin":{}}]}`),
|
||||||
|
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
_ = etcd.Close()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &Connection{Conn: conn, etcd: etcd}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (connection *Connection) Close() error {
|
||||||
|
return errors.Join(connection.Conn.Close(), connection.etcd.Close())
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package discovery
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
Endpoints []string `mapstructure:"endpoints"`
|
||||||
|
Username string `mapstructure:"username"`
|
||||||
|
Password string `mapstructure:"password"`
|
||||||
|
DialTimeout time.Duration `mapstructure:"dial_timeout"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cfg Config) Validate() error {
|
||||||
|
if len(cfg.Endpoints) == 0 || cfg.DialTimeout <= 0 {
|
||||||
|
return errors.New("etcd endpoints and positive dial_timeout are required")
|
||||||
|
}
|
||||||
|
for _, endpoint := range cfg.Endpoints {
|
||||||
|
if strings.TrimSpace(endpoint) == "" {
|
||||||
|
return errors.New("etcd endpoints must not be empty")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClient(cfg Config) (*clientv3.Client, error) {
|
||||||
|
if err := cfg.Validate(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return clientv3.New(clientv3.Config{
|
||||||
|
Endpoints: cfg.Endpoints,
|
||||||
|
Username: cfg.Username,
|
||||||
|
Password: cfg.Password,
|
||||||
|
DialTimeout: cfg.DialTimeout,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func ValidateService(service string) error {
|
||||||
|
if strings.TrimSpace(service) == "" || strings.ContainsAny(service, "/:?# \t\r\n") {
|
||||||
|
return errors.New("service name must be a non-empty name without URL separators or whitespace")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package discovery
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"crypto/rand"
|
||||||
|
"errors"
|
||||||
|
"net"
|
||||||
|
"strconv"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
|
"go.etcd.io/etcd/client/v3/naming/endpoints"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Registration struct {
|
||||||
|
client *clientv3.Client
|
||||||
|
lease clientv3.LeaseID
|
||||||
|
cancel context.CancelFunc
|
||||||
|
done chan struct{}
|
||||||
|
once sync.Once
|
||||||
|
closeError error
|
||||||
|
cfg Config
|
||||||
|
}
|
||||||
|
|
||||||
|
func ValidateAddress(address string) error {
|
||||||
|
host, port, err := net.SplitHostPort(address)
|
||||||
|
number, numberErr := strconv.Atoi(port)
|
||||||
|
if err != nil || numberErr != nil || number < 1 || number > 65535 || host == "" || host == "0.0.0.0" || host == "::" {
|
||||||
|
return errors.New("advertise_addr must contain a reachable host and a port between 1 and 65535")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Register(ctx context.Context, cfg Config, service, address string, ttl int64) (*Registration, error) {
|
||||||
|
if err := ValidateService(service); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := ValidateAddress(address); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if ttl < 3 {
|
||||||
|
return nil, errors.New("etcd lease_ttl must be at least 3 seconds")
|
||||||
|
}
|
||||||
|
client, err := NewClient(cfg)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
registration := &Registration{client: client, cfg: cfg, done: make(chan struct{})}
|
||||||
|
opCtx, cancel := context.WithTimeout(ctx, cfg.DialTimeout)
|
||||||
|
lease, err := client.Grant(opCtx, ttl)
|
||||||
|
cancel()
|
||||||
|
if err != nil {
|
||||||
|
_ = client.Close()
|
||||||
|
return nil, errors.New("grant etcd lease failed")
|
||||||
|
}
|
||||||
|
registration.lease = lease.ID
|
||||||
|
manager, err := endpoints.NewManager(client, service)
|
||||||
|
if err != nil {
|
||||||
|
_ = registration.Close()
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
opCtx, cancel = context.WithTimeout(ctx, cfg.DialTimeout)
|
||||||
|
err = manager.AddEndpoint(opCtx, service+"/"+rand.Text(), endpoints.Endpoint{Addr: address}, clientv3.WithLease(lease.ID))
|
||||||
|
cancel()
|
||||||
|
if err != nil {
|
||||||
|
_ = registration.Close()
|
||||||
|
return nil, errors.New("register etcd endpoint failed")
|
||||||
|
}
|
||||||
|
keepAliveCtx, stop := context.WithCancel(ctx)
|
||||||
|
registration.cancel = stop
|
||||||
|
responses, err := client.KeepAlive(keepAliveCtx, lease.ID)
|
||||||
|
if err != nil {
|
||||||
|
_ = registration.Close()
|
||||||
|
return nil, errors.New("start etcd keepalive failed")
|
||||||
|
}
|
||||||
|
go func() {
|
||||||
|
defer close(registration.done)
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-keepAliveCtx.Done():
|
||||||
|
return
|
||||||
|
case response, open := <-responses:
|
||||||
|
if !open || response == nil || response.TTL <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
return registration, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (registration *Registration) Done() <-chan struct{} { return registration.done }
|
||||||
|
|
||||||
|
func (registration *Registration) Close() error {
|
||||||
|
registration.once.Do(func() {
|
||||||
|
if registration.cancel != nil {
|
||||||
|
registration.cancel()
|
||||||
|
}
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), registration.cfg.DialTimeout)
|
||||||
|
defer cancel()
|
||||||
|
_, err := registration.client.Revoke(ctx, registration.lease)
|
||||||
|
registration.closeError = errors.Join(err, registration.client.Close())
|
||||||
|
})
|
||||||
|
return registration.closeError
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
module example.com/layout/proto
|
||||||
|
|
||||||
|
go 1.27.3
|
||||||
|
|
||||||
|
require (
|
||||||
|
go.etcd.io/etcd/client/v3 v3.7.3
|
||||||
|
google.golang.org/grpc v1.85.0
|
||||||
|
google.golang.org/protobuf v1.36.12
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/coreos/go-semver v0.3.1 // indirect
|
||||||
|
github.com/coreos/go-systemd/v22 v22.7.0 // indirect
|
||||||
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect
|
||||||
|
go.etcd.io/etcd/api/v3 v3.7.3 // indirect
|
||||||
|
go.etcd.io/etcd/client/pkg/v3 v3.7.3 // indirect
|
||||||
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
|
go.uber.org/zap v1.27.1 // indirect
|
||||||
|
golang.org/x/net v0.61.0 // indirect
|
||||||
|
golang.org/x/sys v0.49.0 // indirect
|
||||||
|
golang.org/x/text v0.43.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20260817212433-ac3dfec99bb1 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260817212433-ac3dfec99bb1 // indirect
|
||||||
|
)
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
||||||
|
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
|
||||||
|
github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA=
|
||||||
|
github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w=
|
||||||
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||||
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs=
|
||||||
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||||
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
|
go.etcd.io/etcd/api/v3 v3.7.3 h1:2tumepXe+wi7Wab64uUO71K7ISQyUWLGC1DJbbc59sY=
|
||||||
|
go.etcd.io/etcd/api/v3 v3.7.3/go.mod h1:HOR9Qn4gb/1/hVAmYprmlLpvTe6ZgfgNS9Z/+Ty65po=
|
||||||
|
go.etcd.io/etcd/client/pkg/v3 v3.7.3 h1:5zMwNu3ycrzCeA5NwOfQbxFRhqq974chq1DrYMua4QI=
|
||||||
|
go.etcd.io/etcd/client/pkg/v3 v3.7.3/go.mod h1:/OhzqYrF0U7d1NOk55VMyUQGbYD1WoIe4bJwxb47wOk=
|
||||||
|
go.etcd.io/etcd/client/v3 v3.7.3 h1:UrXcetgkuSEocaBlQlulQRJlXLEnUAHuBRbHh0lue1Q=
|
||||||
|
go.etcd.io/etcd/client/v3 v3.7.3/go.mod h1:DcPxpqcpV8WIaRi/2waPCx0/Uq8rQUweDJaDYZk1gEE=
|
||||||
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
|
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||||
|
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
|
go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
|
||||||
|
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||||
|
golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw=
|
||||||
|
golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
|
||||||
|
golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA=
|
||||||
|
golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
|
||||||
|
golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc=
|
||||||
|
golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s=
|
||||||
|
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||||
|
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20260817212433-ac3dfec99bb1 h1:lrupDmKL3p5kEX1M92oan027eCKcouzjuPbH6YBK+Rs=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20260817212433-ac3dfec99bb1/go.mod h1:q/3oV3jAi5vwelxsVAprMBC8BcM2zmNe+IjRGd+9/ks=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260817212433-ac3dfec99bb1 h1:utmqiUzZAEINbLmRyAt1QjVkMyLQ+lvIwCpLaB1rZfw=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20260817212433-ac3dfec99bb1/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||||
|
google.golang.org/grpc v1.85.0 h1:BPBCfuVRQ1qvBhKDOq9uvQllMvO59rKsYhXpp7Dd8vw=
|
||||||
|
google.golang.org/grpc v1.85.0/go.mod h1:0rQrOD58yjal/0EaVbGBANindixsCZNQPDV3VKtaKuQ=
|
||||||
|
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
|
||||||
|
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"example.com/layout/proto/discovery"
|
||||||
|
"example.com/layout/proto/micro_layout/proto/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
const ServiceName = "micro.micro_layout"
|
||||||
|
|
||||||
|
type MicroLayoutClient struct {
|
||||||
|
User user.UserClient
|
||||||
|
connection *discovery.Connection
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMicroLayoutClient(cfg discovery.Config, service string) (*MicroLayoutClient, error) {
|
||||||
|
connection, err := discovery.Dial(cfg, service)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &MicroLayoutClient{User: user.NewUserClient(connection.Conn), connection: connection}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client *MicroLayoutClient) Close() error { return client.connection.Close() }
|
||||||
@@ -0,0 +1,346 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.36.12
|
||||||
|
// protoc v7.34.0
|
||||||
|
// source: micro_layout/proto/user/user.proto
|
||||||
|
|
||||||
|
package user
|
||||||
|
|
||||||
|
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 CreateRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateRequest) Reset() {
|
||||||
|
*x = CreateRequest{}
|
||||||
|
mi := &file_micro_layout_proto_user_user_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CreateRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CreateRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_micro_layout_proto_user_user_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 CreateRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CreateRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_micro_layout_proto_user_user_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateRequest) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type CreateResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Item *UserItem `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateResponse) Reset() {
|
||||||
|
*x = CreateResponse{}
|
||||||
|
mi := &file_micro_layout_proto_user_user_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CreateResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CreateResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_micro_layout_proto_user_user_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 CreateResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CreateResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_micro_layout_proto_user_user_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateResponse) GetItem() *UserItem {
|
||||||
|
if x != nil {
|
||||||
|
return x.Item
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueryInfoRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryInfoRequest) Reset() {
|
||||||
|
*x = QueryInfoRequest{}
|
||||||
|
mi := &file_micro_layout_proto_user_user_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryInfoRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*QueryInfoRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *QueryInfoRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_micro_layout_proto_user_user_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 QueryInfoRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*QueryInfoRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_micro_layout_proto_user_user_proto_rawDescGZIP(), []int{2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryInfoRequest) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueryInfoResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Exists bool `protobuf:"varint,1,opt,name=exists,proto3" json:"exists,omitempty"`
|
||||||
|
Item *UserItem `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryInfoResponse) Reset() {
|
||||||
|
*x = QueryInfoResponse{}
|
||||||
|
mi := &file_micro_layout_proto_user_user_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryInfoResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*QueryInfoResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *QueryInfoResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_micro_layout_proto_user_user_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 QueryInfoResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*QueryInfoResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_micro_layout_proto_user_user_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryInfoResponse) GetExists() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.Exists
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *QueryInfoResponse) GetItem() *UserItem {
|
||||||
|
if x != nil {
|
||||||
|
return x.Item
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserItem struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *UserItem) Reset() {
|
||||||
|
*x = UserItem{}
|
||||||
|
mi := &file_micro_layout_proto_user_user_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *UserItem) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*UserItem) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *UserItem) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_micro_layout_proto_user_user_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 UserItem.ProtoReflect.Descriptor instead.
|
||||||
|
func (*UserItem) Descriptor() ([]byte, []int) {
|
||||||
|
return file_micro_layout_proto_user_user_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *UserItem) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *UserItem) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *UserItem) GetStatus() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Status
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_micro_layout_proto_user_user_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
const file_micro_layout_proto_user_user_proto_rawDesc = "" +
|
||||||
|
"\n" +
|
||||||
|
"\"micro_layout/proto/user/user.proto\x12\x17micro.micro_layout.user\"#\n" +
|
||||||
|
"\rCreateRequest\x12\x12\n" +
|
||||||
|
"\x04name\x18\x01 \x01(\tR\x04name\"G\n" +
|
||||||
|
"\x0eCreateResponse\x125\n" +
|
||||||
|
"\x04item\x18\x01 \x01(\v2!.micro.micro_layout.user.UserItemR\x04item\"\"\n" +
|
||||||
|
"\x10QueryInfoRequest\x12\x0e\n" +
|
||||||
|
"\x02id\x18\x01 \x01(\x03R\x02id\"b\n" +
|
||||||
|
"\x11QueryInfoResponse\x12\x16\n" +
|
||||||
|
"\x06exists\x18\x01 \x01(\bR\x06exists\x125\n" +
|
||||||
|
"\x04item\x18\x02 \x01(\v2!.micro.micro_layout.user.UserItemR\x04item\"F\n" +
|
||||||
|
"\bUserItem\x12\x0e\n" +
|
||||||
|
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
|
||||||
|
"\x04name\x18\x02 \x01(\tR\x04name\x12\x16\n" +
|
||||||
|
"\x06status\x18\x03 \x01(\tR\x06status2\xc9\x01\n" +
|
||||||
|
"\x04User\x12[\n" +
|
||||||
|
"\x06Create\x12&.micro.micro_layout.user.CreateRequest\x1a'.micro.micro_layout.user.CreateResponse\"\x00\x12d\n" +
|
||||||
|
"\tQueryInfo\x12).micro.micro_layout.user.QueryInfoRequest\x1a*.micro.micro_layout.user.QueryInfoResponse\"\x00B2Z0example.com/layout/proto/micro_layout/proto/userb\x06proto3"
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_micro_layout_proto_user_user_proto_rawDescOnce sync.Once
|
||||||
|
file_micro_layout_proto_user_user_proto_rawDescData []byte
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_micro_layout_proto_user_user_proto_rawDescGZIP() []byte {
|
||||||
|
file_micro_layout_proto_user_user_proto_rawDescOnce.Do(func() {
|
||||||
|
file_micro_layout_proto_user_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_micro_layout_proto_user_user_proto_rawDesc), len(file_micro_layout_proto_user_user_proto_rawDesc)))
|
||||||
|
})
|
||||||
|
return file_micro_layout_proto_user_user_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_micro_layout_proto_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||||
|
var file_micro_layout_proto_user_user_proto_goTypes = []any{
|
||||||
|
(*CreateRequest)(nil), // 0: micro.micro_layout.user.CreateRequest
|
||||||
|
(*CreateResponse)(nil), // 1: micro.micro_layout.user.CreateResponse
|
||||||
|
(*QueryInfoRequest)(nil), // 2: micro.micro_layout.user.QueryInfoRequest
|
||||||
|
(*QueryInfoResponse)(nil), // 3: micro.micro_layout.user.QueryInfoResponse
|
||||||
|
(*UserItem)(nil), // 4: micro.micro_layout.user.UserItem
|
||||||
|
}
|
||||||
|
var file_micro_layout_proto_user_user_proto_depIdxs = []int32{
|
||||||
|
4, // 0: micro.micro_layout.user.CreateResponse.item:type_name -> micro.micro_layout.user.UserItem
|
||||||
|
4, // 1: micro.micro_layout.user.QueryInfoResponse.item:type_name -> micro.micro_layout.user.UserItem
|
||||||
|
0, // 2: micro.micro_layout.user.User.Create:input_type -> micro.micro_layout.user.CreateRequest
|
||||||
|
2, // 3: micro.micro_layout.user.User.QueryInfo:input_type -> micro.micro_layout.user.QueryInfoRequest
|
||||||
|
1, // 4: micro.micro_layout.user.User.Create:output_type -> micro.micro_layout.user.CreateResponse
|
||||||
|
3, // 5: micro.micro_layout.user.User.QueryInfo:output_type -> micro.micro_layout.user.QueryInfoResponse
|
||||||
|
4, // [4:6] is the sub-list for method output_type
|
||||||
|
2, // [2:4] is the sub-list for method input_type
|
||||||
|
2, // [2:2] is the sub-list for extension type_name
|
||||||
|
2, // [2:2] is the sub-list for extension extendee
|
||||||
|
0, // [0:2] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_micro_layout_proto_user_user_proto_init() }
|
||||||
|
func file_micro_layout_proto_user_user_proto_init() {
|
||||||
|
if File_micro_layout_proto_user_user_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_micro_layout_proto_user_user_proto_rawDesc), len(file_micro_layout_proto_user_user_proto_rawDesc)),
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 5,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 1,
|
||||||
|
},
|
||||||
|
GoTypes: file_micro_layout_proto_user_user_proto_goTypes,
|
||||||
|
DependencyIndexes: file_micro_layout_proto_user_user_proto_depIdxs,
|
||||||
|
MessageInfos: file_micro_layout_proto_user_user_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_micro_layout_proto_user_user_proto = out.File
|
||||||
|
file_micro_layout_proto_user_user_proto_goTypes = nil
|
||||||
|
file_micro_layout_proto_user_user_proto_depIdxs = nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package micro.micro_layout.user;
|
||||||
|
|
||||||
|
option go_package = "example.com/layout/proto/micro_layout/proto/user";
|
||||||
|
|
||||||
|
service User {
|
||||||
|
rpc Create(CreateRequest) returns (CreateResponse) {}
|
||||||
|
rpc QueryInfo(QueryInfoRequest) returns (QueryInfoResponse) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateRequest {
|
||||||
|
string name = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateResponse {
|
||||||
|
UserItem item = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryInfoRequest {
|
||||||
|
int64 id = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryInfoResponse {
|
||||||
|
bool exists = 1;
|
||||||
|
UserItem item = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UserItem {
|
||||||
|
int64 id = 1;
|
||||||
|
string name = 2;
|
||||||
|
string status = 3;
|
||||||
|
}
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.5.1
|
||||||
|
// - protoc v7.34.0
|
||||||
|
// source: micro_layout/proto/user/user.proto
|
||||||
|
|
||||||
|
package user
|
||||||
|
|
||||||
|
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 (
|
||||||
|
User_Create_FullMethodName = "/micro.micro_layout.user.User/Create"
|
||||||
|
User_QueryInfo_FullMethodName = "/micro.micro_layout.user.User/QueryInfo"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserClient is the client API for User 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 UserClient interface {
|
||||||
|
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
|
||||||
|
QueryInfo(ctx context.Context, in *QueryInfoRequest, opts ...grpc.CallOption) (*QueryInfoResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type userClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserClient(cc grpc.ClientConnInterface) UserClient {
|
||||||
|
return &userClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(CreateResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_Create_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) QueryInfo(ctx context.Context, in *QueryInfoRequest, opts ...grpc.CallOption) (*QueryInfoResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(QueryInfoResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_QueryInfo_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserServer is the server API for User service.
|
||||||
|
// All implementations must embed UnimplementedUserServer
|
||||||
|
// for forward compatibility.
|
||||||
|
type UserServer interface {
|
||||||
|
Create(context.Context, *CreateRequest) (*CreateResponse, error)
|
||||||
|
QueryInfo(context.Context, *QueryInfoRequest) (*QueryInfoResponse, error)
|
||||||
|
mustEmbedUnimplementedUserServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedUserServer 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 UnimplementedUserServer struct{}
|
||||||
|
|
||||||
|
func (UnimplementedUserServer) Create(context.Context, *CreateRequest) (*CreateResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) QueryInfo(context.Context, *QueryInfoRequest) (*QueryInfoResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method QueryInfo not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {}
|
||||||
|
func (UnimplementedUserServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
|
// UnsafeUserServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to UserServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeUserServer interface {
|
||||||
|
mustEmbedUnimplementedUserServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer) {
|
||||||
|
// If the following call pancis, it indicates UnimplementedUserServer 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(&User_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CreateRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).Create(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_Create_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).Create(ctx, req.(*CreateRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_QueryInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(QueryInfoRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).QueryInfo(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_QueryInfo_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).QueryInfo(ctx, req.(*QueryInfoRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// User_ServiceDesc is the grpc.ServiceDesc for User service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var User_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "micro.micro_layout.user.User",
|
||||||
|
HandlerType: (*UserServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "Create",
|
||||||
|
Handler: _User_Create_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "QueryInfo",
|
||||||
|
Handler: _User_QueryInfo_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "micro_layout/proto/user/user.proto",
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package client
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"example.com/layout/proto/discovery"
|
||||||
|
"example.com/layout/proto/xt-user/proto/user"
|
||||||
|
)
|
||||||
|
|
||||||
|
type XtUserClient struct {
|
||||||
|
User user.UserClient
|
||||||
|
connection *discovery.Connection
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewXtUserClient(etcdAddr string) (*XtUserClient, error) {
|
||||||
|
connection, err := discovery.Dial(discovery.Config{
|
||||||
|
Endpoints: []string{etcdAddr},
|
||||||
|
DialTimeout: 5 * time.Second,
|
||||||
|
}, "micro.xt_user")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &XtUserClient{User: user.NewUserClient(connection.Conn), connection: connection}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (client *XtUserClient) Close() error { return client.connection.Close() }
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative xt-user/proto/user/user.prot
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,348 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package micro.xt_user.user;
|
||||||
|
import "google/protobuf/empty.proto";
|
||||||
|
option go_package = "example.com/layout/proto/xt-user/proto/user";
|
||||||
|
|
||||||
|
service User {
|
||||||
|
// 查询账号是否已注册
|
||||||
|
rpc Exists(ExistsRequest) returns (ExistsResponse) {}
|
||||||
|
// 查询用户信息
|
||||||
|
rpc QueryInfo(QueryInfoRequest) returns (QueryInfoResponse) {}
|
||||||
|
// 查询用户信息
|
||||||
|
rpc QueryIdentity(QueryIdentityRequest) returns (QueryIdentityResponse) {}
|
||||||
|
// 查询用户归属信息
|
||||||
|
rpc QueryBelong(QueryBelongRequest) returns (QueryBelongResponse) {}
|
||||||
|
// 批量查询用户(头像,昵称)
|
||||||
|
rpc FindUserInfo(FindUserInfoRequest) returns (FindUserInfoResponse) {}
|
||||||
|
// 批量查询用户(根据不同渠道显示不同的账号)
|
||||||
|
rpc FindUserDisplay(FindUserDisplayRequest) returns (FindUserDisplayResponse) {}
|
||||||
|
// 下拉框专属列表
|
||||||
|
rpc FindSelect(FindSelectRequest) returns (FindSelectResponse) {}
|
||||||
|
// Deprecated: 20240516 迁移到 user_list 下 分页查询用户列表
|
||||||
|
rpc FindByPage(FindByPageRequest) returns (FindByPageResponse) {}
|
||||||
|
// 批量查询用户,按identity
|
||||||
|
rpc FindUserInfoByIdentity(FindUserInfoByIdentityRequest) returns (FindUserInfoByIdentityResponse) {}
|
||||||
|
|
||||||
|
// 更新账号可用状态
|
||||||
|
rpc UpdateEnable(UpdateEnableRequest) returns (google.protobuf.Empty) {}
|
||||||
|
// 更新姓名
|
||||||
|
rpc UpdateName(UpdateNameRequest) returns (google.protobuf.Empty) {}
|
||||||
|
// 更新昵称
|
||||||
|
rpc UpdateNickname(UpdateNicknameRequest) returns (google.protobuf.Empty) {}
|
||||||
|
// 更新头像
|
||||||
|
rpc UpdateAvatar(UpdateAvatarRequest) returns (google.protobuf.Empty) {}
|
||||||
|
// 更新创建者
|
||||||
|
rpc UpdateCreator(UpdateCreatorRequest) returns (google.protobuf.Empty) {}
|
||||||
|
// 更新最后修改者
|
||||||
|
rpc UpdateLastModifier(UpdateLastModifierRequest) returns (google.protobuf.Empty) {}
|
||||||
|
// 更新最后访问时间
|
||||||
|
rpc UpdateAccessed(UpdateAccessedRequest) returns (google.protobuf.Empty) {}
|
||||||
|
// 搜索手机号和昵称
|
||||||
|
rpc SearchMemberInfo(SearchMemberInfoRequest) returns (SearchMemberInfoResponse) {}
|
||||||
|
// 更新用户信息
|
||||||
|
rpc UpdateUserInfo(UpdateUserInfoRequest) returns (UpdateUserInfoResponse) {}
|
||||||
|
// 推广用户数量
|
||||||
|
rpc CountPromoterByInviteCode(CountPromoterByInviteCodeRequest) returns (CountPromoterByInviteCodeResponse) {}
|
||||||
|
// 根据推广码获取用户
|
||||||
|
rpc GetUserByInviteCode(GetUserByInviteCodeRequest) returns (GetUserByInviteCodeResponse) {}
|
||||||
|
// 获取推广上级
|
||||||
|
rpc GetPromoter(GetPromoterRequest) returns (GetPromoterResponse) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
message SearchMemberInfoRequest {
|
||||||
|
repeated string uids = 1;
|
||||||
|
string phone = 2;
|
||||||
|
string nickname = 3;
|
||||||
|
string email = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SearchMemberInfoResponse {
|
||||||
|
repeated string uids = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exists
|
||||||
|
|
||||||
|
message ExistsRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExistsResponse {
|
||||||
|
bool result = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryInfo
|
||||||
|
|
||||||
|
message QueryInfoRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
repeated string fields = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryInfoResponse {
|
||||||
|
bool exists = 1;
|
||||||
|
MemberItem item = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryIdentity
|
||||||
|
|
||||||
|
message QueryIdentityRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryIdentityResponse {
|
||||||
|
bool exists = 1;
|
||||||
|
MemberIdentityItem item = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// QueryBelong
|
||||||
|
|
||||||
|
message QueryBelongRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message QueryBelongResponse {
|
||||||
|
bool exists = 1;
|
||||||
|
MemberBelongItem item = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindUserInfo
|
||||||
|
|
||||||
|
message FindUserInfoRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
repeated string uids = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FindUserInfoResponse {
|
||||||
|
repeated MemberItem items = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindUserDisplay
|
||||||
|
|
||||||
|
message FindUserDisplayRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
repeated string uids = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FindUserDisplayResponse {
|
||||||
|
repeated MemberDisplayItem items = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindSelect
|
||||||
|
|
||||||
|
message FindSelectRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FindSelectResponse {
|
||||||
|
repeated MemberItem items = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindByPage
|
||||||
|
|
||||||
|
message FindByPageRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
int32 limit = 2;
|
||||||
|
int32 page = 3;
|
||||||
|
string uid = 4;
|
||||||
|
string name = 5;
|
||||||
|
string username = 6;
|
||||||
|
string nickname = 7;
|
||||||
|
string phone = 8;
|
||||||
|
string contact_phone = 9;
|
||||||
|
int64 enable = 10;
|
||||||
|
int64 created_at_start = 11;
|
||||||
|
int64 created_at_end = 12;
|
||||||
|
int64 logined_at_start = 13;
|
||||||
|
int64 logined_at_end = 14;
|
||||||
|
string market_source = 15;
|
||||||
|
int64 role_id = 16;
|
||||||
|
int64 test = 17;
|
||||||
|
int64 market_source_is_empty = 18;
|
||||||
|
repeated string uids = 19;
|
||||||
|
int64 os = 20;
|
||||||
|
int64 register_source = 21;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FindByPageResponse {
|
||||||
|
int64 total = 1;
|
||||||
|
repeated MemberItem items = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateEnable
|
||||||
|
|
||||||
|
message UpdateEnableRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
int64 enable = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateName
|
||||||
|
|
||||||
|
message UpdateNameRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
string name = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateNickname
|
||||||
|
|
||||||
|
message UpdateNicknameRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
string nickname = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateAvatar
|
||||||
|
|
||||||
|
message UpdateAvatarRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
string avatar = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateCreator
|
||||||
|
|
||||||
|
message UpdateCreatorRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
string creator = 3;
|
||||||
|
string creator_uid = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateLastModifier
|
||||||
|
|
||||||
|
message UpdateLastModifierRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
string modifier = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateAccessed
|
||||||
|
|
||||||
|
message UpdateAccessedRequest {
|
||||||
|
int64 identity = 1;
|
||||||
|
string uid = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MemberItem {
|
||||||
|
int64 id = 1;
|
||||||
|
string uid = 2;
|
||||||
|
string phone = 3; // 明文
|
||||||
|
string name = 4;
|
||||||
|
string username = 5;
|
||||||
|
string nickname = 6;
|
||||||
|
string contact_phone = 7;
|
||||||
|
int64 enable = 8;
|
||||||
|
int64 register_source = 9;
|
||||||
|
int64 created_at = 10;
|
||||||
|
int64 logined_at = 11;
|
||||||
|
string creator = 12;
|
||||||
|
string last_modifier = 13;
|
||||||
|
int64 modified_at = 14;
|
||||||
|
string market_source = 15;
|
||||||
|
int64 test = 16;
|
||||||
|
int64 accessed_at = 17;
|
||||||
|
string avatar = 18;
|
||||||
|
string creator_uid = 19;
|
||||||
|
bool nickname_init = 20;
|
||||||
|
int64 os = 21;
|
||||||
|
string app_id = 22;
|
||||||
|
string open_id = 23;
|
||||||
|
string extra1 = 24;
|
||||||
|
string phone_hidden = 25; // 隐藏
|
||||||
|
}
|
||||||
|
|
||||||
|
message MemberIdentityItem {
|
||||||
|
string uid = 1;
|
||||||
|
string name = 2;
|
||||||
|
string nickname = 3;
|
||||||
|
string avatar = 4;
|
||||||
|
int64 enable = 5;
|
||||||
|
int64 register_source = 6;
|
||||||
|
string market_source = 7;
|
||||||
|
bool nickname_init = 10;
|
||||||
|
int64 created_at = 20;
|
||||||
|
string invite_code = 21;
|
||||||
|
int32 is_promoter = 22;
|
||||||
|
string wechat_qrcode = 23;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MemberMiniItem {
|
||||||
|
int64 id = 1;
|
||||||
|
string uid = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MemberDisplayItem {
|
||||||
|
string uid = 1;
|
||||||
|
string display_name = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message MemberBelongItem {
|
||||||
|
string belong_uid = 1;
|
||||||
|
int64 belong_identity = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BelongReqItem{
|
||||||
|
string uid = 1;
|
||||||
|
int64 identity = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FindUserInfoByIdentityRequest{
|
||||||
|
repeated BelongReqItem uid_items = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message FindUserInfoByIdentityResponse{
|
||||||
|
repeated BelongRespItem items = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BelongRespItem {
|
||||||
|
string uid = 1;
|
||||||
|
string name = 2;
|
||||||
|
string username = 3;
|
||||||
|
string nickname = 4;
|
||||||
|
int64 identity = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateUserInfo
|
||||||
|
message UpdateUserInfoRequest {
|
||||||
|
int32 is_promoter = 1;
|
||||||
|
string wechat_qrcode = 2;
|
||||||
|
int64 identity = 3;
|
||||||
|
string uid = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message UpdateUserInfoResponse {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// CountPromoterByInviteCode
|
||||||
|
message CountPromoterByInviteCodeRequest{
|
||||||
|
string uid = 1;
|
||||||
|
int64 identity = 2;
|
||||||
|
}
|
||||||
|
message CountPromoterByInviteCodeResponse {
|
||||||
|
int64 count = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUserByInviteCode
|
||||||
|
message GetUserByInviteCodeRequest{
|
||||||
|
string invite_code = 1;
|
||||||
|
int64 identity = 2;
|
||||||
|
}
|
||||||
|
message GetUserByInviteCodeResponse {
|
||||||
|
MemberIdentityItem item = 1;
|
||||||
|
bool exists = 2;
|
||||||
|
}
|
||||||
|
// GetPromoter
|
||||||
|
message GetPromoterRequest{
|
||||||
|
string uid = 1;
|
||||||
|
int64 identity = 2;
|
||||||
|
}
|
||||||
|
message GetPromoterResponse {
|
||||||
|
MemberIdentityItem item = 1;
|
||||||
|
bool exists = 2;
|
||||||
|
}
|
||||||
@@ -0,0 +1,924 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.5.1
|
||||||
|
// - protoc v7.34.0
|
||||||
|
// source: xt-user/proto/user/user.proto
|
||||||
|
|
||||||
|
package user
|
||||||
|
|
||||||
|
import (
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 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 (
|
||||||
|
User_Exists_FullMethodName = "/micro.xt_user.user.User/Exists"
|
||||||
|
User_QueryInfo_FullMethodName = "/micro.xt_user.user.User/QueryInfo"
|
||||||
|
User_QueryIdentity_FullMethodName = "/micro.xt_user.user.User/QueryIdentity"
|
||||||
|
User_QueryBelong_FullMethodName = "/micro.xt_user.user.User/QueryBelong"
|
||||||
|
User_FindUserInfo_FullMethodName = "/micro.xt_user.user.User/FindUserInfo"
|
||||||
|
User_FindUserDisplay_FullMethodName = "/micro.xt_user.user.User/FindUserDisplay"
|
||||||
|
User_FindSelect_FullMethodName = "/micro.xt_user.user.User/FindSelect"
|
||||||
|
User_FindByPage_FullMethodName = "/micro.xt_user.user.User/FindByPage"
|
||||||
|
User_FindUserInfoByIdentity_FullMethodName = "/micro.xt_user.user.User/FindUserInfoByIdentity"
|
||||||
|
User_UpdateEnable_FullMethodName = "/micro.xt_user.user.User/UpdateEnable"
|
||||||
|
User_UpdateName_FullMethodName = "/micro.xt_user.user.User/UpdateName"
|
||||||
|
User_UpdateNickname_FullMethodName = "/micro.xt_user.user.User/UpdateNickname"
|
||||||
|
User_UpdateAvatar_FullMethodName = "/micro.xt_user.user.User/UpdateAvatar"
|
||||||
|
User_UpdateCreator_FullMethodName = "/micro.xt_user.user.User/UpdateCreator"
|
||||||
|
User_UpdateLastModifier_FullMethodName = "/micro.xt_user.user.User/UpdateLastModifier"
|
||||||
|
User_UpdateAccessed_FullMethodName = "/micro.xt_user.user.User/UpdateAccessed"
|
||||||
|
User_SearchMemberInfo_FullMethodName = "/micro.xt_user.user.User/SearchMemberInfo"
|
||||||
|
User_UpdateUserInfo_FullMethodName = "/micro.xt_user.user.User/UpdateUserInfo"
|
||||||
|
User_CountPromoterByInviteCode_FullMethodName = "/micro.xt_user.user.User/CountPromoterByInviteCode"
|
||||||
|
User_GetUserByInviteCode_FullMethodName = "/micro.xt_user.user.User/GetUserByInviteCode"
|
||||||
|
User_GetPromoter_FullMethodName = "/micro.xt_user.user.User/GetPromoter"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UserClient is the client API for User 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 UserClient interface {
|
||||||
|
// 查询账号是否已注册
|
||||||
|
Exists(ctx context.Context, in *ExistsRequest, opts ...grpc.CallOption) (*ExistsResponse, error)
|
||||||
|
// 查询用户信息
|
||||||
|
QueryInfo(ctx context.Context, in *QueryInfoRequest, opts ...grpc.CallOption) (*QueryInfoResponse, error)
|
||||||
|
// 查询用户信息
|
||||||
|
QueryIdentity(ctx context.Context, in *QueryIdentityRequest, opts ...grpc.CallOption) (*QueryIdentityResponse, error)
|
||||||
|
// 查询用户归属信息
|
||||||
|
QueryBelong(ctx context.Context, in *QueryBelongRequest, opts ...grpc.CallOption) (*QueryBelongResponse, error)
|
||||||
|
// 批量查询用户(头像,昵称)
|
||||||
|
FindUserInfo(ctx context.Context, in *FindUserInfoRequest, opts ...grpc.CallOption) (*FindUserInfoResponse, error)
|
||||||
|
// 批量查询用户(根据不同渠道显示不同的账号)
|
||||||
|
FindUserDisplay(ctx context.Context, in *FindUserDisplayRequest, opts ...grpc.CallOption) (*FindUserDisplayResponse, error)
|
||||||
|
// 下拉框专属列表
|
||||||
|
FindSelect(ctx context.Context, in *FindSelectRequest, opts ...grpc.CallOption) (*FindSelectResponse, error)
|
||||||
|
// Deprecated: 20240516 迁移到 user_list 下 分页查询用户列表
|
||||||
|
FindByPage(ctx context.Context, in *FindByPageRequest, opts ...grpc.CallOption) (*FindByPageResponse, error)
|
||||||
|
// 批量查询用户,按identity
|
||||||
|
FindUserInfoByIdentity(ctx context.Context, in *FindUserInfoByIdentityRequest, opts ...grpc.CallOption) (*FindUserInfoByIdentityResponse, error)
|
||||||
|
// 更新账号可用状态
|
||||||
|
UpdateEnable(ctx context.Context, in *UpdateEnableRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
|
// 更新姓名
|
||||||
|
UpdateName(ctx context.Context, in *UpdateNameRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
|
// 更新昵称
|
||||||
|
UpdateNickname(ctx context.Context, in *UpdateNicknameRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
|
// 更新头像
|
||||||
|
UpdateAvatar(ctx context.Context, in *UpdateAvatarRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
|
// 更新创建者
|
||||||
|
UpdateCreator(ctx context.Context, in *UpdateCreatorRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
|
// 更新最后修改者
|
||||||
|
UpdateLastModifier(ctx context.Context, in *UpdateLastModifierRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
|
// 更新最后访问时间
|
||||||
|
UpdateAccessed(ctx context.Context, in *UpdateAccessedRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
|
// 搜索手机号和昵称
|
||||||
|
SearchMemberInfo(ctx context.Context, in *SearchMemberInfoRequest, opts ...grpc.CallOption) (*SearchMemberInfoResponse, error)
|
||||||
|
// 更新用户信息
|
||||||
|
UpdateUserInfo(ctx context.Context, in *UpdateUserInfoRequest, opts ...grpc.CallOption) (*UpdateUserInfoResponse, error)
|
||||||
|
// 推广用户数量
|
||||||
|
CountPromoterByInviteCode(ctx context.Context, in *CountPromoterByInviteCodeRequest, opts ...grpc.CallOption) (*CountPromoterByInviteCodeResponse, error)
|
||||||
|
// 根据推广码获取用户
|
||||||
|
GetUserByInviteCode(ctx context.Context, in *GetUserByInviteCodeRequest, opts ...grpc.CallOption) (*GetUserByInviteCodeResponse, error)
|
||||||
|
// 获取推广上级
|
||||||
|
GetPromoter(ctx context.Context, in *GetPromoterRequest, opts ...grpc.CallOption) (*GetPromoterResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type userClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserClient(cc grpc.ClientConnInterface) UserClient {
|
||||||
|
return &userClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) Exists(ctx context.Context, in *ExistsRequest, opts ...grpc.CallOption) (*ExistsResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(ExistsResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_Exists_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) QueryInfo(ctx context.Context, in *QueryInfoRequest, opts ...grpc.CallOption) (*QueryInfoResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(QueryInfoResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_QueryInfo_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) QueryIdentity(ctx context.Context, in *QueryIdentityRequest, opts ...grpc.CallOption) (*QueryIdentityResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(QueryIdentityResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_QueryIdentity_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) QueryBelong(ctx context.Context, in *QueryBelongRequest, opts ...grpc.CallOption) (*QueryBelongResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(QueryBelongResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_QueryBelong_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) FindUserInfo(ctx context.Context, in *FindUserInfoRequest, opts ...grpc.CallOption) (*FindUserInfoResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(FindUserInfoResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_FindUserInfo_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) FindUserDisplay(ctx context.Context, in *FindUserDisplayRequest, opts ...grpc.CallOption) (*FindUserDisplayResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(FindUserDisplayResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_FindUserDisplay_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) FindSelect(ctx context.Context, in *FindSelectRequest, opts ...grpc.CallOption) (*FindSelectResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(FindSelectResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_FindSelect_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) FindByPage(ctx context.Context, in *FindByPageRequest, opts ...grpc.CallOption) (*FindByPageResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(FindByPageResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_FindByPage_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) FindUserInfoByIdentity(ctx context.Context, in *FindUserInfoByIdentityRequest, opts ...grpc.CallOption) (*FindUserInfoByIdentityResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(FindUserInfoByIdentityResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_FindUserInfoByIdentity_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) UpdateEnable(ctx context.Context, in *UpdateEnableRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(emptypb.Empty)
|
||||||
|
err := c.cc.Invoke(ctx, User_UpdateEnable_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) UpdateName(ctx context.Context, in *UpdateNameRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(emptypb.Empty)
|
||||||
|
err := c.cc.Invoke(ctx, User_UpdateName_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) UpdateNickname(ctx context.Context, in *UpdateNicknameRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(emptypb.Empty)
|
||||||
|
err := c.cc.Invoke(ctx, User_UpdateNickname_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) UpdateAvatar(ctx context.Context, in *UpdateAvatarRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(emptypb.Empty)
|
||||||
|
err := c.cc.Invoke(ctx, User_UpdateAvatar_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) UpdateCreator(ctx context.Context, in *UpdateCreatorRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(emptypb.Empty)
|
||||||
|
err := c.cc.Invoke(ctx, User_UpdateCreator_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) UpdateLastModifier(ctx context.Context, in *UpdateLastModifierRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(emptypb.Empty)
|
||||||
|
err := c.cc.Invoke(ctx, User_UpdateLastModifier_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) UpdateAccessed(ctx context.Context, in *UpdateAccessedRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(emptypb.Empty)
|
||||||
|
err := c.cc.Invoke(ctx, User_UpdateAccessed_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) SearchMemberInfo(ctx context.Context, in *SearchMemberInfoRequest, opts ...grpc.CallOption) (*SearchMemberInfoResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(SearchMemberInfoResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_SearchMemberInfo_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) UpdateUserInfo(ctx context.Context, in *UpdateUserInfoRequest, opts ...grpc.CallOption) (*UpdateUserInfoResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(UpdateUserInfoResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_UpdateUserInfo_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) CountPromoterByInviteCode(ctx context.Context, in *CountPromoterByInviteCodeRequest, opts ...grpc.CallOption) (*CountPromoterByInviteCodeResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(CountPromoterByInviteCodeResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_CountPromoterByInviteCode_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) GetUserByInviteCode(ctx context.Context, in *GetUserByInviteCodeRequest, opts ...grpc.CallOption) (*GetUserByInviteCodeResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(GetUserByInviteCodeResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_GetUserByInviteCode_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *userClient) GetPromoter(ctx context.Context, in *GetPromoterRequest, opts ...grpc.CallOption) (*GetPromoterResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(GetPromoterResponse)
|
||||||
|
err := c.cc.Invoke(ctx, User_GetPromoter_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserServer is the server API for User service.
|
||||||
|
// All implementations must embed UnimplementedUserServer
|
||||||
|
// for forward compatibility.
|
||||||
|
type UserServer interface {
|
||||||
|
// 查询账号是否已注册
|
||||||
|
Exists(context.Context, *ExistsRequest) (*ExistsResponse, error)
|
||||||
|
// 查询用户信息
|
||||||
|
QueryInfo(context.Context, *QueryInfoRequest) (*QueryInfoResponse, error)
|
||||||
|
// 查询用户信息
|
||||||
|
QueryIdentity(context.Context, *QueryIdentityRequest) (*QueryIdentityResponse, error)
|
||||||
|
// 查询用户归属信息
|
||||||
|
QueryBelong(context.Context, *QueryBelongRequest) (*QueryBelongResponse, error)
|
||||||
|
// 批量查询用户(头像,昵称)
|
||||||
|
FindUserInfo(context.Context, *FindUserInfoRequest) (*FindUserInfoResponse, error)
|
||||||
|
// 批量查询用户(根据不同渠道显示不同的账号)
|
||||||
|
FindUserDisplay(context.Context, *FindUserDisplayRequest) (*FindUserDisplayResponse, error)
|
||||||
|
// 下拉框专属列表
|
||||||
|
FindSelect(context.Context, *FindSelectRequest) (*FindSelectResponse, error)
|
||||||
|
// Deprecated: 20240516 迁移到 user_list 下 分页查询用户列表
|
||||||
|
FindByPage(context.Context, *FindByPageRequest) (*FindByPageResponse, error)
|
||||||
|
// 批量查询用户,按identity
|
||||||
|
FindUserInfoByIdentity(context.Context, *FindUserInfoByIdentityRequest) (*FindUserInfoByIdentityResponse, error)
|
||||||
|
// 更新账号可用状态
|
||||||
|
UpdateEnable(context.Context, *UpdateEnableRequest) (*emptypb.Empty, error)
|
||||||
|
// 更新姓名
|
||||||
|
UpdateName(context.Context, *UpdateNameRequest) (*emptypb.Empty, error)
|
||||||
|
// 更新昵称
|
||||||
|
UpdateNickname(context.Context, *UpdateNicknameRequest) (*emptypb.Empty, error)
|
||||||
|
// 更新头像
|
||||||
|
UpdateAvatar(context.Context, *UpdateAvatarRequest) (*emptypb.Empty, error)
|
||||||
|
// 更新创建者
|
||||||
|
UpdateCreator(context.Context, *UpdateCreatorRequest) (*emptypb.Empty, error)
|
||||||
|
// 更新最后修改者
|
||||||
|
UpdateLastModifier(context.Context, *UpdateLastModifierRequest) (*emptypb.Empty, error)
|
||||||
|
// 更新最后访问时间
|
||||||
|
UpdateAccessed(context.Context, *UpdateAccessedRequest) (*emptypb.Empty, error)
|
||||||
|
// 搜索手机号和昵称
|
||||||
|
SearchMemberInfo(context.Context, *SearchMemberInfoRequest) (*SearchMemberInfoResponse, error)
|
||||||
|
// 更新用户信息
|
||||||
|
UpdateUserInfo(context.Context, *UpdateUserInfoRequest) (*UpdateUserInfoResponse, error)
|
||||||
|
// 推广用户数量
|
||||||
|
CountPromoterByInviteCode(context.Context, *CountPromoterByInviteCodeRequest) (*CountPromoterByInviteCodeResponse, error)
|
||||||
|
// 根据推广码获取用户
|
||||||
|
GetUserByInviteCode(context.Context, *GetUserByInviteCodeRequest) (*GetUserByInviteCodeResponse, error)
|
||||||
|
// 获取推广上级
|
||||||
|
GetPromoter(context.Context, *GetPromoterRequest) (*GetPromoterResponse, error)
|
||||||
|
mustEmbedUnimplementedUserServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedUserServer 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 UnimplementedUserServer struct{}
|
||||||
|
|
||||||
|
func (UnimplementedUserServer) Exists(context.Context, *ExistsRequest) (*ExistsResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method Exists not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) QueryInfo(context.Context, *QueryInfoRequest) (*QueryInfoResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method QueryInfo not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) QueryIdentity(context.Context, *QueryIdentityRequest) (*QueryIdentityResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method QueryIdentity not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) QueryBelong(context.Context, *QueryBelongRequest) (*QueryBelongResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method QueryBelong not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) FindUserInfo(context.Context, *FindUserInfoRequest) (*FindUserInfoResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method FindUserInfo not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) FindUserDisplay(context.Context, *FindUserDisplayRequest) (*FindUserDisplayResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method FindUserDisplay not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) FindSelect(context.Context, *FindSelectRequest) (*FindSelectResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method FindSelect not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) FindByPage(context.Context, *FindByPageRequest) (*FindByPageResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method FindByPage not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) FindUserInfoByIdentity(context.Context, *FindUserInfoByIdentityRequest) (*FindUserInfoByIdentityResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method FindUserInfoByIdentity not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) UpdateEnable(context.Context, *UpdateEnableRequest) (*emptypb.Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateEnable not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) UpdateName(context.Context, *UpdateNameRequest) (*emptypb.Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateName not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) UpdateNickname(context.Context, *UpdateNicknameRequest) (*emptypb.Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateNickname not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) UpdateAvatar(context.Context, *UpdateAvatarRequest) (*emptypb.Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateAvatar not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) UpdateCreator(context.Context, *UpdateCreatorRequest) (*emptypb.Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateCreator not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) UpdateLastModifier(context.Context, *UpdateLastModifierRequest) (*emptypb.Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateLastModifier not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) UpdateAccessed(context.Context, *UpdateAccessedRequest) (*emptypb.Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateAccessed not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) SearchMemberInfo(context.Context, *SearchMemberInfoRequest) (*SearchMemberInfoResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method SearchMemberInfo not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) UpdateUserInfo(context.Context, *UpdateUserInfoRequest) (*UpdateUserInfoResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method UpdateUserInfo not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) CountPromoterByInviteCode(context.Context, *CountPromoterByInviteCodeRequest) (*CountPromoterByInviteCodeResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method CountPromoterByInviteCode not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) GetUserByInviteCode(context.Context, *GetUserByInviteCodeRequest) (*GetUserByInviteCodeResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetUserByInviteCode not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) GetPromoter(context.Context, *GetPromoterRequest) (*GetPromoterResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetPromoter not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {}
|
||||||
|
func (UnimplementedUserServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
|
// UnsafeUserServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to UserServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeUserServer interface {
|
||||||
|
mustEmbedUnimplementedUserServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer) {
|
||||||
|
// If the following call pancis, it indicates UnimplementedUserServer 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(&User_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_Exists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(ExistsRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).Exists(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_Exists_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).Exists(ctx, req.(*ExistsRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_QueryInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(QueryInfoRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).QueryInfo(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_QueryInfo_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).QueryInfo(ctx, req.(*QueryInfoRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_QueryIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(QueryIdentityRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).QueryIdentity(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_QueryIdentity_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).QueryIdentity(ctx, req.(*QueryIdentityRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_QueryBelong_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(QueryBelongRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).QueryBelong(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_QueryBelong_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).QueryBelong(ctx, req.(*QueryBelongRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_FindUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(FindUserInfoRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).FindUserInfo(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_FindUserInfo_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).FindUserInfo(ctx, req.(*FindUserInfoRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_FindUserDisplay_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(FindUserDisplayRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).FindUserDisplay(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_FindUserDisplay_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).FindUserDisplay(ctx, req.(*FindUserDisplayRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_FindSelect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(FindSelectRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).FindSelect(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_FindSelect_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).FindSelect(ctx, req.(*FindSelectRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_FindByPage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(FindByPageRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).FindByPage(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_FindByPage_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).FindByPage(ctx, req.(*FindByPageRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_FindUserInfoByIdentity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(FindUserInfoByIdentityRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).FindUserInfoByIdentity(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_FindUserInfoByIdentity_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).FindUserInfoByIdentity(ctx, req.(*FindUserInfoByIdentityRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_UpdateEnable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UpdateEnableRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).UpdateEnable(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_UpdateEnable_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).UpdateEnable(ctx, req.(*UpdateEnableRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_UpdateName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UpdateNameRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).UpdateName(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_UpdateName_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).UpdateName(ctx, req.(*UpdateNameRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_UpdateNickname_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UpdateNicknameRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).UpdateNickname(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_UpdateNickname_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).UpdateNickname(ctx, req.(*UpdateNicknameRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_UpdateAvatar_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UpdateAvatarRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).UpdateAvatar(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_UpdateAvatar_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).UpdateAvatar(ctx, req.(*UpdateAvatarRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_UpdateCreator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UpdateCreatorRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).UpdateCreator(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_UpdateCreator_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).UpdateCreator(ctx, req.(*UpdateCreatorRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_UpdateLastModifier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UpdateLastModifierRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).UpdateLastModifier(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_UpdateLastModifier_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).UpdateLastModifier(ctx, req.(*UpdateLastModifierRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_UpdateAccessed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UpdateAccessedRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).UpdateAccessed(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_UpdateAccessed_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).UpdateAccessed(ctx, req.(*UpdateAccessedRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_SearchMemberInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(SearchMemberInfoRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).SearchMemberInfo(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_SearchMemberInfo_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).SearchMemberInfo(ctx, req.(*SearchMemberInfoRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_UpdateUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(UpdateUserInfoRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).UpdateUserInfo(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_UpdateUserInfo_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).UpdateUserInfo(ctx, req.(*UpdateUserInfoRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_CountPromoterByInviteCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CountPromoterByInviteCodeRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).CountPromoterByInviteCode(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_CountPromoterByInviteCode_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).CountPromoterByInviteCode(ctx, req.(*CountPromoterByInviteCodeRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_GetUserByInviteCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetUserByInviteCodeRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).GetUserByInviteCode(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_GetUserByInviteCode_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).GetUserByInviteCode(ctx, req.(*GetUserByInviteCodeRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _User_GetPromoter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetPromoterRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UserServer).GetPromoter(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: User_GetPromoter_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UserServer).GetPromoter(ctx, req.(*GetPromoterRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// User_ServiceDesc is the grpc.ServiceDesc for User service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var User_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "micro.xt_user.user.User",
|
||||||
|
HandlerType: (*UserServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "Exists",
|
||||||
|
Handler: _User_Exists_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "QueryInfo",
|
||||||
|
Handler: _User_QueryInfo_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "QueryIdentity",
|
||||||
|
Handler: _User_QueryIdentity_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "QueryBelong",
|
||||||
|
Handler: _User_QueryBelong_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "FindUserInfo",
|
||||||
|
Handler: _User_FindUserInfo_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "FindUserDisplay",
|
||||||
|
Handler: _User_FindUserDisplay_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "FindSelect",
|
||||||
|
Handler: _User_FindSelect_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "FindByPage",
|
||||||
|
Handler: _User_FindByPage_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "FindUserInfoByIdentity",
|
||||||
|
Handler: _User_FindUserInfoByIdentity_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UpdateEnable",
|
||||||
|
Handler: _User_UpdateEnable_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UpdateName",
|
||||||
|
Handler: _User_UpdateName_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UpdateNickname",
|
||||||
|
Handler: _User_UpdateNickname_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UpdateAvatar",
|
||||||
|
Handler: _User_UpdateAvatar_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UpdateCreator",
|
||||||
|
Handler: _User_UpdateCreator_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UpdateLastModifier",
|
||||||
|
Handler: _User_UpdateLastModifier_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UpdateAccessed",
|
||||||
|
Handler: _User_UpdateAccessed_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "SearchMemberInfo",
|
||||||
|
Handler: _User_SearchMemberInfo_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "UpdateUserInfo",
|
||||||
|
Handler: _User_UpdateUserInfo_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "CountPromoterByInviteCode",
|
||||||
|
Handler: _User_CountPromoterByInviteCode_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetUserByInviteCode",
|
||||||
|
Handler: _User_GetUserByInviteCode_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetPromoter",
|
||||||
|
Handler: _User_GetPromoter_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "xt-user/proto/user/user.proto",
|
||||||
|
}
|
||||||
Reference in new issue
Block a user