🧑‍💻 Add more user related query rpc call

This commit is contained in:
LittleSheep 2024-10-31 20:57:27 +08:00
parent 32a77f7f0f
commit aa624ee454
7 changed files with 789 additions and 356 deletions

12
.idea/protoeditor.xml generated Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProtobufLanguageSettings">
<option name="importPathEntries">
<list>
<ImportPathEntry>
<option name="location" value="file://$PROJECT_DIR$/pkg/proto" />
</ImportPathEntry>
</list>
</option>
</component>
</project>

View File

@ -20,75 +20,6 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type UserInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
PermNodes []byte `protobuf:"bytes,3,opt,name=perm_nodes,json=permNodes,proto3,oneof" json:"perm_nodes,omitempty"`
Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3,oneof" json:"metadata,omitempty"`
}
func (x *UserInfo) Reset() {
*x = UserInfo{}
mi := &file_authenticate_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UserInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserInfo) ProtoMessage() {}
func (x *UserInfo) ProtoReflect() protoreflect.Message {
mi := &file_authenticate_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 UserInfo.ProtoReflect.Descriptor instead.
func (*UserInfo) Descriptor() ([]byte, []int) {
return file_authenticate_proto_rawDescGZIP(), []int{0}
}
func (x *UserInfo) GetId() uint64 {
if x != nil {
return x.Id
}
return 0
}
func (x *UserInfo) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *UserInfo) GetPermNodes() []byte {
if x != nil {
return x.PermNodes
}
return nil
}
func (x *UserInfo) GetMetadata() []byte {
if x != nil {
return x.Metadata
}
return nil
}
type AuthInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -100,7 +31,7 @@ type AuthInfo struct {
func (x *AuthInfo) Reset() {
*x = AuthInfo{}
mi := &file_authenticate_proto_msgTypes[1]
mi := &file_authenticate_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -112,7 +43,7 @@ func (x *AuthInfo) String() string {
func (*AuthInfo) ProtoMessage() {}
func (x *AuthInfo) ProtoReflect() protoreflect.Message {
mi := &file_authenticate_proto_msgTypes[1]
mi := &file_authenticate_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -125,7 +56,7 @@ func (x *AuthInfo) ProtoReflect() protoreflect.Message {
// Deprecated: Use AuthInfo.ProtoReflect.Descriptor instead.
func (*AuthInfo) Descriptor() ([]byte, []int) {
return file_authenticate_proto_rawDescGZIP(), []int{1}
return file_authenticate_proto_rawDescGZIP(), []int{0}
}
func (x *AuthInfo) GetInfo() *UserInfo {
@ -152,7 +83,7 @@ type AuthRequest struct {
func (x *AuthRequest) Reset() {
*x = AuthRequest{}
mi := &file_authenticate_proto_msgTypes[2]
mi := &file_authenticate_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -164,7 +95,7 @@ func (x *AuthRequest) String() string {
func (*AuthRequest) ProtoMessage() {}
func (x *AuthRequest) ProtoReflect() protoreflect.Message {
mi := &file_authenticate_proto_msgTypes[2]
mi := &file_authenticate_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -177,7 +108,7 @@ func (x *AuthRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use AuthRequest.ProtoReflect.Descriptor instead.
func (*AuthRequest) Descriptor() ([]byte, []int) {
return file_authenticate_proto_rawDescGZIP(), []int{2}
return file_authenticate_proto_rawDescGZIP(), []int{1}
}
func (x *AuthRequest) GetSessionId() uint64 {
@ -198,7 +129,7 @@ type AuthReply struct {
func (x *AuthReply) Reset() {
*x = AuthReply{}
mi := &file_authenticate_proto_msgTypes[3]
mi := &file_authenticate_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -210,7 +141,7 @@ func (x *AuthReply) String() string {
func (*AuthReply) ProtoMessage() {}
func (x *AuthReply) ProtoReflect() protoreflect.Message {
mi := &file_authenticate_proto_msgTypes[3]
mi := &file_authenticate_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -223,7 +154,7 @@ func (x *AuthReply) ProtoReflect() protoreflect.Message {
// Deprecated: Use AuthReply.ProtoReflect.Descriptor instead.
func (*AuthReply) Descriptor() ([]byte, []int) {
return file_authenticate_proto_rawDescGZIP(), []int{3}
return file_authenticate_proto_rawDescGZIP(), []int{2}
}
func (x *AuthReply) GetIsValid() bool {
@ -252,7 +183,7 @@ type CheckPermRequest struct {
func (x *CheckPermRequest) Reset() {
*x = CheckPermRequest{}
mi := &file_authenticate_proto_msgTypes[4]
mi := &file_authenticate_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -264,7 +195,7 @@ func (x *CheckPermRequest) String() string {
func (*CheckPermRequest) ProtoMessage() {}
func (x *CheckPermRequest) ProtoReflect() protoreflect.Message {
mi := &file_authenticate_proto_msgTypes[4]
mi := &file_authenticate_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -277,7 +208,7 @@ func (x *CheckPermRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CheckPermRequest.ProtoReflect.Descriptor instead.
func (*CheckPermRequest) Descriptor() ([]byte, []int) {
return file_authenticate_proto_rawDescGZIP(), []int{4}
return file_authenticate_proto_rawDescGZIP(), []int{3}
}
func (x *CheckPermRequest) GetSessionId() uint64 {
@ -311,7 +242,7 @@ type CheckPermResponse struct {
func (x *CheckPermResponse) Reset() {
*x = CheckPermResponse{}
mi := &file_authenticate_proto_msgTypes[5]
mi := &file_authenticate_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -323,7 +254,7 @@ func (x *CheckPermResponse) String() string {
func (*CheckPermResponse) ProtoMessage() {}
func (x *CheckPermResponse) ProtoReflect() protoreflect.Message {
mi := &file_authenticate_proto_msgTypes[5]
mi := &file_authenticate_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -336,7 +267,7 @@ func (x *CheckPermResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use CheckPermResponse.ProtoReflect.Descriptor instead.
func (*CheckPermResponse) Descriptor() ([]byte, []int) {
return file_authenticate_proto_rawDescGZIP(), []int{5}
return file_authenticate_proto_rawDescGZIP(), []int{4}
}
func (x *CheckPermResponse) GetIsValid() bool {
@ -359,7 +290,7 @@ type CheckUserPermRequest struct {
func (x *CheckUserPermRequest) Reset() {
*x = CheckUserPermRequest{}
mi := &file_authenticate_proto_msgTypes[6]
mi := &file_authenticate_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -371,7 +302,7 @@ func (x *CheckUserPermRequest) String() string {
func (*CheckUserPermRequest) ProtoMessage() {}
func (x *CheckUserPermRequest) ProtoReflect() protoreflect.Message {
mi := &file_authenticate_proto_msgTypes[6]
mi := &file_authenticate_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -384,7 +315,7 @@ func (x *CheckUserPermRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CheckUserPermRequest.ProtoReflect.Descriptor instead.
func (*CheckUserPermRequest) Descriptor() ([]byte, []int) {
return file_authenticate_proto_rawDescGZIP(), []int{6}
return file_authenticate_proto_rawDescGZIP(), []int{5}
}
func (x *CheckUserPermRequest) GetUserId() uint64 {
@ -425,7 +356,7 @@ type CheckUserPermResponse struct {
func (x *CheckUserPermResponse) Reset() {
*x = CheckUserPermResponse{}
mi := &file_authenticate_proto_msgTypes[7]
mi := &file_authenticate_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -437,7 +368,7 @@ func (x *CheckUserPermResponse) String() string {
func (*CheckUserPermResponse) ProtoMessage() {}
func (x *CheckUserPermResponse) ProtoReflect() protoreflect.Message {
mi := &file_authenticate_proto_msgTypes[7]
mi := &file_authenticate_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -450,7 +381,7 @@ func (x *CheckUserPermResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use CheckUserPermResponse.ProtoReflect.Descriptor instead.
func (*CheckUserPermResponse) Descriptor() ([]byte, []int) {
return file_authenticate_proto_rawDescGZIP(), []int{7}
return file_authenticate_proto_rawDescGZIP(), []int{6}
}
func (x *CheckUserPermResponse) GetIsValid() bool {
@ -460,191 +391,60 @@ func (x *CheckUserPermResponse) GetIsValid() bool {
return false
}
type ListUserRelativeRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId uint64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
IsRelated bool `protobuf:"varint,3,opt,name=is_related,json=isRelated,proto3" json:"is_related,omitempty"`
}
func (x *ListUserRelativeRequest) Reset() {
*x = ListUserRelativeRequest{}
mi := &file_authenticate_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListUserRelativeRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListUserRelativeRequest) ProtoMessage() {}
func (x *ListUserRelativeRequest) ProtoReflect() protoreflect.Message {
mi := &file_authenticate_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListUserRelativeRequest.ProtoReflect.Descriptor instead.
func (*ListUserRelativeRequest) Descriptor() ([]byte, []int) {
return file_authenticate_proto_rawDescGZIP(), []int{8}
}
func (x *ListUserRelativeRequest) GetUserId() uint64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *ListUserRelativeRequest) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *ListUserRelativeRequest) GetIsRelated() bool {
if x != nil {
return x.IsRelated
}
return false
}
type ListUserRelativeResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data []*UserInfo `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
}
func (x *ListUserRelativeResponse) Reset() {
*x = ListUserRelativeResponse{}
mi := &file_authenticate_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListUserRelativeResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListUserRelativeResponse) ProtoMessage() {}
func (x *ListUserRelativeResponse) ProtoReflect() protoreflect.Message {
mi := &file_authenticate_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListUserRelativeResponse.ProtoReflect.Descriptor instead.
func (*ListUserRelativeResponse) Descriptor() ([]byte, []int) {
return file_authenticate_proto_rawDescGZIP(), []int{9}
}
func (x *ListUserRelativeResponse) GetData() []*UserInfo {
if x != nil {
return x.Data
}
return nil
}
var File_authenticate_proto protoreflect.FileDescriptor
var file_authenticate_proto_rawDesc = []byte{
0x0a, 0x12, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8f, 0x01, 0x0a, 0x08,
0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0a,
0x70, 0x65, 0x72, 0x6d, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
0x48, 0x00, 0x52, 0x09, 0x70, 0x65, 0x72, 0x6d, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x88, 0x01, 0x01,
0x12, 0x1f, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01,
0x28, 0x0c, 0x48, 0x01, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01,
0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x70, 0x65, 0x72, 0x6d, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73,
0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x4e, 0x0a,
0x08, 0x41, 0x75, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x04, 0x69, 0x6e, 0x66,
0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x1d,
0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x04, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x2c, 0x0a,
0x0b, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a,
0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04,
0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x59, 0x0a, 0x09, 0x41,
0x75, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x76,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x75, 0x73, 0x65,
0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4e, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x49,
0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e,
0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73,
0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x65,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x2c, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73,
0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x59, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x70,
0x6c, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x12, 0x28, 0x0a,
0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x04,
0x69, 0x6e, 0x66, 0x6f, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x69, 0x6e, 0x66, 0x6f,
0x22, 0x59, 0x0a, 0x10, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x2e, 0x0a, 0x11, 0x43,
0x68, 0x65, 0x63, 0x6b, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x22, 0x72, 0x0a, 0x14, 0x43,
0x68, 0x65, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08,
0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07,
0x6f, 0x74, 0x68, 0x65, 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
0x32, 0x0a, 0x15, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x76,
0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x56, 0x61,
0x6c, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x49, 0x6e,
0x66, 0x6f, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a,
0x05, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x59, 0x0a, 0x10, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50,
0x65, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09,
0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x22, 0x2e, 0x0a, 0x11, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x76, 0x61, 0x6c,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x56, 0x61, 0x6c, 0x69,
0x64, 0x22, 0x72, 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65,
0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65,
0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72,
0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x32, 0x0a, 0x15, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73,
0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19,
0x0a, 0x08, 0x69, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
0x52, 0x07, 0x69, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x22, 0x69, 0x0a, 0x17, 0x4c, 0x69, 0x73,
0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a,
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x6c, 0x61,
0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x52, 0x65, 0x6c,
0x61, 0x74, 0x65, 0x64, 0x22, 0x3f, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72,
0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0xbc, 0x02, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x36, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,
0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75,
0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x48, 0x0a,
0x11, 0x45, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x47, 0x72, 0x61, 0x6e, 0x74,
0x65, 0x64, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b,
0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x15, 0x45, 0x6e, 0x73, 0x75, 0x72,
0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x64,
0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73,
0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x50,
0x65, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a,
0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76,
0x65, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73,
0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73,
0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6c, 0x69, 0x64, 0x32, 0xe5, 0x01, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x12, 0x36, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63,
0x61, 0x74, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x11, 0x45,
0x6e, 0x73, 0x75, 0x72, 0x65, 0x50, 0x65, 0x72, 0x6d, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x64,
0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x65,
0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x54, 0x0a, 0x15, 0x45, 0x6e, 0x73, 0x75, 0x72, 0x65, 0x55,
0x73, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x65, 0x64, 0x12, 0x1b,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72,
0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x72,
0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e,
0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -659,36 +459,31 @@ func file_authenticate_proto_rawDescGZIP() []byte {
return file_authenticate_proto_rawDescData
}
var file_authenticate_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_authenticate_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_authenticate_proto_goTypes = []any{
(*UserInfo)(nil), // 0: proto.UserInfo
(*AuthInfo)(nil), // 1: proto.AuthInfo
(*AuthRequest)(nil), // 2: proto.AuthRequest
(*AuthReply)(nil), // 3: proto.AuthReply
(*CheckPermRequest)(nil), // 4: proto.CheckPermRequest
(*CheckPermResponse)(nil), // 5: proto.CheckPermResponse
(*CheckUserPermRequest)(nil), // 6: proto.CheckUserPermRequest
(*CheckUserPermResponse)(nil), // 7: proto.CheckUserPermResponse
(*ListUserRelativeRequest)(nil), // 8: proto.ListUserRelativeRequest
(*ListUserRelativeResponse)(nil), // 9: proto.ListUserRelativeResponse
(*AuthInfo)(nil), // 0: proto.AuthInfo
(*AuthRequest)(nil), // 1: proto.AuthRequest
(*AuthReply)(nil), // 2: proto.AuthReply
(*CheckPermRequest)(nil), // 3: proto.CheckPermRequest
(*CheckPermResponse)(nil), // 4: proto.CheckPermResponse
(*CheckUserPermRequest)(nil), // 5: proto.CheckUserPermRequest
(*CheckUserPermResponse)(nil), // 6: proto.CheckUserPermResponse
(*UserInfo)(nil), // 7: proto.UserInfo
}
var file_authenticate_proto_depIdxs = []int32{
0, // 0: proto.AuthInfo.info:type_name -> proto.UserInfo
1, // 1: proto.AuthReply.info:type_name -> proto.AuthInfo
0, // 2: proto.ListUserRelativeResponse.data:type_name -> proto.UserInfo
2, // 3: proto.AuthService.Authenticate:input_type -> proto.AuthRequest
4, // 4: proto.AuthService.EnsurePermGranted:input_type -> proto.CheckPermRequest
6, // 5: proto.AuthService.EnsureUserPermGranted:input_type -> proto.CheckUserPermRequest
8, // 6: proto.AuthService.ListUserRelative:input_type -> proto.ListUserRelativeRequest
3, // 7: proto.AuthService.Authenticate:output_type -> proto.AuthReply
5, // 8: proto.AuthService.EnsurePermGranted:output_type -> proto.CheckPermResponse
7, // 9: proto.AuthService.EnsureUserPermGranted:output_type -> proto.CheckUserPermResponse
9, // 10: proto.AuthService.ListUserRelative:output_type -> proto.ListUserRelativeResponse
7, // [7:11] is the sub-list for method output_type
3, // [3:7] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
7, // 0: proto.AuthInfo.info:type_name -> proto.UserInfo
0, // 1: proto.AuthReply.info:type_name -> proto.AuthInfo
1, // 2: proto.AuthService.Authenticate:input_type -> proto.AuthRequest
3, // 3: proto.AuthService.EnsurePermGranted:input_type -> proto.CheckPermRequest
5, // 4: proto.AuthService.EnsureUserPermGranted:input_type -> proto.CheckUserPermRequest
2, // 5: proto.AuthService.Authenticate:output_type -> proto.AuthReply
4, // 6: proto.AuthService.EnsurePermGranted:output_type -> proto.CheckPermResponse
6, // 7: proto.AuthService.EnsureUserPermGranted:output_type -> proto.CheckUserPermResponse
5, // [5:8] is the sub-list for method output_type
2, // [2:5] 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_authenticate_proto_init() }
@ -696,15 +491,15 @@ func file_authenticate_proto_init() {
if File_authenticate_proto != nil {
return
}
file_authenticate_proto_msgTypes[0].OneofWrappers = []any{}
file_authenticate_proto_msgTypes[3].OneofWrappers = []any{}
file_user_proto_init()
file_authenticate_proto_msgTypes[2].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_authenticate_proto_rawDesc,
NumEnums: 0,
NumMessages: 10,
NumMessages: 7,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -1,4 +1,5 @@
syntax = "proto3";
import "user.proto";
option go_package = ".;proto";
@ -8,14 +9,6 @@ service AuthService {
rpc Authenticate(AuthRequest) returns (AuthReply) {}
rpc EnsurePermGranted(CheckPermRequest) returns (CheckPermResponse) {}
rpc EnsureUserPermGranted(CheckUserPermRequest) returns (CheckUserPermResponse) {}
rpc ListUserRelative(ListUserRelativeRequest) returns (ListUserRelativeResponse) {}
}
message UserInfo {
uint64 id = 1;
string name = 2;
optional bytes perm_nodes = 3;
optional bytes metadata = 4;
}
message AuthInfo {
@ -52,13 +45,3 @@ message CheckUserPermRequest {
message CheckUserPermResponse {
bool is_valid = 1;
}
message ListUserRelativeRequest {
uint64 user_id = 1;
int32 status = 2;
bool is_related = 3;
}
message ListUserRelativeResponse {
repeated UserInfo data = 1;
}

View File

@ -22,7 +22,6 @@ const (
AuthService_Authenticate_FullMethodName = "/proto.AuthService/Authenticate"
AuthService_EnsurePermGranted_FullMethodName = "/proto.AuthService/EnsurePermGranted"
AuthService_EnsureUserPermGranted_FullMethodName = "/proto.AuthService/EnsureUserPermGranted"
AuthService_ListUserRelative_FullMethodName = "/proto.AuthService/ListUserRelative"
)
// AuthServiceClient is the client API for AuthService service.
@ -32,7 +31,6 @@ type AuthServiceClient interface {
Authenticate(ctx context.Context, in *AuthRequest, opts ...grpc.CallOption) (*AuthReply, error)
EnsurePermGranted(ctx context.Context, in *CheckPermRequest, opts ...grpc.CallOption) (*CheckPermResponse, error)
EnsureUserPermGranted(ctx context.Context, in *CheckUserPermRequest, opts ...grpc.CallOption) (*CheckUserPermResponse, error)
ListUserRelative(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error)
}
type authServiceClient struct {
@ -73,16 +71,6 @@ func (c *authServiceClient) EnsureUserPermGranted(ctx context.Context, in *Check
return out, nil
}
func (c *authServiceClient) ListUserRelative(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListUserRelativeResponse)
err := c.cc.Invoke(ctx, AuthService_ListUserRelative_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AuthServiceServer is the server API for AuthService service.
// All implementations must embed UnimplementedAuthServiceServer
// for forward compatibility.
@ -90,7 +78,6 @@ type AuthServiceServer interface {
Authenticate(context.Context, *AuthRequest) (*AuthReply, error)
EnsurePermGranted(context.Context, *CheckPermRequest) (*CheckPermResponse, error)
EnsureUserPermGranted(context.Context, *CheckUserPermRequest) (*CheckUserPermResponse, error)
ListUserRelative(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error)
mustEmbedUnimplementedAuthServiceServer()
}
@ -110,9 +97,6 @@ func (UnimplementedAuthServiceServer) EnsurePermGranted(context.Context, *CheckP
func (UnimplementedAuthServiceServer) EnsureUserPermGranted(context.Context, *CheckUserPermRequest) (*CheckUserPermResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method EnsureUserPermGranted not implemented")
}
func (UnimplementedAuthServiceServer) ListUserRelative(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUserRelative not implemented")
}
func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
@ -188,24 +172,6 @@ func _AuthService_EnsureUserPermGranted_Handler(srv interface{}, ctx context.Con
return interceptor(ctx, in, info, handler)
}
func _AuthService_ListUserRelative_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListUserRelativeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServiceServer).ListUserRelative(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AuthService_ListUserRelative_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuthServiceServer).ListUserRelative(ctx, req.(*ListUserRelativeRequest))
}
return interceptor(ctx, in, info, handler)
}
// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -225,10 +191,6 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{
MethodName: "EnsureUserPermGranted",
Handler: _AuthService_EnsureUserPermGranted_Handler,
},
{
MethodName: "ListUserRelative",
Handler: _AuthService_ListUserRelative_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "authenticate.proto",

444
pkg/proto/user.pb.go Normal file
View File

@ -0,0 +1,444 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.35.1
// protoc v5.28.2
// source: user.proto
package proto
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
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 UserInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
PermNodes []byte `protobuf:"bytes,3,opt,name=perm_nodes,json=permNodes,proto3,oneof" json:"perm_nodes,omitempty"`
Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3,oneof" json:"metadata,omitempty"`
}
func (x *UserInfo) Reset() {
*x = UserInfo{}
mi := &file_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *UserInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserInfo) ProtoMessage() {}
func (x *UserInfo) ProtoReflect() protoreflect.Message {
mi := &file_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 UserInfo.ProtoReflect.Descriptor instead.
func (*UserInfo) Descriptor() ([]byte, []int) {
return file_user_proto_rawDescGZIP(), []int{0}
}
func (x *UserInfo) GetId() uint64 {
if x != nil {
return x.Id
}
return 0
}
func (x *UserInfo) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *UserInfo) GetPermNodes() []byte {
if x != nil {
return x.PermNodes
}
return nil
}
func (x *UserInfo) GetMetadata() []byte {
if x != nil {
return x.Metadata
}
return nil
}
type MultipleUserInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data []*UserInfo `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
}
func (x *MultipleUserInfo) Reset() {
*x = MultipleUserInfo{}
mi := &file_user_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *MultipleUserInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MultipleUserInfo) ProtoMessage() {}
func (x *MultipleUserInfo) ProtoReflect() protoreflect.Message {
mi := &file_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 MultipleUserInfo.ProtoReflect.Descriptor instead.
func (*MultipleUserInfo) Descriptor() ([]byte, []int) {
return file_user_proto_rawDescGZIP(), []int{1}
}
func (x *MultipleUserInfo) GetData() []*UserInfo {
if x != nil {
return x.Data
}
return nil
}
type GetUserRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId uint64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
}
func (x *GetUserRequest) Reset() {
*x = GetUserRequest{}
mi := &file_user_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *GetUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetUserRequest) ProtoMessage() {}
func (x *GetUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_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 GetUserRequest.ProtoReflect.Descriptor instead.
func (*GetUserRequest) Descriptor() ([]byte, []int) {
return file_user_proto_rawDescGZIP(), []int{2}
}
func (x *GetUserRequest) GetUserId() uint64 {
if x != nil {
return x.UserId
}
return 0
}
type ListUserRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId []uint64 `protobuf:"varint,1,rep,packed,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
}
func (x *ListUserRequest) Reset() {
*x = ListUserRequest{}
mi := &file_user_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListUserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListUserRequest) ProtoMessage() {}
func (x *ListUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_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 ListUserRequest.ProtoReflect.Descriptor instead.
func (*ListUserRequest) Descriptor() ([]byte, []int) {
return file_user_proto_rawDescGZIP(), []int{3}
}
func (x *ListUserRequest) GetUserId() []uint64 {
if x != nil {
return x.UserId
}
return nil
}
type ListUserRelativeRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId uint64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"`
IsRelated bool `protobuf:"varint,3,opt,name=is_related,json=isRelated,proto3" json:"is_related,omitempty"`
}
func (x *ListUserRelativeRequest) Reset() {
*x = ListUserRelativeRequest{}
mi := &file_user_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListUserRelativeRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListUserRelativeRequest) ProtoMessage() {}
func (x *ListUserRelativeRequest) ProtoReflect() protoreflect.Message {
mi := &file_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 ListUserRelativeRequest.ProtoReflect.Descriptor instead.
func (*ListUserRelativeRequest) Descriptor() ([]byte, []int) {
return file_user_proto_rawDescGZIP(), []int{4}
}
func (x *ListUserRelativeRequest) GetUserId() uint64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *ListUserRelativeRequest) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *ListUserRelativeRequest) GetIsRelated() bool {
if x != nil {
return x.IsRelated
}
return false
}
type ListUserRelativeResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data []*UserInfo `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
}
func (x *ListUserRelativeResponse) Reset() {
*x = ListUserRelativeResponse{}
mi := &file_user_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *ListUserRelativeResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListUserRelativeResponse) ProtoMessage() {}
func (x *ListUserRelativeResponse) ProtoReflect() protoreflect.Message {
mi := &file_user_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListUserRelativeResponse.ProtoReflect.Descriptor instead.
func (*ListUserRelativeResponse) Descriptor() ([]byte, []int) {
return file_user_proto_rawDescGZIP(), []int{5}
}
func (x *ListUserRelativeResponse) GetData() []*UserInfo {
if x != nil {
return x.Data
}
return nil
}
var File_user_proto protoreflect.FileDescriptor
var file_user_proto_rawDesc = []byte{
0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0x8f, 0x01, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64,
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x6d, 0x5f, 0x6e, 0x6f, 0x64,
0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x09, 0x70, 0x65, 0x72, 0x6d,
0x4e, 0x6f, 0x64, 0x65, 0x73, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x01, 0x52, 0x08, 0x6d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x88, 0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x70, 0x65,
0x72, 0x6d, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x37, 0x0a, 0x10, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c,
0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74,
0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x29,
0x0a, 0x0e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x2a, 0x0a, 0x0f, 0x4c, 0x69, 0x73,
0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07,
0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x75,
0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x69, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65,
0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x18,
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x65, 0x64,
0x22, 0x3f, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61,
0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04,
0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74,
0x61, 0x32, 0xd8, 0x01, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x33, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x73, 0x65, 0x72,
0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73,
0x65, 0x72, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55,
0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49,
0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65,
0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69,
0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x61, 0x74, 0x69,
0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07,
0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_user_proto_rawDescOnce sync.Once
file_user_proto_rawDescData = file_user_proto_rawDesc
)
func file_user_proto_rawDescGZIP() []byte {
file_user_proto_rawDescOnce.Do(func() {
file_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_proto_rawDescData)
})
return file_user_proto_rawDescData
}
var file_user_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_user_proto_goTypes = []any{
(*UserInfo)(nil), // 0: proto.UserInfo
(*MultipleUserInfo)(nil), // 1: proto.MultipleUserInfo
(*GetUserRequest)(nil), // 2: proto.GetUserRequest
(*ListUserRequest)(nil), // 3: proto.ListUserRequest
(*ListUserRelativeRequest)(nil), // 4: proto.ListUserRelativeRequest
(*ListUserRelativeResponse)(nil), // 5: proto.ListUserRelativeResponse
}
var file_user_proto_depIdxs = []int32{
0, // 0: proto.MultipleUserInfo.data:type_name -> proto.UserInfo
0, // 1: proto.ListUserRelativeResponse.data:type_name -> proto.UserInfo
2, // 2: proto.UserService.GetUser:input_type -> proto.GetUserRequest
3, // 3: proto.UserService.ListUser:input_type -> proto.ListUserRequest
4, // 4: proto.UserService.ListUserRelative:input_type -> proto.ListUserRelativeRequest
0, // 5: proto.UserService.GetUser:output_type -> proto.UserInfo
1, // 6: proto.UserService.ListUser:output_type -> proto.MultipleUserInfo
5, // 7: proto.UserService.ListUserRelative:output_type -> proto.ListUserRelativeResponse
5, // [5:8] is the sub-list for method output_type
2, // [2:5] 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_user_proto_init() }
func file_user_proto_init() {
if File_user_proto != nil {
return
}
file_user_proto_msgTypes[0].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_user_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_user_proto_goTypes,
DependencyIndexes: file_user_proto_depIdxs,
MessageInfos: file_user_proto_msgTypes,
}.Build()
File_user_proto = out.File
file_user_proto_rawDesc = nil
file_user_proto_goTypes = nil
file_user_proto_depIdxs = nil
}

40
pkg/proto/user.proto Normal file
View File

@ -0,0 +1,40 @@
syntax = "proto3";
option go_package = ".;proto";
package proto;
service UserService {
rpc GetUser(GetUserRequest) returns (UserInfo) {}
rpc ListUser(ListUserRequest) returns (MultipleUserInfo) {}
rpc ListUserRelative(ListUserRelativeRequest) returns (ListUserRelativeResponse) {}
}
message UserInfo {
uint64 id = 1;
string name = 2;
optional bytes perm_nodes = 3;
optional bytes metadata = 4;
}
message MultipleUserInfo {
repeated UserInfo data = 1;
}
message GetUserRequest {
uint64 user_id = 1;
}
message ListUserRequest {
repeated uint64 user_id = 1;
}
message ListUserRelativeRequest {
uint64 user_id = 1;
int32 status = 2;
bool is_related = 3;
}
message ListUserRelativeResponse {
repeated UserInfo data = 1;
}

197
pkg/proto/user_grpc.pb.go Normal file
View File

@ -0,0 +1,197 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v5.28.2
// source: user.proto
package proto
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 (
UserService_GetUser_FullMethodName = "/proto.UserService/GetUser"
UserService_ListUser_FullMethodName = "/proto.UserService/ListUser"
UserService_ListUserRelative_FullMethodName = "/proto.UserService/ListUserRelative"
)
// UserServiceClient is the client API for UserService 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 UserServiceClient interface {
GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*UserInfo, error)
ListUser(ctx context.Context, in *ListUserRequest, opts ...grpc.CallOption) (*MultipleUserInfo, error)
ListUserRelative(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error)
}
type userServiceClient struct {
cc grpc.ClientConnInterface
}
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
return &userServiceClient{cc}
}
func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*UserInfo, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UserInfo)
err := c.cc.Invoke(ctx, UserService_GetUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userServiceClient) ListUser(ctx context.Context, in *ListUserRequest, opts ...grpc.CallOption) (*MultipleUserInfo, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MultipleUserInfo)
err := c.cc.Invoke(ctx, UserService_ListUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userServiceClient) ListUserRelative(ctx context.Context, in *ListUserRelativeRequest, opts ...grpc.CallOption) (*ListUserRelativeResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListUserRelativeResponse)
err := c.cc.Invoke(ctx, UserService_ListUserRelative_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// UserServiceServer is the server API for UserService service.
// All implementations must embed UnimplementedUserServiceServer
// for forward compatibility.
type UserServiceServer interface {
GetUser(context.Context, *GetUserRequest) (*UserInfo, error)
ListUser(context.Context, *ListUserRequest) (*MultipleUserInfo, error)
ListUserRelative(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error)
mustEmbedUnimplementedUserServiceServer()
}
// UnimplementedUserServiceServer 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 UnimplementedUserServiceServer struct{}
func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest) (*UserInfo, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUser not implemented")
}
func (UnimplementedUserServiceServer) ListUser(context.Context, *ListUserRequest) (*MultipleUserInfo, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUser not implemented")
}
func (UnimplementedUserServiceServer) ListUserRelative(context.Context, *ListUserRelativeRequest) (*ListUserRelativeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListUserRelative not implemented")
}
func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {}
func (UnimplementedUserServiceServer) testEmbeddedByValue() {}
// UnsafeUserServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to UserServiceServer will
// result in compilation errors.
type UnsafeUserServiceServer interface {
mustEmbedUnimplementedUserServiceServer()
}
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) {
// If the following call pancis, it indicates UnimplementedUserServiceServer 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(&UserService_ServiceDesc, srv)
}
func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServiceServer).GetUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: UserService_GetUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).GetUser(ctx, req.(*GetUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _UserService_ListUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServiceServer).ListUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: UserService_ListUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).ListUser(ctx, req.(*ListUserRequest))
}
return interceptor(ctx, in, info, handler)
}
func _UserService_ListUserRelative_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListUserRelativeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServiceServer).ListUserRelative(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: UserService_ListUserRelative_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServiceServer).ListUserRelative(ctx, req.(*ListUserRelativeRequest))
}
return interceptor(ctx, in, info, handler)
}
// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var UserService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.UserService",
HandlerType: (*UserServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetUser",
Handler: _UserService_GetUser_Handler,
},
{
MethodName: "ListUser",
Handler: _UserService_ListUser_Handler,
},
{
MethodName: "ListUserRelative",
Handler: _UserService_ListUserRelative_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "user.proto",
}