v1

package
v0.0.0-...-772d1aa Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: MIT Imports: 14 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

This section is empty.

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.

func RegisterTodoServiceServer

func RegisterTodoServiceServer(s *grpc.Server, srv TodoServiceServer)

Types

type CreateRequest

type CreateRequest struct {
	// Api versioning
	Api string `protobuf:"bytes,1,opt,name=Api,proto3" json:"Api,omitempty"`
	// Task entity to add
	Todo                 *Todo    `protobuf:"bytes,2,opt,name=todo,proto3" json:"todo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CreateRequest) Descriptor

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

func (*CreateRequest) GetApi

func (m *CreateRequest) GetApi() string

func (*CreateRequest) GetTodo

func (m *CreateRequest) GetTodo() *Todo

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) Reset

func (m *CreateRequest) Reset()

func (*CreateRequest) String

func (m *CreateRequest) String() string

func (*CreateRequest) XXX_DiscardUnknown

func (m *CreateRequest) XXX_DiscardUnknown()

func (*CreateRequest) XXX_Marshal

func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateRequest) XXX_Merge

func (m *CreateRequest) XXX_Merge(src proto.Message)

func (*CreateRequest) XXX_Size

func (m *CreateRequest) XXX_Size() int

func (*CreateRequest) XXX_Unmarshal

func (m *CreateRequest) XXX_Unmarshal(b []byte) error

type CreateResponse

type CreateResponse struct {
	// Api versioning
	Api string `protobuf:"bytes,1,opt,name=Api,proto3" json:"Api,omitempty"`
	// Created task id
	Id                   int64    `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CreateResponse) Descriptor

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

func (*CreateResponse) GetApi

func (m *CreateResponse) GetApi() string

func (*CreateResponse) GetId

func (m *CreateResponse) GetId() int64

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) Reset

func (m *CreateResponse) Reset()

func (*CreateResponse) String

func (m *CreateResponse) String() string

func (*CreateResponse) XXX_DiscardUnknown

func (m *CreateResponse) XXX_DiscardUnknown()

func (*CreateResponse) XXX_Marshal

func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateResponse) XXX_Merge

func (m *CreateResponse) XXX_Merge(src proto.Message)

func (*CreateResponse) XXX_Size

func (m *CreateResponse) XXX_Size() int

func (*CreateResponse) XXX_Unmarshal

func (m *CreateResponse) XXX_Unmarshal(b []byte) error

type DeleteRequest

type DeleteRequest struct {
	// Api versioning
	Api string `protobuf:"bytes,1,opt,name=Api,proto3" json:"Api,omitempty"`
	// Entity Id to delete
	Id                   int64    `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteRequest) Descriptor

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

func (*DeleteRequest) GetApi

func (m *DeleteRequest) GetApi() string

func (*DeleteRequest) GetId

func (m *DeleteRequest) GetId() int64

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) Reset

func (m *DeleteRequest) Reset()

func (*DeleteRequest) String

func (m *DeleteRequest) String() string

func (*DeleteRequest) XXX_DiscardUnknown

func (m *DeleteRequest) XXX_DiscardUnknown()

func (*DeleteRequest) XXX_Marshal

func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteRequest) XXX_Merge

func (m *DeleteRequest) XXX_Merge(src proto.Message)

func (*DeleteRequest) XXX_Size

func (m *DeleteRequest) XXX_Size() int

func (*DeleteRequest) XXX_Unmarshal

func (m *DeleteRequest) XXX_Unmarshal(b []byte) error

type DeleteResponse

type DeleteResponse struct {
	// Api versioning
	Api string `protobuf:"bytes,1,opt,name=Api,proto3" json:"Api,omitempty"`
	// Status return whether the entity is deleted
	Deleted              int64    `protobuf:"varint,2,opt,name=deleted,proto3" json:"deleted,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*DeleteResponse) Descriptor

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

func (*DeleteResponse) GetApi

func (m *DeleteResponse) GetApi() string

func (*DeleteResponse) GetDeleted

func (m *DeleteResponse) GetDeleted() int64

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) Reset

func (m *DeleteResponse) Reset()

func (*DeleteResponse) String

func (m *DeleteResponse) String() string

func (*DeleteResponse) XXX_DiscardUnknown

func (m *DeleteResponse) XXX_DiscardUnknown()

func (*DeleteResponse) XXX_Marshal

func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeleteResponse) XXX_Merge

func (m *DeleteResponse) XXX_Merge(src proto.Message)

func (*DeleteResponse) XXX_Size

func (m *DeleteResponse) XXX_Size() int

func (*DeleteResponse) XXX_Unmarshal

func (m *DeleteResponse) XXX_Unmarshal(b []byte) error

type ReadAllRequest

type ReadAllRequest struct {
	// Api versioning
	Api                  string   `protobuf:"bytes,1,opt,name=Api,proto3" json:"Api,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ReadAllRequest) Descriptor

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

func (*ReadAllRequest) GetApi

func (m *ReadAllRequest) GetApi() string

func (*ReadAllRequest) ProtoMessage

func (*ReadAllRequest) ProtoMessage()

func (*ReadAllRequest) Reset

func (m *ReadAllRequest) Reset()

func (*ReadAllRequest) String

func (m *ReadAllRequest) String() string

func (*ReadAllRequest) XXX_DiscardUnknown

func (m *ReadAllRequest) XXX_DiscardUnknown()

func (*ReadAllRequest) XXX_Marshal

func (m *ReadAllRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReadAllRequest) XXX_Merge

func (m *ReadAllRequest) XXX_Merge(src proto.Message)

func (*ReadAllRequest) XXX_Size

func (m *ReadAllRequest) XXX_Size() int

func (*ReadAllRequest) XXX_Unmarshal

func (m *ReadAllRequest) XXX_Unmarshal(b []byte) error

type ReadAllResponse

type ReadAllResponse struct {
	// Api versioning
	Api string `protobuf:"bytes,1,opt,name=Api,proto3" json:"Api,omitempty"`
	// Return all the task
	Todo                 []*Todo  `protobuf:"bytes,2,rep,name=todo,proto3" json:"todo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ReadAllResponse) Descriptor

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

func (*ReadAllResponse) GetApi

func (m *ReadAllResponse) GetApi() string

func (*ReadAllResponse) GetTodo

func (m *ReadAllResponse) GetTodo() []*Todo

func (*ReadAllResponse) ProtoMessage

func (*ReadAllResponse) ProtoMessage()

func (*ReadAllResponse) Reset

func (m *ReadAllResponse) Reset()

func (*ReadAllResponse) String

func (m *ReadAllResponse) String() string

func (*ReadAllResponse) XXX_DiscardUnknown

func (m *ReadAllResponse) XXX_DiscardUnknown()

func (*ReadAllResponse) XXX_Marshal

func (m *ReadAllResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReadAllResponse) XXX_Merge

func (m *ReadAllResponse) XXX_Merge(src proto.Message)

func (*ReadAllResponse) XXX_Size

func (m *ReadAllResponse) XXX_Size() int

func (*ReadAllResponse) XXX_Unmarshal

func (m *ReadAllResponse) XXX_Unmarshal(b []byte) error

type ReadRequest

type ReadRequest struct {
	// Api versioning
	Api string `protobuf:"bytes,1,opt,name=Api,proto3" json:"Api,omitempty"`
	// The task id to read
	Id                   int64    `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ReadRequest) Descriptor

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

func (*ReadRequest) GetApi

func (m *ReadRequest) GetApi() string

func (*ReadRequest) GetId

func (m *ReadRequest) GetId() int64

func (*ReadRequest) ProtoMessage

func (*ReadRequest) ProtoMessage()

func (*ReadRequest) Reset

func (m *ReadRequest) Reset()

func (*ReadRequest) String

func (m *ReadRequest) String() string

func (*ReadRequest) XXX_DiscardUnknown

func (m *ReadRequest) XXX_DiscardUnknown()

func (*ReadRequest) XXX_Marshal

func (m *ReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReadRequest) XXX_Merge

func (m *ReadRequest) XXX_Merge(src proto.Message)

func (*ReadRequest) XXX_Size

func (m *ReadRequest) XXX_Size() int

func (*ReadRequest) XXX_Unmarshal

func (m *ReadRequest) XXX_Unmarshal(b []byte) error

type ReadResponse

type ReadResponse struct {
	// Api versioning
	Api string `protobuf:"bytes,1,opt,name=Api,proto3" json:"Api,omitempty"`
	// Return Task entity
	Todo                 *Todo    `protobuf:"bytes,2,opt,name=todo,proto3" json:"todo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ReadResponse) Descriptor

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

func (*ReadResponse) GetApi

func (m *ReadResponse) GetApi() string

func (*ReadResponse) GetTodo

func (m *ReadResponse) GetTodo() *Todo

func (*ReadResponse) ProtoMessage

func (*ReadResponse) ProtoMessage()

func (*ReadResponse) Reset

func (m *ReadResponse) Reset()

func (*ReadResponse) String

func (m *ReadResponse) String() string

func (*ReadResponse) XXX_DiscardUnknown

func (m *ReadResponse) XXX_DiscardUnknown()

func (*ReadResponse) XXX_Marshal

func (m *ReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReadResponse) XXX_Merge

func (m *ReadResponse) XXX_Merge(src proto.Message)

func (*ReadResponse) XXX_Size

func (m *ReadResponse) XXX_Size() int

func (*ReadResponse) XXX_Unmarshal

func (m *ReadResponse) XXX_Unmarshal(b []byte) error

type Todo

type Todo struct {
	// Unique interger identify Todo task.
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// Title of the task
	Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
	// Task description
	Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	// Check whether task is done yet.
	Done bool `protobuf:"varint,4,opt,name=done,proto3" json:"done,omitempty"`
	// Date and time to remind the task
	Reminder *timestamp.Timestamp `protobuf:"bytes,5,opt,name=reminder,proto3" json:"reminder,omitempty"`
	// Task created date and time
	CretedAt *timestamp.Timestamp `protobuf:"bytes,6,opt,name=creted_at,json=cretedAt,proto3" json:"creted_at,omitempty"`
	// Task updated date and time
	UpdatedAt            *timestamp.Timestamp `protobuf:"bytes,7,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

func (*Todo) Descriptor

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

func (*Todo) GetCretedAt

func (m *Todo) GetCretedAt() *timestamp.Timestamp

func (*Todo) GetDescription

func (m *Todo) GetDescription() string

func (*Todo) GetDone

func (m *Todo) GetDone() bool

func (*Todo) GetId

func (m *Todo) GetId() int64

func (*Todo) GetReminder

func (m *Todo) GetReminder() *timestamp.Timestamp

func (*Todo) GetTitle

func (m *Todo) GetTitle() string

func (*Todo) GetUpdatedAt

func (m *Todo) GetUpdatedAt() *timestamp.Timestamp

func (*Todo) ProtoMessage

func (*Todo) ProtoMessage()

func (*Todo) Reset

func (m *Todo) Reset()

func (*Todo) String

func (m *Todo) String() string

func (*Todo) XXX_DiscardUnknown

func (m *Todo) XXX_DiscardUnknown()

func (*Todo) XXX_Marshal

func (m *Todo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Todo) XXX_Merge

func (m *Todo) XXX_Merge(src proto.Message)

func (*Todo) XXX_Size

func (m *Todo) XXX_Size() int

func (*Todo) XXX_Unmarshal

func (m *Todo) XXX_Unmarshal(b []byte) error

type TodoServiceClient

type TodoServiceClient interface {
	// Create Todo
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	// Read Todo
	Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error)
	// Update Todo
	Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error)
	// Delete Todo
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
	// Read all Todo tasks
	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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewTodoServiceClient

func NewTodoServiceClient(cc *grpc.ClientConn) TodoServiceClient

type TodoServiceServer

type TodoServiceServer interface {
	// Create Todo
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	// Read Todo
	Read(context.Context, *ReadRequest) (*ReadResponse, error)
	// Update Todo
	Update(context.Context, *UpdateRequest) (*UpdateResponse, error)
	// Delete Todo
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
	// Read all Todo tasks
	ReadAll(context.Context, *ReadAllRequest) (*ReadAllResponse, error)
}

TodoServiceServer is the server API for TodoService service.

type UnimplementedTodoServiceServer

type UnimplementedTodoServiceServer struct {
}

UnimplementedTodoServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedTodoServiceServer) Create

func (*UnimplementedTodoServiceServer) Delete

func (*UnimplementedTodoServiceServer) Read

func (*UnimplementedTodoServiceServer) ReadAll

func (*UnimplementedTodoServiceServer) Update

type UpdateRequest

type UpdateRequest struct {
	// Api versioning
	Api string `protobuf:"bytes,1,opt,name=Api,proto3" json:"Api,omitempty"`
	// Task entity to update
	Todo                 *Todo    `protobuf:"bytes,2,opt,name=todo,proto3" json:"todo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*UpdateRequest) Descriptor

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

func (*UpdateRequest) GetApi

func (m *UpdateRequest) GetApi() string

func (*UpdateRequest) GetTodo

func (m *UpdateRequest) GetTodo() *Todo

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) Reset

func (m *UpdateRequest) Reset()

func (*UpdateRequest) String

func (m *UpdateRequest) String() string

func (*UpdateRequest) XXX_DiscardUnknown

func (m *UpdateRequest) XXX_DiscardUnknown()

func (*UpdateRequest) XXX_Marshal

func (m *UpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UpdateRequest) XXX_Merge

func (m *UpdateRequest) XXX_Merge(src proto.Message)

func (*UpdateRequest) XXX_Size

func (m *UpdateRequest) XXX_Size() int

func (*UpdateRequest) XXX_Unmarshal

func (m *UpdateRequest) XXX_Unmarshal(b []byte) error

type UpdateResponse

type UpdateResponse struct {
	// Api versioning
	Api string `protobuf:"bytes,1,opt,name=Api,proto3" json:"Api,omitempty"`
	// Return the number of entity updated
	Updated              int64    `protobuf:"varint,2,opt,name=updated,proto3" json:"updated,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*UpdateResponse) Descriptor

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

func (*UpdateResponse) GetApi

func (m *UpdateResponse) GetApi() string

func (*UpdateResponse) GetUpdated

func (m *UpdateResponse) GetUpdated() int64

func (*UpdateResponse) ProtoMessage

func (*UpdateResponse) ProtoMessage()

func (*UpdateResponse) Reset

func (m *UpdateResponse) Reset()

func (*UpdateResponse) String

func (m *UpdateResponse) String() string

func (*UpdateResponse) XXX_DiscardUnknown

func (m *UpdateResponse) XXX_DiscardUnknown()

func (*UpdateResponse) XXX_Marshal

func (m *UpdateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*UpdateResponse) XXX_Merge

func (m *UpdateResponse) XXX_Merge(src proto.Message)

func (*UpdateResponse) XXX_Size

func (m *UpdateResponse) XXX_Size() int

func (*UpdateResponse) XXX_Unmarshal

func (m *UpdateResponse) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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