Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["client.go"],
importpath = "go-common/app/service/live/user/api/liverpc",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/live/user/api/liverpc/v3:go_default_library",
"//library/net/rpc/liverpc:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//app/service/live/user/api/liverpc/v3:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,42 @@
// Code generated by liverpcgen, DO NOT EDIT.
// source: *.proto files under this directory
// If you want to change this file, Please see README in go-common/app/tool/liverpc/protoc-gen-liverpc/
package liverpc
import (
"go-common/app/service/live/user/api/liverpc/v3"
"go-common/library/net/rpc/liverpc"
)
// Client that represents a liverpc user service api
type Client struct {
cli *liverpc.Client
// V3User presents the controller in liverpc
V3User v3.User
}
// DiscoveryAppId the discovery id is not the tree name
var DiscoveryAppId = "live.user"
// New a Client that represents a liverpc live.user service api
// conf can be empty, and it will use discovery to find service by default
// conf.AppID will be overwrite by a fixed value DiscoveryAppId
// therefore is no need to set
func New(conf *liverpc.ClientConfig) *Client {
if conf == nil {
conf = &liverpc.ClientConfig{}
}
conf.AppID = DiscoveryAppId
var realCli = liverpc.NewClient(conf)
cli := &Client{cli: realCli}
cli.clientInit(realCli)
return cli
}
func (cli *Client) GetRawCli() *liverpc.Client {
return cli.cli
}
func (cli *Client) clientInit(realCli *liverpc.Client) {
cli.V3User = v3.NewUserRpcClient(realCli)
}

View File

@@ -0,0 +1,56 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
proto_library(
name = "v3_proto",
srcs = ["User.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "v3_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_grpc"],
importpath = "go-common/app/service/live/user/api/liverpc/v3",
proto = ":v3_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = ["User.liverpc.go"],
embed = [":v3_go_proto"],
importpath = "go-common/app/service/live/user/api/liverpc/v3",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//library/net/rpc/liverpc:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,76 @@
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
// source: v3/User.proto
/*
Package v3 is a generated liverpc stub package.
This code was generated with go-common/app/tool/liverpc/protoc-gen-liverpc v0.1.
It is generated from these files:
v3/User.proto
*/
package v3
import context "context"
import proto "github.com/golang/protobuf/proto"
import "go-common/library/net/rpc/liverpc"
var _ proto.Message // generate to suppress unused imports
// Imports only used by utility functions:
// ==============
// User Interface
// ==============
type User interface {
// * uid获取房间信息
//
GetMultiple(context.Context, *UserGetMultipleReq) (*UserGetMultipleResp, error)
// * uid获取房间信息
//
GetUserLevelInfo(context.Context, *UserGetUserLevelInfoReq) (*UserGetUserLevelInfoResp, error)
}
// ====================
// User Live Rpc Client
// ====================
type userRpcClient struct {
client *liverpc.Client
}
// NewUserRpcClient creates a Rpc client that implements the User interface.
// It communicates using Rpc and can be configured with a custom HTTPClient.
func NewUserRpcClient(client *liverpc.Client) User {
return &userRpcClient{
client: client,
}
}
func (c *userRpcClient) GetMultiple(ctx context.Context, in *UserGetMultipleReq) (*UserGetMultipleResp, error) {
out := new(UserGetMultipleResp)
err := doRpcRequest(ctx, c.client, 3, "User.getMultiple", in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userRpcClient) GetUserLevelInfo(ctx context.Context, in *UserGetUserLevelInfoReq) (*UserGetUserLevelInfoResp, error) {
out := new(UserGetUserLevelInfoResp)
err := doRpcRequest(ctx, c.client, 3, "User.getUserLevelInfo", in, out)
if err != nil {
return nil, err
}
return out, nil
}
// =====
// Utils
// =====
func doRpcRequest(ctx context.Context, client *liverpc.Client, version int, method string, in, out proto.Message) (err error) {
err = client.Call(ctx, version, method, in, out)
return
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,130 @@
syntax = "proto3";
package user.v3;
option go_package = "v3";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
service User {
/** uid获取房间信息
*
*/
rpc getMultiple (UserGetMultipleReq) returns (UserGetMultipleResp);
/** uid获取房间信息
*
*/
rpc getUserLevelInfo (UserGetUserLevelInfoReq) returns (UserGetUserLevelInfoResp);
}
message UserGetMultipleReq {
// 用户id
repeated int64 uids = 1 [(gogoproto.jsontag) = "uids"];
// 属性
repeated string attributes = 2 [(gogoproto.jsontag) = "attributes"];
}
message UserGetMultipleResp {
// code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
map<int64, UserInfo> data = 3 [(gogoproto.jsontag) = "data"];
message Official_verify {
//
int64 type = 1 [(gogoproto.jsontag) = "type"];
//
string desc = 2 [(gogoproto.jsontag) = "desc"];
//
int64 role = 3 [(gogoproto.jsontag) = "role"];
}
message Info {
// uid
int64 uid = 1 [(gogoproto.jsontag) = "uid"];
// 昵称
string uname = 2 [(gogoproto.jsontag) = "uname"];
// 头像
string face = 3 [(gogoproto.jsontag) = "face"];
// 等级
int64 rank = 4 [(gogoproto.jsontag) = "rank"];
// 用户id
int64 platform_user_level = 5 [(gogoproto.jsontag) = "platform_user_level"];
// 人气值
int64 mobile_verify = 6 [(gogoproto.jsontag) = "mobile_verify"];
// 认证
Official_verify official_verify = 7 [(gogoproto.jsontag) = "official_verify"];
// 类型
int64 vip_type = 8 [(gogoproto.jsontag) = "vip_type"];
// 年龄
int64 gender = 9 [(gogoproto.jsontag) = "gender"];
}
message Master_level {
//
int64 level = 1 [(gogoproto.jsontag) = "level"];
//
repeated int64 current = 2 [(gogoproto.jsontag) = "current"];
//
repeated int64 next = 3 [(gogoproto.jsontag) = "next"];
//
int64 color = 4 [(gogoproto.jsontag) = "color"];
}
message Exp {
//
int64 cost = 1 [(gogoproto.jsontag) = "cost"];
//
int64 rcost = 2 [(gogoproto.jsontag) = "rcost"];
//
int64 user_level = 3 [(gogoproto.jsontag) = "user_level"];
//
Master_level master_level = 4 [(gogoproto.jsontag) = "master_level"];
//
int64 color = 5 [(gogoproto.jsontag) = "color"];
//
int64 ul_cost = 6 [(gogoproto.jsontag) = "ul_cost"];
//
int64 unext = 7 [(gogoproto.jsontag) = "unext"];
//
int64 rnext = 8 [(gogoproto.jsontag) = "rnext"];
}
message UserInfo {
// 直播间标题
Info info = 1 [(gogoproto.jsontag) = "info"];
// 直播间标题
Exp exp = 2 [(gogoproto.jsontag) = "exp"];
}
}
message UserGetUserLevelInfoReq {
// 用户id
int64 uid = 1 [(gogoproto.jsontag) = "uid"];
}
message UserGetUserLevelInfoResp {
// code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
Data data = 3 [(gogoproto.jsontag) = "data"];
message Data {
//
int64 level = 1 [(gogoproto.jsontag) = "level"];
//
int64 exp = 2 [(gogoproto.jsontag) = "exp"];
//
int64 color = 3 [(gogoproto.jsontag) = "color"];
}
}