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,64 @@
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 = "api_proto",
srcs = ["api.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "api_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_grpc"],
importpath = "go-common/app/service/main/relation/api",
proto = ":api_proto",
tags = ["automanaged"],
deps = [
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
],
)
go_library(
name = "go_default_library",
srcs = [
"client.go",
"copy_autogenerated.go",
],
embed = [":api_go_proto"],
importpath = "go-common/app/service/main/relation/api",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/relation/model:go_default_library",
"//library/net/rpc/warden:go_default_library",
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@org_golang_google_grpc//: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"],
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,217 @@
// +bili:type=service
syntax = "proto3";
package relation.service;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option go_package = "api";
service Relation {
rpc Relation(RelationReq) returns (FollowingReply);
rpc Relations(RelationsReq) returns (FollowingMapReply);
rpc Stat(MidReq) returns (StatReply);
rpc Stats(MidsReq) returns (StatsReply);
rpc Attentions(MidReq) returns (FollowingsReply);
rpc Followings(MidReq) returns (FollowingsReply);
rpc AddFollowing(FollowingReq) returns (EmptyReply);
rpc DelFollowing(FollowingReq) returns (EmptyReply);
rpc Whispers(MidReq) returns (FollowingsReply);
rpc AddWhisper(FollowingReq) returns (EmptyReply);
rpc DelWhisper(FollowingReq) returns (EmptyReply);
rpc Blacks(MidReq) returns (FollowingsReply);
rpc AddBlack(FollowingReq) returns (EmptyReply);
rpc DelBlack(FollowingReq) returns (EmptyReply);
rpc Followers(MidReq) returns (FollowingsReply);
rpc DelFollower(FollowingReq) returns (EmptyReply);
rpc Tag(TagIdReq) returns (TagReply);
rpc Tags(MidReq) returns (TagsCountReply);
rpc UserTag(RelationReq) returns (UserTagReply);
rpc CreateTag(TagReq) returns (CreateTagReply);
rpc UpdateTag(TagUpdateReq) returns (EmptyReply);
rpc DelTag(TagDelReq) returns (EmptyReply);
rpc TagsAddUsers(TagsMoveUsersReq) returns (EmptyReply);
rpc TagsCopyUsers(TagsMoveUsersReq) returns (EmptyReply);
rpc TagsMoveUsers(TagsMoveUsersReq) returns (EmptyReply);
rpc Prompt(PromptReq) returns (PromptReply);
rpc ClosePrompt(PromptReq) returns (EmptyReply);
rpc AddSpecial(FollowingReq) returns (EmptyReply);
rpc DelSpecial(FollowingReq) returns (EmptyReply);
rpc Special(MidReq) returns (SpecialReply);
rpc FollowersUnread(MidReq) returns (FollowersUnreadReply);
rpc FollowersUnreadCount(MidReq) returns (FollowersUnreadCountReply);
rpc AchieveGet(AchieveGetReq) returns (AchieveGetReply);
rpc Achieve(AchieveReq) returns (AchieveReply);
rpc ResetFollowersUnread(MidReq) returns (EmptyReply);
rpc ResetFollowersUnreadCount(MidReq) returns (EmptyReply);
rpc DisableFollowerNotify(MidReq) returns (EmptyReply);
rpc EnableFollowerNotify(MidReq) returns (EmptyReply);
rpc FollowerNotifySetting(MidReq) returns (FollowerNotifySettingReply);
rpc SameFollowings(SameFollowingReq) returns (FollowingsReply);
}
message RelationReq {
int64 mid = 1;
int64 fid = 2;
string real_ip = 3;
}
// +bili:deepcopy-gen=true
// +bili:deepcopy-gen:structs=go-common/app/service/main/relation/model.Following
message FollowingReply {
int64 mid = 1 [ (gogoproto.jsontag) = "mid" ];
uint32 attribute = 2 [ (gogoproto.jsontag) = "attribute" ];
uint32 source = 3 [ (gogoproto.jsontag) = "-" ];
int64 ctime = 4 [
(gogoproto.jsontag) = "-",
(gogoproto.casttype) = "go-common/library/time.Time",
(gogoproto.customname) = "CTime"
];
int64 mtime = 5 [
(gogoproto.jsontag) = "mtime",
(gogoproto.casttype) = "go-common/library/time.Time",
(gogoproto.customname) = "MTime"
];
repeated int64 tag = 6 [ (gogoproto.jsontag) = "tag" ];
int32 special = 7 [ (gogoproto.jsontag) = "special" ];
}
message RelationsReq {
int64 mid = 1;
repeated int64 fid = 2;
string real_ip = 3;
}
message FollowingMapReply { map<int64, FollowingReply> following_map = 1; }
message FollowingsReply { repeated FollowingReply following_list = 1; }
message MidReq {
int64 mid = 1;
string real_ip = 2;
}
// +bili:deepcopy-gen=true
// +bili:deepcopy-gen:structs=go-common/app/service/main/relation/model.Stat
message StatReply {
int64 mid = 1 [ (gogoproto.jsontag) = "mid" ];
int64 following = 2 [ (gogoproto.jsontag) = "following" ];
int64 whisper = 3 [ (gogoproto.jsontag) = "whisper" ];
int64 black = 4 [ (gogoproto.jsontag) = "black" ];
int64 follower = 5 [ (gogoproto.jsontag) = "follower" ];
int64 ctime = 6 [
(gogoproto.jsontag) = "-",
(gogoproto.casttype) = "go-common/library/time.Time",
(gogoproto.customname) = "CTime"
];
int64 mtime = 7 [
(gogoproto.jsontag) = "-",
(gogoproto.casttype) = "go-common/library/time.Time",
(gogoproto.customname) = "MTime"
];
}
message MidsReq {
repeated int64 mids = 1;
string real_ip = 2;
}
message StatsReply { map<int64, StatReply> stat_reply_map = 1; }
message FollowingReq {
int64 mid = 1;
int64 fid = 2;
uint32 source = 3 [ (gogoproto.casttype) = "uint8" ];
string real_ip = 4;
int32 action = 5 [ (gogoproto.casttype) = "int8" ];
map<string, string> infoc = 6;
}
message EmptyReply {}
// ArgTagId tag id
message TagIdReq {
int64 mid = 1;
int64 tag_id = 2;
string real_ip = 3;
}
message TagReply { repeated int64 mids = 1; }
// +bili:deepcopy-gen=true
// +bili:deepcopy-gen:structs=go-common/app/service/main/relation/model.TagCount
message TagCountReply {
int64 tagid = 1 [ (gogoproto.jsontag) = "tagid" ];
string name = 2 [ (gogoproto.jsontag) = "name" ];
int64 count = 3 [ (gogoproto.jsontag) = "count" ];
}
message TagsCountReply { repeated TagCountReply tag_count_list = 1; }
message UserTagReply { map<int64, string> tags = 1; }
message TagReq {
int64 mid = 1;
string tag = 2;
string real_ip = 3;
}
message TagUpdateReq {
int64 mid = 1;
int64 tag_id = 2;
string new = 3;
string real_ip = 4;
}
message TagDelReq {
int64 mid = 1;
int64 tag_id = 2;
string real_ip = 3;
}
message TagsMoveUsersReq {
int64 mid = 1;
int64 before_id = 2;
string after_tag_ids = 3;
string fids = 4;
string real_ip = 5;
}
message PromptReq {
int64 mid = 1;
int64 fid = 2;
int32 btype = 3 [ (gogoproto.casttype) = "int8" ];
}
message CreateTagReply { int64 tag_id = 1; }
message PromptReply { bool success = 1; }
message FollowersUnreadReply { bool has_unread = 1; }
message FollowersUnreadCountReply { int64 unread_count = 1; }
message SpecialReply { repeated int64 mids = 1; }
message AchieveGetReq {
string award = 1;
int64 mid = 2;
}
message AchieveGetReply { string awardToken = 1; }
message AchieveReq { string awardToken = 1; }
message AchieveReply {
string award = 1;
int64 mid = 2;
}
message FollowerNotifySettingReply {
int64 mid = 1;
bool enabled = 2;
}
message SameFollowingReq {
int64 mid = 1;
int64 mid2 = 2;
}

View File

@@ -0,0 +1,22 @@
package api
import (
"context"
"google.golang.org/grpc"
"go-common/library/net/rpc/warden"
)
// AppID AppID
const AppID = "account.service.relation"
// NewClient new member grpc client
func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (RelationClient, error) {
client := warden.NewClient(cfg, opts...)
conn, err := client.Dial(context.Background(), "discovery://default/"+AppID)
if err != nil {
return nil, err
}
return NewRelationClient(conn), nil
}

View File

@@ -0,0 +1,222 @@
// Code generated by deepcopy-gen. DO NOT EDIT.
package api
import (
model "go-common/app/service/main/relation/model"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FollowingReply) DeepCopyInto(out *FollowingReply) {
*out = *in
if in.Tag != nil {
in, out := &in.Tag, &out.Tag
*out = make([]int64, len(*in))
copy(*out, *in)
}
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
if in.XXX_unrecognized != nil {
in, out := &in.XXX_unrecognized, &out.XXX_unrecognized
*out = make([]byte, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FollowingReply.
func (in *FollowingReply) DeepCopy() *FollowingReply {
if in == nil {
return nil
}
out := new(FollowingReply)
in.DeepCopyInto(out)
return out
}
// DeepCopyAsIntoFollowing is an autogenerated deepcopy function, copying the receiver, writing into model.Following.
func (in *FollowingReply) DeepCopyAsIntoFollowing(out *model.Following) {
out.Mid = in.Mid
out.Attribute = in.Attribute
out.Source = in.Source
out.CTime = in.CTime
out.MTime = in.MTime
if in.Tag != nil {
in, out := &in.Tag, &out.Tag
*out = make([]int64, len(*in))
copy(*out, *in)
}
out.Special = in.Special
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
if in.XXX_unrecognized != nil {
in, out := &in.XXX_unrecognized, &out.XXX_unrecognized
*out = make([]byte, len(*in))
copy(*out, *in)
}
out.XXX_sizecache = in.XXX_sizecache
return
}
// DeepCopyFromFollowing is an autogenerated deepcopy function, copying the receiver, writing into model.Following.
func (out *FollowingReply) DeepCopyFromFollowing(in *model.Following) {
out.Mid = in.Mid
out.Attribute = in.Attribute
out.Source = in.Source
out.CTime = in.CTime
out.MTime = in.MTime
if in.Tag != nil {
in, out := &in.Tag, &out.Tag
*out = make([]int64, len(*in))
copy(*out, *in)
}
out.Special = in.Special
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
if in.XXX_unrecognized != nil {
in, out := &in.XXX_unrecognized, &out.XXX_unrecognized
*out = make([]byte, len(*in))
copy(*out, *in)
}
out.XXX_sizecache = in.XXX_sizecache
return
}
// DeepCopyAsFollowing is an autogenerated deepcopy function, copying the receiver, creating a new model.Following.
func (in *FollowingReply) DeepCopyAsFollowing() *model.Following {
if in == nil {
return nil
}
out := new(model.Following)
in.DeepCopyAsIntoFollowing(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *StatReply) DeepCopyInto(out *StatReply) {
*out = *in
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
if in.XXX_unrecognized != nil {
in, out := &in.XXX_unrecognized, &out.XXX_unrecognized
*out = make([]byte, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatReply.
func (in *StatReply) DeepCopy() *StatReply {
if in == nil {
return nil
}
out := new(StatReply)
in.DeepCopyInto(out)
return out
}
// DeepCopyAsIntoStat is an autogenerated deepcopy function, copying the receiver, writing into model.Stat.
func (in *StatReply) DeepCopyAsIntoStat(out *model.Stat) {
out.Mid = in.Mid
out.Following = in.Following
out.Whisper = in.Whisper
out.Black = in.Black
out.Follower = in.Follower
out.CTime = in.CTime
out.MTime = in.MTime
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
if in.XXX_unrecognized != nil {
in, out := &in.XXX_unrecognized, &out.XXX_unrecognized
*out = make([]byte, len(*in))
copy(*out, *in)
}
out.XXX_sizecache = in.XXX_sizecache
return
}
// DeepCopyFromStat is an autogenerated deepcopy function, copying the receiver, writing into model.Stat.
func (out *StatReply) DeepCopyFromStat(in *model.Stat) {
out.Mid = in.Mid
out.Following = in.Following
out.Whisper = in.Whisper
out.Black = in.Black
out.Follower = in.Follower
out.CTime = in.CTime
out.MTime = in.MTime
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
if in.XXX_unrecognized != nil {
in, out := &in.XXX_unrecognized, &out.XXX_unrecognized
*out = make([]byte, len(*in))
copy(*out, *in)
}
out.XXX_sizecache = in.XXX_sizecache
return
}
// DeepCopyAsStat is an autogenerated deepcopy function, copying the receiver, creating a new model.Stat.
func (in *StatReply) DeepCopyAsStat() *model.Stat {
if in == nil {
return nil
}
out := new(model.Stat)
in.DeepCopyAsIntoStat(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TagCountReply) DeepCopyInto(out *TagCountReply) {
*out = *in
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
if in.XXX_unrecognized != nil {
in, out := &in.XXX_unrecognized, &out.XXX_unrecognized
*out = make([]byte, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagCountReply.
func (in *TagCountReply) DeepCopy() *TagCountReply {
if in == nil {
return nil
}
out := new(TagCountReply)
in.DeepCopyInto(out)
return out
}
// DeepCopyAsIntoTagCount is an autogenerated deepcopy function, copying the receiver, writing into model.TagCount.
func (in *TagCountReply) DeepCopyAsIntoTagCount(out *model.TagCount) {
out.Tagid = in.Tagid
out.Name = in.Name
out.Count = in.Count
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
if in.XXX_unrecognized != nil {
in, out := &in.XXX_unrecognized, &out.XXX_unrecognized
*out = make([]byte, len(*in))
copy(*out, *in)
}
out.XXX_sizecache = in.XXX_sizecache
return
}
// DeepCopyFromTagCount is an autogenerated deepcopy function, copying the receiver, writing into model.TagCount.
func (out *TagCountReply) DeepCopyFromTagCount(in *model.TagCount) {
out.Tagid = in.Tagid
out.Name = in.Name
out.Count = in.Count
out.XXX_NoUnkeyedLiteral = in.XXX_NoUnkeyedLiteral
if in.XXX_unrecognized != nil {
in, out := &in.XXX_unrecognized, &out.XXX_unrecognized
*out = make([]byte, len(*in))
copy(*out, *in)
}
out.XXX_sizecache = in.XXX_sizecache
return
}
// DeepCopyAsTagCount is an autogenerated deepcopy function, copying the receiver, creating a new model.TagCount.
func (in *TagCountReply) DeepCopyAsTagCount() *model.TagCount {
if in == nil {
return nil
}
out := new(model.TagCount)
in.DeepCopyAsIntoTagCount(out)
return out
}