Documentation ¶
Overview ¶
Package links is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- 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)
- type GetLinkReq
- type GetLinkRes
- type LinkServiceClient
- type LinkServiceServer
- type ShortenLinkReq
- type ShortenLinkRes
- type UnimplementedLinkServiceServer
- func (UnimplementedLinkServiceServer) GetLink(context.Context, *GetLinkReq) (*GetLinkRes, error)
- func (UnimplementedLinkServiceServer) ShortenLink(context.Context, *ShortenLinkReq) (*ShortenLinkRes, error)
- func (UnimplementedLinkServiceServer) VisitByKey(context.Context, *VisitByKeyReq) (*VisitByKeyRes, error)
- type UnsafeLinkServiceServer
- type VisitByKeyReq
- type VisitByKeyRes
Constants ¶
This section is empty.
Variables ¶
var File_links_proto protoreflect.FileDescriptor
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)
Types ¶
type GetLinkReq ¶
type GetLinkReq struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
func (*GetLinkReq) Descriptor
deprecated
func (*GetLinkReq) Descriptor() ([]byte, []int)
Deprecated: Use GetLinkReq.ProtoReflect.Descriptor instead.
func (*GetLinkReq) GetKey ¶
func (x *GetLinkReq) GetKey() string
func (*GetLinkReq) ProtoMessage ¶
func (*GetLinkReq) ProtoMessage()
func (*GetLinkReq) ProtoReflect ¶
func (x *GetLinkReq) ProtoReflect() protoreflect.Message
func (*GetLinkReq) Reset ¶
func (x *GetLinkReq) Reset()
func (*GetLinkReq) String ¶
func (x *GetLinkReq) String() string
type GetLinkRes ¶
type GetLinkRes struct { Link string `protobuf:"bytes,1,opt,name=link,proto3" json:"link,omitempty"` // contains filtered or unexported fields }
func (*GetLinkRes) Descriptor
deprecated
func (*GetLinkRes) Descriptor() ([]byte, []int)
Deprecated: Use GetLinkRes.ProtoReflect.Descriptor instead.
func (*GetLinkRes) GetLink ¶
func (x *GetLinkRes) GetLink() string
func (*GetLinkRes) ProtoMessage ¶
func (*GetLinkRes) ProtoMessage()
func (*GetLinkRes) ProtoReflect ¶
func (x *GetLinkRes) ProtoReflect() protoreflect.Message
func (*GetLinkRes) Reset ¶
func (x *GetLinkRes) Reset()
func (*GetLinkRes) String ¶
func (x *GetLinkRes) String() string
type LinkServiceClient ¶
type LinkServiceClient interface { ShortenLink(ctx context.Context, in *ShortenLinkReq, opts ...grpc.CallOption) (*ShortenLinkRes, error) GetLink(ctx context.Context, in *GetLinkReq, opts ...grpc.CallOption) (*GetLinkRes, error) VisitByKey(ctx context.Context, in *VisitByKeyReq, opts ...grpc.CallOption) (*VisitByKeyRes, 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 { ShortenLink(context.Context, *ShortenLinkReq) (*ShortenLinkRes, error) GetLink(context.Context, *GetLinkReq) (*GetLinkRes, error) VisitByKey(context.Context, *VisitByKeyReq) (*VisitByKeyRes, error) }
LinkServiceServer is the server API for LinkService service. All implementations should embed UnimplementedLinkServiceServer for forward compatibility
type ShortenLinkReq ¶
type ShortenLinkReq struct { Link string `protobuf:"bytes,1,opt,name=link,proto3" json:"link,omitempty"` // contains filtered or unexported fields }
func (*ShortenLinkReq) Descriptor
deprecated
func (*ShortenLinkReq) Descriptor() ([]byte, []int)
Deprecated: Use ShortenLinkReq.ProtoReflect.Descriptor instead.
func (*ShortenLinkReq) GetLink ¶
func (x *ShortenLinkReq) GetLink() string
func (*ShortenLinkReq) ProtoMessage ¶
func (*ShortenLinkReq) ProtoMessage()
func (*ShortenLinkReq) ProtoReflect ¶
func (x *ShortenLinkReq) ProtoReflect() protoreflect.Message
func (*ShortenLinkReq) Reset ¶
func (x *ShortenLinkReq) Reset()
func (*ShortenLinkReq) String ¶
func (x *ShortenLinkReq) String() string
type ShortenLinkRes ¶
type ShortenLinkRes struct { ShortLink string `protobuf:"bytes,1,opt,name=shortLink,proto3" json:"shortLink,omitempty"` // contains filtered or unexported fields }
func (*ShortenLinkRes) Descriptor
deprecated
func (*ShortenLinkRes) Descriptor() ([]byte, []int)
Deprecated: Use ShortenLinkRes.ProtoReflect.Descriptor instead.
func (*ShortenLinkRes) GetShortLink ¶
func (x *ShortenLinkRes) GetShortLink() string
func (*ShortenLinkRes) ProtoMessage ¶
func (*ShortenLinkRes) ProtoMessage()
func (*ShortenLinkRes) ProtoReflect ¶
func (x *ShortenLinkRes) ProtoReflect() protoreflect.Message
func (*ShortenLinkRes) Reset ¶
func (x *ShortenLinkRes) Reset()
func (*ShortenLinkRes) String ¶
func (x *ShortenLinkRes) String() string
type UnimplementedLinkServiceServer ¶
type UnimplementedLinkServiceServer struct { }
UnimplementedLinkServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedLinkServiceServer) GetLink ¶
func (UnimplementedLinkServiceServer) GetLink(context.Context, *GetLinkReq) (*GetLinkRes, error)
func (UnimplementedLinkServiceServer) ShortenLink ¶
func (UnimplementedLinkServiceServer) ShortenLink(context.Context, *ShortenLinkReq) (*ShortenLinkRes, error)
func (UnimplementedLinkServiceServer) VisitByKey ¶
func (UnimplementedLinkServiceServer) VisitByKey(context.Context, *VisitByKeyReq) (*VisitByKeyRes, error)
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.
type VisitByKeyReq ¶
type VisitByKeyReq struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
func (*VisitByKeyReq) Descriptor
deprecated
func (*VisitByKeyReq) Descriptor() ([]byte, []int)
Deprecated: Use VisitByKeyReq.ProtoReflect.Descriptor instead.
func (*VisitByKeyReq) GetKey ¶
func (x *VisitByKeyReq) GetKey() string
func (*VisitByKeyReq) ProtoMessage ¶
func (*VisitByKeyReq) ProtoMessage()
func (*VisitByKeyReq) ProtoReflect ¶
func (x *VisitByKeyReq) ProtoReflect() protoreflect.Message
func (*VisitByKeyReq) Reset ¶
func (x *VisitByKeyReq) Reset()
func (*VisitByKeyReq) String ¶
func (x *VisitByKeyReq) String() string
type VisitByKeyRes ¶
type VisitByKeyRes struct {
// contains filtered or unexported fields
}
func (*VisitByKeyRes) Descriptor
deprecated
func (*VisitByKeyRes) Descriptor() ([]byte, []int)
Deprecated: Use VisitByKeyRes.ProtoReflect.Descriptor instead.
func (*VisitByKeyRes) ProtoMessage ¶
func (*VisitByKeyRes) ProtoMessage()
func (*VisitByKeyRes) ProtoReflect ¶
func (x *VisitByKeyRes) ProtoReflect() protoreflect.Message
func (*VisitByKeyRes) Reset ¶
func (x *VisitByKeyRes) Reset()
func (*VisitByKeyRes) String ¶
func (x *VisitByKeyRes) String() string