Able to get user by using name

This commit is contained in:
2024-11-03 01:40:36 +08:00
parent ea150608b4
commit 194d270904
15 changed files with 979 additions and 465 deletions

View File

@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc-gen-go-grpc v1.2.0
// - protoc v5.28.2
// source: services.proto
@@ -15,16 +15,8 @@ import (
// 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 (
DirectoryService_GetService_FullMethodName = "/proto.DirectoryService/GetService"
DirectoryService_ListService_FullMethodName = "/proto.DirectoryService/ListService"
DirectoryService_AddService_FullMethodName = "/proto.DirectoryService/AddService"
DirectoryService_RemoveService_FullMethodName = "/proto.DirectoryService/RemoveService"
DirectoryService_BroadcastEvent_FullMethodName = "/proto.DirectoryService/BroadcastEvent"
)
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// DirectoryServiceClient is the client API for DirectoryService service.
//
@@ -46,9 +38,8 @@ func NewDirectoryServiceClient(cc grpc.ClientConnInterface) DirectoryServiceClie
}
func (c *directoryServiceClient) GetService(ctx context.Context, in *GetServiceRequest, opts ...grpc.CallOption) (*GetServiceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetServiceResponse)
err := c.cc.Invoke(ctx, DirectoryService_GetService_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/proto.DirectoryService/GetService", in, out, opts...)
if err != nil {
return nil, err
}
@@ -56,9 +47,8 @@ func (c *directoryServiceClient) GetService(ctx context.Context, in *GetServiceR
}
func (c *directoryServiceClient) ListService(ctx context.Context, in *ListServiceRequest, opts ...grpc.CallOption) (*ListServiceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListServiceResponse)
err := c.cc.Invoke(ctx, DirectoryService_ListService_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/proto.DirectoryService/ListService", in, out, opts...)
if err != nil {
return nil, err
}
@@ -66,9 +56,8 @@ func (c *directoryServiceClient) ListService(ctx context.Context, in *ListServic
}
func (c *directoryServiceClient) AddService(ctx context.Context, in *ServiceInfo, opts ...grpc.CallOption) (*AddServiceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AddServiceResponse)
err := c.cc.Invoke(ctx, DirectoryService_AddService_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/proto.DirectoryService/AddService", in, out, opts...)
if err != nil {
return nil, err
}
@@ -76,9 +65,8 @@ func (c *directoryServiceClient) AddService(ctx context.Context, in *ServiceInfo
}
func (c *directoryServiceClient) RemoveService(ctx context.Context, in *RemoveServiceRequest, opts ...grpc.CallOption) (*RemoveServiceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RemoveServiceResponse)
err := c.cc.Invoke(ctx, DirectoryService_RemoveService_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/proto.DirectoryService/RemoveService", in, out, opts...)
if err != nil {
return nil, err
}
@@ -86,9 +74,8 @@ func (c *directoryServiceClient) RemoveService(ctx context.Context, in *RemoveSe
}
func (c *directoryServiceClient) BroadcastEvent(ctx context.Context, in *EventInfo, opts ...grpc.CallOption) (*EventResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(EventResponse)
err := c.cc.Invoke(ctx, DirectoryService_BroadcastEvent_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, "/proto.DirectoryService/BroadcastEvent", in, out, opts...)
if err != nil {
return nil, err
}
@@ -97,7 +84,7 @@ func (c *directoryServiceClient) BroadcastEvent(ctx context.Context, in *EventIn
// DirectoryServiceServer is the server API for DirectoryService service.
// All implementations must embed UnimplementedDirectoryServiceServer
// for forward compatibility.
// for forward compatibility
type DirectoryServiceServer interface {
GetService(context.Context, *GetServiceRequest) (*GetServiceResponse, error)
ListService(context.Context, *ListServiceRequest) (*ListServiceResponse, error)
@@ -107,12 +94,9 @@ type DirectoryServiceServer interface {
mustEmbedUnimplementedDirectoryServiceServer()
}
// UnimplementedDirectoryServiceServer 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 UnimplementedDirectoryServiceServer struct{}
// UnimplementedDirectoryServiceServer must be embedded to have forward compatible implementations.
type UnimplementedDirectoryServiceServer struct {
}
func (UnimplementedDirectoryServiceServer) GetService(context.Context, *GetServiceRequest) (*GetServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetService not implemented")
@@ -130,7 +114,6 @@ func (UnimplementedDirectoryServiceServer) BroadcastEvent(context.Context, *Even
return nil, status.Errorf(codes.Unimplemented, "method BroadcastEvent not implemented")
}
func (UnimplementedDirectoryServiceServer) mustEmbedUnimplementedDirectoryServiceServer() {}
func (UnimplementedDirectoryServiceServer) testEmbeddedByValue() {}
// UnsafeDirectoryServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DirectoryServiceServer will
@@ -140,13 +123,6 @@ type UnsafeDirectoryServiceServer interface {
}
func RegisterDirectoryServiceServer(s grpc.ServiceRegistrar, srv DirectoryServiceServer) {
// If the following call pancis, it indicates UnimplementedDirectoryServiceServer 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(&DirectoryService_ServiceDesc, srv)
}
@@ -160,7 +136,7 @@ func _DirectoryService_GetService_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: DirectoryService_GetService_FullMethodName,
FullMethod: "/proto.DirectoryService/GetService",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DirectoryServiceServer).GetService(ctx, req.(*GetServiceRequest))
@@ -178,7 +154,7 @@ func _DirectoryService_ListService_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: DirectoryService_ListService_FullMethodName,
FullMethod: "/proto.DirectoryService/ListService",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DirectoryServiceServer).ListService(ctx, req.(*ListServiceRequest))
@@ -196,7 +172,7 @@ func _DirectoryService_AddService_Handler(srv interface{}, ctx context.Context,
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: DirectoryService_AddService_FullMethodName,
FullMethod: "/proto.DirectoryService/AddService",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DirectoryServiceServer).AddService(ctx, req.(*ServiceInfo))
@@ -214,7 +190,7 @@ func _DirectoryService_RemoveService_Handler(srv interface{}, ctx context.Contex
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: DirectoryService_RemoveService_FullMethodName,
FullMethod: "/proto.DirectoryService/RemoveService",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DirectoryServiceServer).RemoveService(ctx, req.(*RemoveServiceRequest))
@@ -232,7 +208,7 @@ func _DirectoryService_BroadcastEvent_Handler(srv interface{}, ctx context.Conte
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: DirectoryService_BroadcastEvent_FullMethodName,
FullMethod: "/proto.DirectoryService/BroadcastEvent",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DirectoryServiceServer).BroadcastEvent(ctx, req.(*EventInfo))