grpcservice

package
v0.0.0-...-1f1360f Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package grpcservice is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

Functions

func RegisterNewsServiceHandler

func RegisterNewsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterNewsServiceHandler registers the http handlers for service NewsService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterNewsServiceHandlerClient

func RegisterNewsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NewsServiceClient) error

RegisterNewsServiceHandlerClient registers the http handlers for service NewsService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NewsServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NewsServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "NewsServiceClient" to call the correct interceptors.

func RegisterNewsServiceHandlerFromEndpoint

func RegisterNewsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterNewsServiceHandlerFromEndpoint is same as RegisterNewsServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterNewsServiceHandlerServer

func RegisterNewsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NewsServiceServer) error

RegisterNewsServiceHandlerServer registers the http handlers for service NewsService to "mux". UnaryRPC :call NewsServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterNewsServiceHandlerFromEndpoint instead.

func RegisterNewsServiceServer

func RegisterNewsServiceServer(s *grpc.Server, srv NewsServiceServer)

Types

type GetNewsRequest

type GetNewsRequest struct {
	Userid string `protobuf:"bytes,1,opt,name=userid,proto3" json:"userid,omitempty"`
	// contains filtered or unexported fields
}

func (*GetNewsRequest) Descriptor deprecated

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

Deprecated: Use GetNewsRequest.ProtoReflect.Descriptor instead.

func (*GetNewsRequest) GetUserid

func (x *GetNewsRequest) GetUserid() string

func (*GetNewsRequest) ProtoMessage

func (*GetNewsRequest) ProtoMessage()

func (*GetNewsRequest) ProtoReflect

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

func (*GetNewsRequest) Reset

func (x *GetNewsRequest) Reset()

func (*GetNewsRequest) String

func (x *GetNewsRequest) String() string

type GetNewsResponse

type GetNewsResponse struct {
	News *News `protobuf:"bytes,1,opt,name=news,proto3" json:"news,omitempty"`
	// contains filtered or unexported fields
}

func (*GetNewsResponse) Descriptor deprecated

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

Deprecated: Use GetNewsResponse.ProtoReflect.Descriptor instead.

func (*GetNewsResponse) GetNews

func (x *GetNewsResponse) GetNews() *News

func (*GetNewsResponse) ProtoMessage

func (*GetNewsResponse) ProtoMessage()

func (*GetNewsResponse) ProtoReflect

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

func (*GetNewsResponse) Reset

func (x *GetNewsResponse) Reset()

func (*GetNewsResponse) String

func (x *GetNewsResponse) String() string

type News

type News struct {
	OneNews []*OneNews `protobuf:"bytes,1,rep,name=oneNews,proto3" json:"oneNews,omitempty"`
	// contains filtered or unexported fields
}

func (*News) Descriptor deprecated

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

Deprecated: Use News.ProtoReflect.Descriptor instead.

func (*News) GetOneNews

func (x *News) GetOneNews() []*OneNews

func (*News) ProtoMessage

func (*News) ProtoMessage()

func (*News) ProtoReflect

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

func (*News) Reset

func (x *News) Reset()

func (*News) String

func (x *News) String() string

type NewsServiceClient

type NewsServiceClient interface {
	GetNews(ctx context.Context, in *GetNewsRequest, opts ...grpc.CallOption) (*GetNewsResponse, error)
}

NewsServiceClient is the client API for NewsService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type NewsServiceServer

type NewsServiceServer interface {
	GetNews(context.Context, *GetNewsRequest) (*GetNewsResponse, error)
}

NewsServiceServer is the server API for NewsService service.

type OneNews

type OneNews struct {
	Id            uint64               `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Author        uint64               `protobuf:"varint,2,opt,name=author,proto3" json:"author,omitempty"`
	Title         string               `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"`
	Datetime      *timestamp.Timestamp `protobuf:"bytes,4,opt,name=datetime,proto3" json:"datetime,omitempty"`
	Content       string               `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"`
	AuthorName    string               `protobuf:"bytes,6,opt,name=authorName,proto3" json:"authorName,omitempty"`
	AuthorSurname string               `protobuf:"bytes,7,opt,name=authorSurname,proto3" json:"authorSurname,omitempty"`
	AuthorGen     string               `protobuf:"bytes,8,opt,name=authorGen,proto3" json:"authorGen,omitempty"`
	// contains filtered or unexported fields
}

func (*OneNews) Descriptor deprecated

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

Deprecated: Use OneNews.ProtoReflect.Descriptor instead.

func (*OneNews) GetAuthor

func (x *OneNews) GetAuthor() uint64

func (*OneNews) GetAuthorGen

func (x *OneNews) GetAuthorGen() string

func (*OneNews) GetAuthorName

func (x *OneNews) GetAuthorName() string

func (*OneNews) GetAuthorSurname

func (x *OneNews) GetAuthorSurname() string

func (*OneNews) GetContent

func (x *OneNews) GetContent() string

func (*OneNews) GetDatetime

func (x *OneNews) GetDatetime() *timestamp.Timestamp

func (*OneNews) GetId

func (x *OneNews) GetId() uint64

func (*OneNews) GetTitle

func (x *OneNews) GetTitle() string

func (*OneNews) ProtoMessage

func (*OneNews) ProtoMessage()

func (*OneNews) ProtoReflect

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

func (*OneNews) Reset

func (x *OneNews) Reset()

func (*OneNews) String

func (x *OneNews) String() string

type UnimplementedNewsServiceServer

type UnimplementedNewsServiceServer struct {
}

UnimplementedNewsServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedNewsServiceServer) GetNews

Jump to

Keyboard shortcuts

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