v1

package
v0.0.0-...-0e6535b Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_todo_service_proto protoreflect.FileDescriptor

Functions

func RegisterToDoServiceHandler

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

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

func RegisterToDoServiceHandlerClient

func RegisterToDoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ToDoServiceClient) error

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

func RegisterToDoServiceHandlerFromEndpoint

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

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

func RegisterToDoServiceHandlerServer

func RegisterToDoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ToDoServiceServer) error

RegisterToDoServiceHandlerServer registers the http handlers for service ToDoService to "mux". UnaryRPC :call ToDoServiceServer 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 RegisterToDoServiceHandlerFromEndpoint instead.

func RegisterToDoServiceServer

func RegisterToDoServiceServer(s grpc.ServiceRegistrar, srv ToDoServiceServer)

Types

type CreateRequest

type CreateRequest struct {
	Todo *ToDo `protobuf:"bytes,1,opt,name=todo,proto3" json:"todo,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetTodo

func (x *CreateRequest) GetTodo() *ToDo

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type CreateResponse

type CreateResponse struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateResponse) Descriptor deprecated

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

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetId

func (x *CreateResponse) GetId() int64

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

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

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

type DeleteRequest

type DeleteRequest struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetId

func (x *DeleteRequest) GetId() int64

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type DeleteResponse

type DeleteResponse struct {
	Deleted int64 `protobuf:"varint,1,opt,name=deleted,proto3" json:"deleted,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteResponse) Descriptor deprecated

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

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) GetDeleted

func (x *DeleteResponse) GetDeleted() int64

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

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

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

type ReadAllRequest

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

func (*ReadAllRequest) Descriptor deprecated

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

Deprecated: Use ReadAllRequest.ProtoReflect.Descriptor instead.

func (*ReadAllRequest) ProtoMessage

func (*ReadAllRequest) ProtoMessage()

func (*ReadAllRequest) ProtoReflect

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

func (*ReadAllRequest) Reset

func (x *ReadAllRequest) Reset()

func (*ReadAllRequest) String

func (x *ReadAllRequest) String() string

type ReadAllResponse

type ReadAllResponse struct {
	Todos []*ToDo `protobuf:"bytes,1,rep,name=todos,proto3" json:"todos,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadAllResponse) Descriptor deprecated

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

Deprecated: Use ReadAllResponse.ProtoReflect.Descriptor instead.

func (*ReadAllResponse) GetTodos

func (x *ReadAllResponse) GetTodos() []*ToDo

func (*ReadAllResponse) ProtoMessage

func (*ReadAllResponse) ProtoMessage()

func (*ReadAllResponse) ProtoReflect

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

func (*ReadAllResponse) Reset

func (x *ReadAllResponse) Reset()

func (*ReadAllResponse) String

func (x *ReadAllResponse) String() string

type ReadRequest

type ReadRequest struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadRequest) Descriptor deprecated

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

Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.

func (*ReadRequest) GetId

func (x *ReadRequest) GetId() int64

func (*ReadRequest) ProtoMessage

func (*ReadRequest) ProtoMessage()

func (*ReadRequest) ProtoReflect

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

func (*ReadRequest) Reset

func (x *ReadRequest) Reset()

func (*ReadRequest) String

func (x *ReadRequest) String() string

type ReadResponse

type ReadResponse struct {
	Todo *ToDo `protobuf:"bytes,1,opt,name=todo,proto3" json:"todo,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadResponse) Descriptor deprecated

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

Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.

func (*ReadResponse) GetTodo

func (x *ReadResponse) GetTodo() *ToDo

func (*ReadResponse) ProtoMessage

func (*ReadResponse) ProtoMessage()

func (*ReadResponse) ProtoReflect

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

func (*ReadResponse) Reset

func (x *ReadResponse) Reset()

func (*ReadResponse) String

func (x *ReadResponse) String() string

type ToDo

type ToDo struct {
	Id          int64                `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Title       string               `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	Description string               `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	Reminder    *timestamp.Timestamp `protobuf:"bytes,4,opt,name=reminder,proto3" json:"reminder,omitempty"`
	// contains filtered or unexported fields
}

func (*ToDo) Descriptor deprecated

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

Deprecated: Use ToDo.ProtoReflect.Descriptor instead.

func (*ToDo) GetDescription

func (x *ToDo) GetDescription() string

func (*ToDo) GetId

func (x *ToDo) GetId() int64

func (*ToDo) GetReminder

func (x *ToDo) GetReminder() *timestamp.Timestamp

func (*ToDo) GetTitle

func (x *ToDo) GetTitle() string

func (*ToDo) ProtoMessage

func (*ToDo) ProtoMessage()

func (*ToDo) ProtoReflect

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

func (*ToDo) Reset

func (x *ToDo) Reset()

func (*ToDo) String

func (x *ToDo) String() string

type ToDoServiceClient

type ToDoServiceClient interface {
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error)
	Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
	ReadAll(ctx context.Context, in *ReadAllRequest, opts ...grpc.CallOption) (*ReadAllResponse, error)
}

ToDoServiceClient is the client API for ToDoService 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 ToDoServiceServer

type ToDoServiceServer interface {
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	Read(context.Context, *ReadRequest) (*ReadResponse, error)
	Update(context.Context, *UpdateRequest) (*UpdateResponse, error)
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
	ReadAll(context.Context, *ReadAllRequest) (*ReadAllResponse, error)
	// contains filtered or unexported methods
}

ToDoServiceServer is the server API for ToDoService service. All implementations must embed UnimplementedToDoServiceServer for forward compatibility

type UnimplementedToDoServiceServer

type UnimplementedToDoServiceServer struct {
}

UnimplementedToDoServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedToDoServiceServer) Create

func (UnimplementedToDoServiceServer) Delete

func (UnimplementedToDoServiceServer) Read

func (UnimplementedToDoServiceServer) ReadAll

func (UnimplementedToDoServiceServer) Update

type UnsafeToDoServiceServer

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

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

type UpdateRequest

type UpdateRequest struct {
	Todo *ToDo `protobuf:"bytes,1,opt,name=todo,proto3" json:"todo,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateRequest) Descriptor deprecated

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

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetTodo

func (x *UpdateRequest) GetTodo() *ToDo

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect

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

func (*UpdateRequest) Reset

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String

func (x *UpdateRequest) String() string

type UpdateResponse

type UpdateResponse struct {
	Updated int64 `protobuf:"varint,1,opt,name=updated,proto3" json:"updated,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateResponse) Descriptor deprecated

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

Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.

func (*UpdateResponse) GetUpdated

func (x *UpdateResponse) GetUpdated() int64

func (*UpdateResponse) ProtoMessage

func (*UpdateResponse) ProtoMessage()

func (*UpdateResponse) ProtoReflect

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

func (*UpdateResponse) Reset

func (x *UpdateResponse) Reset()

func (*UpdateResponse) String

func (x *UpdateResponse) String() string

Jump to

Keyboard shortcuts

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