model

package
v0.0.0-...-3f78249 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// những con số như: 50000, 50001 là duy nhất cho mỗi trường
	//
	// optional string default_string = 50000;
	E_DefaultString = &file_hello_proto_extTypes[0]
	// optional int32 default_int = 50001;
	E_DefaultInt = &file_hello_proto_extTypes[1]
)

Extension fields to descriptorpb.FieldOptions.

View Source
var File_hello_proto protoreflect.FileDescriptor
View Source
var HelloService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "model.HelloService",
	HandlerType: (*HelloServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Hello",
			Handler:    _HelloService_Hello_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Channel",
			Handler:       _HelloService_Channel_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "hello.proto",
}

HelloService_ServiceDesc is the grpc.ServiceDesc for HelloService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var PubsubService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "model.PubsubService",
	HandlerType: (*PubsubServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Publish",
			Handler:    _PubsubService_Publish_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Subscribe",
			Handler:       _PubsubService_Subscribe_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "hello.proto",
}

PubsubService_ServiceDesc is the grpc.ServiceDesc for PubsubService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterHelloServiceServer

func RegisterHelloServiceServer(s grpc.ServiceRegistrar, srv HelloServiceServer)

func RegisterPubsubServiceServer

func RegisterPubsubServiceServer(s grpc.ServiceRegistrar, srv PubsubServiceServer)

Types

type HelloServiceClient

type HelloServiceClient interface {
	// định nghĩa lời gọi hàm RPC
	Hello(ctx context.Context, in *String, opts ...grpc.CallOption) (*String, error)
	// nhận vào tham số một stream và trả về giá trị là một stream.
	Channel(ctx context.Context, opts ...grpc.CallOption) (HelloService_ChannelClient, error)
}

HelloServiceClient is the client API for HelloService 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 HelloServiceServer

type HelloServiceServer interface {
	// định nghĩa lời gọi hàm RPC
	Hello(context.Context, *String) (*String, error)
	// nhận vào tham số một stream và trả về giá trị là một stream.
	Channel(HelloService_ChannelServer) error
}

HelloServiceServer is the server API for HelloService service. All implementations should embed UnimplementedHelloServiceServer for forward compatibility

type HelloService_ChannelClient

type HelloService_ChannelClient interface {
	Send(*String) error
	Recv() (*String, error)
	grpc.ClientStream
}

type HelloService_ChannelServer

type HelloService_ChannelServer interface {
	Send(*String) error
	Recv() (*String, error)
	grpc.ServerStream
}

type Message

type Message struct {

	// default_string là giá trị mặc định cho name
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// tương tự, age sẽ có giá trị 10 nếu không khởi trị
	Age int32 `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"`
	// contains filtered or unexported fields
}

định nghĩa nội dung message

func (*Message) Descriptor deprecated

func (*Message) Descriptor() ([]byte, []int)

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetAge

func (x *Message) GetAge() int32

func (*Message) GetName

func (x *Message) GetName() string

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

func (x *Message) ProtoReflect() protoreflect.Message

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

type PubsubServiceClient

type PubsubServiceClient interface {
	// phương thức RPC thông thường
	Publish(ctx context.Context, in *String, opts ...grpc.CallOption) (*String, error)
	// service server streaming
	Subscribe(ctx context.Context, in *String, opts ...grpc.CallOption) (PubsubService_SubscribeClient, error)
}

PubsubServiceClient is the client API for PubsubService 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 PubsubServiceServer

type PubsubServiceServer interface {
	// phương thức RPC thông thường
	Publish(context.Context, *String) (*String, error)
	// service server streaming
	Subscribe(*String, PubsubService_SubscribeServer) error
}

PubsubServiceServer is the server API for PubsubService service. All implementations should embed UnimplementedPubsubServiceServer for forward compatibility

type PubsubService_SubscribeClient

type PubsubService_SubscribeClient interface {
	Recv() (*String, error)
	grpc.ClientStream
}

type PubsubService_SubscribeServer

type PubsubService_SubscribeServer interface {
	Send(*String) error
	grpc.ServerStream
}

type String

type String struct {

	// chuỗi string được truyền vào hàm RPC
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

message là một đơn vị dữ liệu trong Protobuf

func (*String) Descriptor deprecated

func (*String) Descriptor() ([]byte, []int)

Deprecated: Use String.ProtoReflect.Descriptor instead.

func (*String) GetValue

func (x *String) GetValue() string

func (*String) ProtoMessage

func (*String) ProtoMessage()

func (*String) ProtoReflect

func (x *String) ProtoReflect() protoreflect.Message

func (*String) Reset

func (x *String) Reset()

func (*String) String

func (x *String) String() string

type UnimplementedHelloServiceServer

type UnimplementedHelloServiceServer struct {
}

UnimplementedHelloServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedHelloServiceServer) Channel

func (UnimplementedHelloServiceServer) Hello

type UnimplementedPubsubServiceServer

type UnimplementedPubsubServiceServer struct {
}

UnimplementedPubsubServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedPubsubServiceServer) Publish

func (UnimplementedPubsubServiceServer) Subscribe

type UnsafeHelloServiceServer

type UnsafeHelloServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeHelloServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HelloServiceServer will result in compilation errors.

type UnsafePubsubServiceServer

type UnsafePubsubServiceServer interface {
	// contains filtered or unexported methods
}

UnsafePubsubServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PubsubServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL