youtu_grpc/app/user_service/user/user_service_grpc.pb.go

322 lines
12 KiB
Go
Raw Normal View History

2025-02-05 18:45:49 +08:00
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.19.4
2025-02-14 17:46:27 +08:00
// source: user_service.proto
2025-02-05 18:45:49 +08:00
2025-02-14 10:30:15 +08:00
package user
2025-02-05 18:45:49 +08:00
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 (
2025-02-14 17:46:27 +08:00
UserService_Ping_FullMethodName = "/user_service.user_service/Ping"
UserService_SetUser_FullMethodName = "/user_service.user_service/SetUser"
UserService_CreateUser_FullMethodName = "/user_service.user_service/CreateUser"
UserService_CreateEmptyUser_FullMethodName = "/user_service.user_service/CreateEmptyUser"
UserService_FindById_FullMethodName = "/user_service.user_service/FindById"
UserService_GetUserById_FullMethodName = "/user_service.user_service/GetUserById"
2025-02-05 18:45:49 +08:00
)
2025-02-14 17:46:27 +08:00
// UserServiceClient is the client API for UserService service.
2025-02-05 18:45:49 +08:00
//
// 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.
2025-02-14 17:46:27 +08:00
type UserServiceClient interface {
2025-02-05 18:45:49 +08:00
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
// SetUser 设置用户信息
SetUser(ctx context.Context, in *SetUserRequest, opts ...grpc.CallOption) (*SetUserResponse, error)
// CreateUser 获取用户或者创建用户
CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserId, error)
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
CreateEmptyUser(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserId, error)
2025-02-12 18:10:25 +08:00
// FirstOrCreateUser 创建用户或者获取用户
FindById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
// GetUserById 通过 ID 获取用户
GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error)
2025-02-05 18:45:49 +08:00
}
2025-02-14 17:46:27 +08:00
type userServiceClient struct {
2025-02-05 18:45:49 +08:00
cc grpc.ClientConnInterface
}
2025-02-14 17:46:27 +08:00
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
return &userServiceClient{cc}
2025-02-05 18:45:49 +08:00
}
2025-02-14 17:46:27 +08:00
func (c *userServiceClient) Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
2025-02-05 18:45:49 +08:00
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Response)
2025-02-14 17:46:27 +08:00
err := c.cc.Invoke(ctx, UserService_Ping_FullMethodName, in, out, cOpts...)
2025-02-05 18:45:49 +08:00
if err != nil {
return nil, err
}
return out, nil
}
2025-02-14 17:46:27 +08:00
func (c *userServiceClient) SetUser(ctx context.Context, in *SetUserRequest, opts ...grpc.CallOption) (*SetUserResponse, error) {
2025-02-05 18:45:49 +08:00
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(SetUserResponse)
2025-02-14 17:46:27 +08:00
err := c.cc.Invoke(ctx, UserService_SetUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
2025-02-14 17:46:27 +08:00
func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*UserId, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UserId)
2025-02-14 17:46:27 +08:00
err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
2025-02-14 17:46:27 +08:00
func (c *userServiceClient) CreateEmptyUser(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*UserId, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UserId)
2025-02-14 17:46:27 +08:00
err := c.cc.Invoke(ctx, UserService_CreateEmptyUser_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
2025-02-14 17:46:27 +08:00
func (c *userServiceClient) FindById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error) {
2025-02-12 18:10:25 +08:00
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(User)
2025-02-14 17:46:27 +08:00
err := c.cc.Invoke(ctx, UserService_FindById_FullMethodName, in, out, cOpts...)
2025-02-12 18:10:25 +08:00
if err != nil {
return nil, err
}
return out, nil
}
2025-02-14 17:46:27 +08:00
func (c *userServiceClient) GetUserById(ctx context.Context, in *UserId, opts ...grpc.CallOption) (*User, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(User)
2025-02-14 17:46:27 +08:00
err := c.cc.Invoke(ctx, UserService_GetUserById_FullMethodName, in, out, cOpts...)
2025-02-05 18:45:49 +08:00
if err != nil {
return nil, err
}
return out, nil
}
2025-02-14 17:46:27 +08:00
// UserServiceServer is the server API for UserService service.
// All implementations must embed UnimplementedUserServiceServer
2025-02-05 18:45:49 +08:00
// for forward compatibility.
2025-02-14 17:46:27 +08:00
type UserServiceServer interface {
2025-02-05 18:45:49 +08:00
Ping(context.Context, *Request) (*Response, error)
// SetUser 设置用户信息
SetUser(context.Context, *SetUserRequest) (*SetUserResponse, error)
// CreateUser 获取用户或者创建用户
CreateUser(context.Context, *CreateUserRequest) (*UserId, error)
// CreateEmptyUser 创建空用户,用于关联游戏账号的空数据
CreateEmptyUser(context.Context, *Empty) (*UserId, error)
2025-02-12 18:10:25 +08:00
// FirstOrCreateUser 创建用户或者获取用户
FindById(context.Context, *UserId) (*User, error)
// GetUserById 通过 ID 获取用户
GetUserById(context.Context, *UserId) (*User, error)
2025-02-14 17:46:27 +08:00
mustEmbedUnimplementedUserServiceServer()
2025-02-05 18:45:49 +08:00
}
2025-02-14 17:46:27 +08:00
// UnimplementedUserServiceServer must be embedded to have
2025-02-05 18:45:49 +08:00
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
2025-02-14 17:46:27 +08:00
type UnimplementedUserServiceServer struct{}
2025-02-05 18:45:49 +08:00
2025-02-14 17:46:27 +08:00
func (UnimplementedUserServiceServer) Ping(context.Context, *Request) (*Response, error) {
2025-02-05 18:45:49 +08:00
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
2025-02-14 17:46:27 +08:00
func (UnimplementedUserServiceServer) SetUser(context.Context, *SetUserRequest) (*SetUserResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SetUser not implemented")
}
2025-02-14 17:46:27 +08:00
func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserRequest) (*UserId, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateUser not implemented")
}
2025-02-14 17:46:27 +08:00
func (UnimplementedUserServiceServer) CreateEmptyUser(context.Context, *Empty) (*UserId, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateEmptyUser not implemented")
}
2025-02-14 17:46:27 +08:00
func (UnimplementedUserServiceServer) FindById(context.Context, *UserId) (*User, error) {
2025-02-12 18:10:25 +08:00
return nil, status.Errorf(codes.Unimplemented, "method FindById not implemented")
}
2025-02-14 17:46:27 +08:00
func (UnimplementedUserServiceServer) GetUserById(context.Context, *UserId) (*User, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserById not implemented")
2025-02-05 18:45:49 +08:00
}
2025-02-14 17:46:27 +08:00
func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {}
func (UnimplementedUserServiceServer) testEmbeddedByValue() {}
2025-02-05 18:45:49 +08:00
2025-02-14 17:46:27 +08:00
// 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
2025-02-05 18:45:49 +08:00
// result in compilation errors.
2025-02-14 17:46:27 +08:00
type UnsafeUserServiceServer interface {
mustEmbedUnimplementedUserServiceServer()
2025-02-05 18:45:49 +08:00
}
2025-02-14 17:46:27 +08:00
func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) {
// If the following call pancis, it indicates UnimplementedUserServiceServer was
2025-02-05 18:45:49 +08:00
// 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()
}
2025-02-14 17:46:27 +08:00
s.RegisterService(&UserService_ServiceDesc, srv)
2025-02-05 18:45:49 +08:00
}
2025-02-14 17:46:27 +08:00
func _UserService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
2025-02-05 18:45:49 +08:00
in := new(Request)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).Ping(ctx, in)
2025-02-05 18:45:49 +08:00
}
info := &grpc.UnaryServerInfo{
Server: srv,
2025-02-14 17:46:27 +08:00
FullMethod: UserService_Ping_FullMethodName,
2025-02-05 18:45:49 +08:00
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).Ping(ctx, req.(*Request))
2025-02-05 18:45:49 +08:00
}
return interceptor(ctx, in, info, handler)
}
2025-02-14 17:46:27 +08:00
func _UserService_SetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).SetUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
2025-02-14 17:46:27 +08:00
FullMethod: UserService_SetUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).SetUser(ctx, req.(*SetUserRequest))
}
return interceptor(ctx, in, info, handler)
}
2025-02-14 17:46:27 +08:00
func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateUserRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).CreateUser(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
2025-02-14 17:46:27 +08:00
FullMethod: UserService_CreateUser_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest))
}
return interceptor(ctx, in, info, handler)
}
2025-02-14 17:46:27 +08:00
func _UserService_CreateEmptyUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
2025-02-05 18:45:49 +08:00
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).CreateEmptyUser(ctx, in)
2025-02-05 18:45:49 +08:00
}
info := &grpc.UnaryServerInfo{
Server: srv,
2025-02-14 17:46:27 +08:00
FullMethod: UserService_CreateEmptyUser_FullMethodName,
2025-02-05 18:45:49 +08:00
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).CreateEmptyUser(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
2025-02-14 17:46:27 +08:00
func _UserService_FindById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
2025-02-12 18:10:25 +08:00
in := new(UserId)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).FindById(ctx, in)
2025-02-12 18:10:25 +08:00
}
info := &grpc.UnaryServerInfo{
Server: srv,
2025-02-14 17:46:27 +08:00
FullMethod: UserService_FindById_FullMethodName,
2025-02-12 18:10:25 +08:00
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).FindById(ctx, req.(*UserId))
2025-02-12 18:10:25 +08:00
}
return interceptor(ctx, in, info, handler)
}
2025-02-14 17:46:27 +08:00
func _UserService_GetUserById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserId)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).GetUserById(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
2025-02-14 17:46:27 +08:00
FullMethod: UserService_GetUserById_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
2025-02-14 17:46:27 +08:00
return srv.(UserServiceServer).GetUserById(ctx, req.(*UserId))
2025-02-05 18:45:49 +08:00
}
return interceptor(ctx, in, info, handler)
}
2025-02-14 17:46:27 +08:00
// UserService_ServiceDesc is the grpc.ServiceDesc for UserService service.
2025-02-05 18:45:49 +08:00
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
2025-02-14 17:46:27 +08:00
var UserService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "user_service.user_service",
HandlerType: (*UserServiceServer)(nil),
2025-02-05 18:45:49 +08:00
Methods: []grpc.MethodDesc{
{
MethodName: "Ping",
2025-02-14 17:46:27 +08:00
Handler: _UserService_Ping_Handler,
2025-02-05 18:45:49 +08:00
},
{
MethodName: "SetUser",
2025-02-14 17:46:27 +08:00
Handler: _UserService_SetUser_Handler,
},
{
MethodName: "CreateUser",
2025-02-14 17:46:27 +08:00
Handler: _UserService_CreateUser_Handler,
},
{
MethodName: "CreateEmptyUser",
2025-02-14 17:46:27 +08:00
Handler: _UserService_CreateEmptyUser_Handler,
},
2025-02-12 18:10:25 +08:00
{
MethodName: "FindById",
2025-02-14 17:46:27 +08:00
Handler: _UserService_FindById_Handler,
2025-02-12 18:10:25 +08:00
},
{
MethodName: "GetUserById",
2025-02-14 17:46:27 +08:00
Handler: _UserService_GetUserById_Handler,
2025-02-05 18:45:49 +08:00
},
},
Streams: []grpc.StreamDesc{},
2025-02-14 17:46:27 +08:00
Metadata: "user_service.proto",
2025-02-05 18:45:49 +08:00
}