Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterRoomServiceServer(s grpc.ServiceRegistrar, srv RoomServiceServer)
- type CreatedRoomRequest
- func (*CreatedRoomRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreatedRoomRequest) GetName() string
- func (*CreatedRoomRequest) ProtoMessage()
- func (x *CreatedRoomRequest) ProtoReflect() protoreflect.Message
- func (x *CreatedRoomRequest) Reset()
- func (x *CreatedRoomRequest) String() string
- type CreatedRoomResponse
- func (*CreatedRoomResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CreatedRoomResponse) GetId() string
- func (x *CreatedRoomResponse) GetUsers() []*User
- func (*CreatedRoomResponse) ProtoMessage()
- func (x *CreatedRoomResponse) ProtoReflect() protoreflect.Message
- func (x *CreatedRoomResponse) Reset()
- func (x *CreatedRoomResponse) String() string
- type JoinRoomRequest
- func (*JoinRoomRequest) Descriptor() ([]byte, []int)deprecated
- func (x *JoinRoomRequest) GetName() string
- func (x *JoinRoomRequest) GetRoomId() string
- func (*JoinRoomRequest) ProtoMessage()
- func (x *JoinRoomRequest) ProtoReflect() protoreflect.Message
- func (x *JoinRoomRequest) Reset()
- func (x *JoinRoomRequest) String() string
- type JoinedRoomResponse
- func (*JoinedRoomResponse) Descriptor() ([]byte, []int)deprecated
- func (x *JoinedRoomResponse) GetId() string
- func (x *JoinedRoomResponse) GetTimestamp() int64
- func (x *JoinedRoomResponse) GetUsers() []*User
- func (*JoinedRoomResponse) ProtoMessage()
- func (x *JoinedRoomResponse) ProtoReflect() protoreflect.Message
- func (x *JoinedRoomResponse) Reset()
- func (x *JoinedRoomResponse) String() string
- type RoomServiceClient
- type RoomServiceServer
- type UnimplementedRoomServiceServer
- type UnsafeRoomServiceServer
- type User
- func (*User) Descriptor() ([]byte, []int)deprecated
- func (x *User) GetAvatar() string
- func (x *User) GetBalance() int32
- func (x *User) GetId() string
- func (x *User) GetName() string
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
Constants ¶
const ( RoomService_CreatedRoom_FullMethodName = "/RoomService/CreatedRoom" RoomService_JoinRoom_FullMethodName = "/RoomService/JoinRoom" )
Variables ¶
var File_room_proto protoreflect.FileDescriptor
var RoomService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "RoomService", HandlerType: (*RoomServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreatedRoom", Handler: _RoomService_CreatedRoom_Handler, }, { MethodName: "JoinRoom", Handler: _RoomService_JoinRoom_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "room.proto", }
RoomService_ServiceDesc is the grpc.ServiceDesc for RoomService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterRoomServiceServer ¶
func RegisterRoomServiceServer(s grpc.ServiceRegistrar, srv RoomServiceServer)
Types ¶
type CreatedRoomRequest ¶
type CreatedRoomRequest struct {
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // room master the name
// contains filtered or unexported fields
}
func (*CreatedRoomRequest) Descriptor
deprecated
func (*CreatedRoomRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreatedRoomRequest.ProtoReflect.Descriptor instead.
func (*CreatedRoomRequest) GetName ¶
func (x *CreatedRoomRequest) GetName() string
func (*CreatedRoomRequest) ProtoMessage ¶
func (*CreatedRoomRequest) ProtoMessage()
func (*CreatedRoomRequest) ProtoReflect ¶
func (x *CreatedRoomRequest) ProtoReflect() protoreflect.Message
func (*CreatedRoomRequest) Reset ¶
func (x *CreatedRoomRequest) Reset()
func (*CreatedRoomRequest) String ¶
func (x *CreatedRoomRequest) String() string
type CreatedRoomResponse ¶
type CreatedRoomResponse struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // is room id
Users []*User `protobuf:"bytes,3,rep,name=users,proto3" json:"users,omitempty"` // user array
// contains filtered or unexported fields
}
func (*CreatedRoomResponse) Descriptor
deprecated
func (*CreatedRoomResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreatedRoomResponse.ProtoReflect.Descriptor instead.
func (*CreatedRoomResponse) GetId ¶
func (x *CreatedRoomResponse) GetId() string
func (*CreatedRoomResponse) GetUsers ¶
func (x *CreatedRoomResponse) GetUsers() []*User
func (*CreatedRoomResponse) ProtoMessage ¶
func (*CreatedRoomResponse) ProtoMessage()
func (*CreatedRoomResponse) ProtoReflect ¶
func (x *CreatedRoomResponse) ProtoReflect() protoreflect.Message
func (*CreatedRoomResponse) Reset ¶
func (x *CreatedRoomResponse) Reset()
func (*CreatedRoomResponse) String ¶
func (x *CreatedRoomResponse) String() string
type JoinRoomRequest ¶
type JoinRoomRequest struct {
RoomId string `protobuf:"bytes,1,opt,name=roomId,proto3" json:"roomId,omitempty"` // room id
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // in to room use the name
// contains filtered or unexported fields
}
func (*JoinRoomRequest) Descriptor
deprecated
func (*JoinRoomRequest) Descriptor() ([]byte, []int)
Deprecated: Use JoinRoomRequest.ProtoReflect.Descriptor instead.
func (*JoinRoomRequest) GetName ¶
func (x *JoinRoomRequest) GetName() string
func (*JoinRoomRequest) GetRoomId ¶
func (x *JoinRoomRequest) GetRoomId() string
func (*JoinRoomRequest) ProtoMessage ¶
func (*JoinRoomRequest) ProtoMessage()
func (*JoinRoomRequest) ProtoReflect ¶
func (x *JoinRoomRequest) ProtoReflect() protoreflect.Message
func (*JoinRoomRequest) Reset ¶
func (x *JoinRoomRequest) Reset()
func (*JoinRoomRequest) String ¶
func (x *JoinRoomRequest) String() string
type JoinedRoomResponse ¶
type JoinedRoomResponse struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // is room id
Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Users []*User `protobuf:"bytes,3,rep,name=users,proto3" json:"users,omitempty"` // user array
// contains filtered or unexported fields
}
func (*JoinedRoomResponse) Descriptor
deprecated
func (*JoinedRoomResponse) Descriptor() ([]byte, []int)
Deprecated: Use JoinedRoomResponse.ProtoReflect.Descriptor instead.
func (*JoinedRoomResponse) GetId ¶
func (x *JoinedRoomResponse) GetId() string
func (*JoinedRoomResponse) GetTimestamp ¶
func (x *JoinedRoomResponse) GetTimestamp() int64
func (*JoinedRoomResponse) GetUsers ¶
func (x *JoinedRoomResponse) GetUsers() []*User
func (*JoinedRoomResponse) ProtoMessage ¶
func (*JoinedRoomResponse) ProtoMessage()
func (*JoinedRoomResponse) ProtoReflect ¶
func (x *JoinedRoomResponse) ProtoReflect() protoreflect.Message
func (*JoinedRoomResponse) Reset ¶
func (x *JoinedRoomResponse) Reset()
func (*JoinedRoomResponse) String ¶
func (x *JoinedRoomResponse) String() string
type RoomServiceClient ¶
type RoomServiceClient interface {
// create a Room
CreatedRoom(ctx context.Context, in *CreatedRoomRequest, opts ...grpc.CallOption) (*CreatedRoomResponse, error)
// in to room
JoinRoom(ctx context.Context, in *JoinRoomRequest, opts ...grpc.CallOption) (*JoinedRoomResponse, error)
}
RoomServiceClient is the client API for RoomService 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.
func NewRoomServiceClient ¶
func NewRoomServiceClient(cc grpc.ClientConnInterface) RoomServiceClient
type RoomServiceServer ¶
type RoomServiceServer interface {
// create a Room
CreatedRoom(context.Context, *CreatedRoomRequest) (*CreatedRoomResponse, error)
// in to room
JoinRoom(context.Context, *JoinRoomRequest) (*JoinedRoomResponse, error)
// contains filtered or unexported methods
}
RoomServiceServer is the server API for RoomService service. All implementations must embed UnimplementedRoomServiceServer for forward compatibility.
type UnimplementedRoomServiceServer ¶
type UnimplementedRoomServiceServer struct{}
UnimplementedRoomServiceServer 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.
func (UnimplementedRoomServiceServer) CreatedRoom ¶
func (UnimplementedRoomServiceServer) CreatedRoom(context.Context, *CreatedRoomRequest) (*CreatedRoomResponse, error)
func (UnimplementedRoomServiceServer) JoinRoom ¶
func (UnimplementedRoomServiceServer) JoinRoom(context.Context, *JoinRoomRequest) (*JoinedRoomResponse, error)
type UnsafeRoomServiceServer ¶
type UnsafeRoomServiceServer interface {
// contains filtered or unexported methods
}
UnsafeRoomServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RoomServiceServer will result in compilation errors.
type User ¶
type User struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar,omitempty"`
Balance int32 `protobuf:"varint,4,opt,name=balance,proto3" json:"balance,omitempty"` // init default 0, this value can < 0
// contains filtered or unexported fields
}
func (*User) Descriptor
deprecated
func (*User) GetBalance ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message