Initial commit

This commit is contained in:
Donny
2019-04-22 20:46:32 +08:00
commit 49ab8aadd1
25441 changed files with 4055000 additions and 0 deletions

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 = "v0_proto",
srcs = ["Conf.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "v0_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_grpc"],
importpath = "go-common/app/service/live/userext/api/liverpc/v0",
proto = ":v0_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = ["Conf.liverpc.go"],
embed = [":v0_go_proto"],
importpath = "go-common/app/service/live/userext/api/liverpc/v0",
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,75 @@
// Code generated by protoc-gen-liverpc v0.1, DO NOT EDIT.
// source: v0/Conf.proto
/*
Package v0 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:
v0/Conf.proto
*/
package v0
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:
// ==============
// Conf Interface
// ==============
type ConfRPCClient interface {
// * 设置配置仓库
//
Set(ctx context.Context, req *ConfSetReq, opts ...liverpc.CallOption) (resp *ConfSetResp, err error)
// * 查看用户配置
//
Get(ctx context.Context, req *ConfGetReq, opts ...liverpc.CallOption) (resp *ConfGetResp, err error)
}
// ====================
// Conf Live Rpc Client
// ====================
type confRPCClient struct {
client *liverpc.Client
}
// NewConfRPCClient creates a client that implements the ConfRPCClient interface.
func NewConfRPCClient(client *liverpc.Client) ConfRPCClient {
return &confRPCClient{
client: client,
}
}
func (c *confRPCClient) Set(ctx context.Context, in *ConfSetReq, opts ...liverpc.CallOption) (*ConfSetResp, error) {
out := new(ConfSetResp)
err := doRPCRequest(ctx, c.client, 0, "Conf.set", in, out, opts)
if err != nil {
return nil, err
}
return out, nil
}
func (c *confRPCClient) Get(ctx context.Context, in *ConfGetReq, opts ...liverpc.CallOption) (*ConfGetResp, error) {
out := new(ConfGetResp)
err := doRPCRequest(ctx, c.client, 0, "Conf.get", in, out, opts)
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, opts []liverpc.CallOption) (err error) {
err = client.Call(ctx, version, method, in, out, opts...)
return
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,71 @@
syntax = "proto3";
package userext.v0;
option go_package = "v0";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
service Conf {
/** 设置配置仓库
*
*/
rpc set (ConfSetReq) returns (ConfSetResp);
/** 查看用户配置
*
*/
rpc get (ConfGetReq) returns (ConfGetResp);
}
message ConfSetReq {
// 参数结构
repeated Var var_list = 1 [(gogoproto.jsontag) = "var_list"];
message Var {
// 用户id
int64 uid = 1 [(gogoproto.jsontag) = "uid"];
// 目标id,主播uid、房间号etc
int64 target_id = 2 [(gogoproto.jsontag) = "target_id"];
// type请在 “配置仓库标识申请” 中自行分配
int64 type = 3 [(gogoproto.jsontag) = "type"];
// 设置内容
string content = 4 [(gogoproto.jsontag) = "content"];
}
}
message ConfSetResp {
// code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
//
Data data = 3 [(gogoproto.jsontag) = "data"];
message Data {
}
}
message ConfGetReq {
// 用户id
int64 uid = 1 [(gogoproto.jsontag) = "uid"];
// 目标id,主播uid、房间号etc
int64 target_id = 2 [(gogoproto.jsontag) = "target_id"];
// type请在 “配置仓库标识申请” 中自行分配
repeated int64 type = 3 [(gogoproto.jsontag) = "type"];
}
message ConfGetResp {
// code
int64 code = 1 [(gogoproto.jsontag) = "code"];
// msg
string msg = 2 [(gogoproto.jsontag) = "msg"];
// type -> content
map<string, string> data = 3 [(gogoproto.jsontag) = "data"];
}