gen

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package gen is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_proto_imp_api_kv_kv_proto protoreflect.FileDescriptor
View Source
var KV_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "kv.KV",
	HandlerType: (*KVServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetKey",
			Handler:    _KV_GetKey_Handler,
		},
		{
			MethodName: "SetKey",
			Handler:    _KV_SetKey_Handler,
		},
		{
			MethodName: "DelKey",
			Handler:    _KV_DelKey_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/imp/api/kv/kv.proto",
}

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

Functions

func RegisterKVHandler

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

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

func RegisterKVHandlerClient

func RegisterKVHandlerClient(ctx context.Context, mux *runtime.ServeMux, client KVClient) error

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

func RegisterKVHandlerFromEndpoint

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

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

func RegisterKVHandlerServer

func RegisterKVHandlerServer(ctx context.Context, mux *runtime.ServeMux, server KVServer) error

RegisterKVHandlerServer registers the http handlers for service KV to "mux". UnaryRPC :call KVServer 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 RegisterKVHandlerFromEndpoint instead.

func RegisterKVServer

func RegisterKVServer(s grpc.ServiceRegistrar, srv KVServer)

Types

type DelKeyRequest

type DelKeyRequest struct {
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The name of the key to del
	// contains filtered or unexported fields
}

* Represents a request to delete a key and value.

func (*DelKeyRequest) Descriptor deprecated

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

Deprecated: Use DelKeyRequest.ProtoReflect.Descriptor instead.

func (*DelKeyRequest) GetKey

func (x *DelKeyRequest) GetKey() string

func (*DelKeyRequest) ProtoMessage

func (*DelKeyRequest) ProtoMessage()

func (*DelKeyRequest) ProtoReflect

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

func (*DelKeyRequest) Reset

func (x *DelKeyRequest) Reset()

func (*DelKeyRequest) String

func (x *DelKeyRequest) String() string

type DelKeyResponse

type DelKeyResponse struct {
	// contains filtered or unexported fields
}

* Represents a response for deletion HTTP 200=Deleted

func (*DelKeyResponse) Descriptor deprecated

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

Deprecated: Use DelKeyResponse.ProtoReflect.Descriptor instead.

func (*DelKeyResponse) ProtoMessage

func (*DelKeyResponse) ProtoMessage()

func (*DelKeyResponse) ProtoReflect

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

func (*DelKeyResponse) Reset

func (x *DelKeyResponse) Reset()

func (*DelKeyResponse) String

func (x *DelKeyResponse) String() string

type GetKeyRequest

type GetKeyRequest struct {
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The name of the key to get
	// contains filtered or unexported fields
}

* Represents a request to get a key and value.

func (*GetKeyRequest) Descriptor deprecated

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

Deprecated: Use GetKeyRequest.ProtoReflect.Descriptor instead.

func (*GetKeyRequest) GetKey

func (x *GetKeyRequest) GetKey() string

func (*GetKeyRequest) ProtoMessage

func (*GetKeyRequest) ProtoMessage()

func (*GetKeyRequest) ProtoReflect

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

func (*GetKeyRequest) Reset

func (x *GetKeyRequest) Reset()

func (*GetKeyRequest) String

func (x *GetKeyRequest) String() string

type GetKeyResponse

type GetKeyResponse struct {
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // The contents of the value
	// contains filtered or unexported fields
}

* Represents a response containing the value

func (*GetKeyResponse) Descriptor deprecated

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

Deprecated: Use GetKeyResponse.ProtoReflect.Descriptor instead.

func (*GetKeyResponse) GetValue

func (x *GetKeyResponse) GetValue() string

func (*GetKeyResponse) ProtoMessage

func (*GetKeyResponse) ProtoMessage()

func (*GetKeyResponse) ProtoReflect

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

func (*GetKeyResponse) Reset

func (x *GetKeyResponse) Reset()

func (*GetKeyResponse) String

func (x *GetKeyResponse) String() string

type KVClient

type KVClient interface {
	//*
	// GetKey will retrieve a key
	GetKey(ctx context.Context, in *GetKeyRequest, opts ...grpc.CallOption) (*GetKeyResponse, error)
	//*
	// SetKey will set a key
	SetKey(ctx context.Context, in *SetKeyRequest, opts ...grpc.CallOption) (*SetKeyResponse, error)
	//*
	// DelKey will delete a key
	DelKey(ctx context.Context, in *DelKeyRequest, opts ...grpc.CallOption) (*DelKeyResponse, error)
}

KVClient is the client API for KV 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 NewKVClient

func NewKVClient(cc grpc.ClientConnInterface) KVClient

type KVServer

type KVServer interface {
	//*
	// GetKey will retrieve a key
	GetKey(context.Context, *GetKeyRequest) (*GetKeyResponse, error)
	//*
	// SetKey will set a key
	SetKey(context.Context, *SetKeyRequest) (*SetKeyResponse, error)
	//*
	// DelKey will delete a key
	DelKey(context.Context, *DelKeyRequest) (*DelKeyResponse, error)
	// contains filtered or unexported methods
}

KVServer is the server API for KV service. All implementations must embed UnimplementedKVServer for forward compatibility

type SetKeyRequest

type SetKeyRequest struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`     // The name of the key to set
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // The value to set
	// contains filtered or unexported fields
}

* Represents a request to get a key and value.

func (*SetKeyRequest) Descriptor deprecated

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

Deprecated: Use SetKeyRequest.ProtoReflect.Descriptor instead.

func (*SetKeyRequest) GetKey

func (x *SetKeyRequest) GetKey() string

func (*SetKeyRequest) GetValue

func (x *SetKeyRequest) GetValue() string

func (*SetKeyRequest) ProtoMessage

func (*SetKeyRequest) ProtoMessage()

func (*SetKeyRequest) ProtoReflect

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

func (*SetKeyRequest) Reset

func (x *SetKeyRequest) Reset()

func (*SetKeyRequest) String

func (x *SetKeyRequest) String() string

type SetKeyResponse

type SetKeyResponse struct {
	// contains filtered or unexported fields
}

* Represents a response for HTTP 200=Set

func (*SetKeyResponse) Descriptor deprecated

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

Deprecated: Use SetKeyResponse.ProtoReflect.Descriptor instead.

func (*SetKeyResponse) ProtoMessage

func (*SetKeyResponse) ProtoMessage()

func (*SetKeyResponse) ProtoReflect

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

func (*SetKeyResponse) Reset

func (x *SetKeyResponse) Reset()

func (*SetKeyResponse) String

func (x *SetKeyResponse) String() string

type UnimplementedKVServer

type UnimplementedKVServer struct {
}

UnimplementedKVServer must be embedded to have forward compatible implementations.

func (UnimplementedKVServer) DelKey

func (UnimplementedKVServer) GetKey

func (UnimplementedKVServer) SetKey

type UnsafeKVServer

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

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

Jump to

Keyboard shortcuts

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