Documentation ¶
Overview ¶
Package v1 is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterLinkServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterLinkServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LinkServiceClient) error
- func RegisterLinkServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterLinkServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LinkServiceServer) error
- func RegisterLinkServiceServer(s grpc.ServiceRegistrar, srv LinkServiceServer)
- func RegisterSpan(ctx context.Context) error
- type API
- func (api *API) Close() error
- func (api *API) CreateLink(ctx context.Context, req *CreateLinkRequest) (*CreateLinkResponse, error)
- func (api *API) CustomHTTPError(_ context.Context, _ *runtime.ServeMux, marshaler runtime.Marshaler, ...)
- func (api *API) DeleteLink(ctx context.Context, req *DeleteLinkRequest) (*emptypb.Empty, error)
- func (api *API) GetLink(ctx context.Context, req *GetLinkRequest) (*GetLinkResponse, error)
- func (api *API) GetLinks(ctx context.Context, req *GetLinksRequest) (*GetLinksResponse, error)
- func (api *API) Run(ctx context.Context, config http_server.Config, log logger.Logger, ...) error
- type LinkServiceClient
- type LinkServiceServer
- type UnimplementedLinkServiceServer
- func (UnimplementedLinkServiceServer) CreateLink(context.Context, *CreateLinkRequest) (*CreateLinkResponse, error)
- func (UnimplementedLinkServiceServer) DeleteLink(context.Context, *DeleteLinkRequest) (*emptypb.Empty, error)
- func (UnimplementedLinkServiceServer) GetLink(context.Context, *GetLinkRequest) (*GetLinkResponse, error)
- func (UnimplementedLinkServiceServer) GetLinks(context.Context, *GetLinksRequest) (*GetLinksResponse, error)
- type UnsafeLinkServiceServer
Constants ¶
const ( LinkService_GetLinks_FullMethodName = "/server.v1.LinkService/GetLinks" LinkService_GetLink_FullMethodName = "/server.v1.LinkService/GetLink" LinkService_CreateLink_FullMethodName = "/server.v1.LinkService/CreateLink" LinkService_DeleteLink_FullMethodName = "/server.v1.LinkService/DeleteLink" )
Variables ¶
var LinkService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "server.v1.LinkService", HandlerType: (*LinkServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetLinks", Handler: _LinkService_GetLinks_Handler, }, { MethodName: "GetLink", Handler: _LinkService_GetLink_Handler, }, { MethodName: "CreateLink", Handler: _LinkService_CreateLink_Handler, }, { MethodName: "DeleteLink", Handler: _LinkService_DeleteLink_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "server/v1/grpc_api.proto", }
LinkService_ServiceDesc is the grpc.ServiceDesc for LinkService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterLinkServiceHandler ¶
func RegisterLinkServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterLinkServiceHandler registers the http handlers for service LinkService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterLinkServiceHandlerClient ¶
func RegisterLinkServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LinkServiceClient) error
RegisterLinkServiceHandlerClient registers the http handlers for service LinkService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LinkServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LinkServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "LinkServiceClient" to call the correct interceptors.
func RegisterLinkServiceHandlerFromEndpoint ¶
func RegisterLinkServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterLinkServiceHandlerFromEndpoint is same as RegisterLinkServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterLinkServiceHandlerServer ¶
func RegisterLinkServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LinkServiceServer) error
RegisterLinkServiceHandlerServer registers the http handlers for service LinkService to "mux". UnaryRPC :call LinkServiceServer 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 to stop working. Consider using RegisterLinkServiceHandlerFromEndpoint instead.
func RegisterLinkServiceServer ¶
func RegisterLinkServiceServer(s grpc.ServiceRegistrar, srv LinkServiceServer)
func RegisterSpan ¶
RegisterSpan - inject spanId in response header
Types ¶
type API ¶
type API struct { LinkServiceServer RPC *rpc.Server // contains filtered or unexported fields }
API ...
func (*API) CreateLink ¶
func (api *API) CreateLink(ctx context.Context, req *CreateLinkRequest) (*CreateLinkResponse, error)
CreateLink ...
func (*API) CustomHTTPError ¶
func (*API) DeleteLink ¶
DeleteLink ...
func (*API) Run ¶
func (api *API) Run( ctx context.Context, config http_server.Config, log logger.Logger, tracer trace.TracerProvider, link_rpc link_rpc.LinkServiceClient, link_command link_cqrs.LinkCommandServiceClient, link_query link_cqrs.LinkQueryServiceClient, sitemap_rpc sitemap_rpc.SitemapServiceClient, ) error
Run HTTP-server
type LinkServiceClient ¶
type LinkServiceClient interface { // GetLinks returns a list of links. GetLinks(ctx context.Context, in *GetLinksRequest, opts ...grpc.CallOption) (*GetLinksResponse, error) // GetLink returns a link. GetLink(ctx context.Context, in *GetLinkRequest, opts ...grpc.CallOption) (*GetLinkResponse, error) // CreateLink creates a link. CreateLink(ctx context.Context, in *CreateLinkRequest, opts ...grpc.CallOption) (*CreateLinkResponse, error) // DeleteLink deletes a link. DeleteLink(ctx context.Context, in *DeleteLinkRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) }
LinkServiceClient is the client API for LinkService 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 NewLinkServiceClient ¶
func NewLinkServiceClient(cc grpc.ClientConnInterface) LinkServiceClient
type LinkServiceServer ¶
type LinkServiceServer interface { // GetLinks returns a list of links. GetLinks(context.Context, *GetLinksRequest) (*GetLinksResponse, error) // GetLink returns a link. GetLink(context.Context, *GetLinkRequest) (*GetLinkResponse, error) // CreateLink creates a link. CreateLink(context.Context, *CreateLinkRequest) (*CreateLinkResponse, error) // DeleteLink deletes a link. DeleteLink(context.Context, *DeleteLinkRequest) (*emptypb.Empty, error) }
LinkServiceServer is the server API for LinkService service. All implementations should embed UnimplementedLinkServiceServer for forward compatibility
type UnimplementedLinkServiceServer ¶
type UnimplementedLinkServiceServer struct { }
UnimplementedLinkServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedLinkServiceServer) CreateLink ¶
func (UnimplementedLinkServiceServer) CreateLink(context.Context, *CreateLinkRequest) (*CreateLinkResponse, error)
func (UnimplementedLinkServiceServer) DeleteLink ¶
type UnsafeLinkServiceServer ¶
type UnsafeLinkServiceServer interface {
// contains filtered or unexported methods
}
UnsafeLinkServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to LinkServiceServer will result in compilation errors.