gateway

package
v0.0.0-...-90a7d19 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package gateway is a generated protocol buffer package.

It is generated from these files:

alive.proto
user.proto

It has these top-level messages:

Empty
AliveResponse
GetUserRequest
UpdateUserRequest
UserResponse
UserGroupRequest
UsersResponse

Package gateway is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Package gateway is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var Group_name = map[int32]string{
	0: "USER",
	1: "ADMIN",
	2: "DEVELOPER",
}
View Source
var Group_value = map[string]int32{
	"USER":      0,
	"ADMIN":     1,
	"DEVELOPER": 2,
}

Functions

func RegisterAliveServiceHandler

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

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

func RegisterAliveServiceHandlerClient

func RegisterAliveServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AliveServiceClient) error

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

func RegisterAliveServiceHandlerFromEndpoint

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

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

func RegisterAliveServiceServer

func RegisterAliveServiceServer(s *grpc.Server, srv AliveServiceServer)

func RegisterUserServiceHandler

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

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

func RegisterUserServiceHandlerClient

func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserServiceClient) error

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

func RegisterUserServiceHandlerFromEndpoint

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

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

func RegisterUserServiceServer

func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer)

Types

type AliveResponse

type AliveResponse struct {
	Status bool `protobuf:"varint,1,opt,name=status" json:"status,omitempty"`
}

func (*AliveResponse) Descriptor

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

func (*AliveResponse) GetStatus

func (m *AliveResponse) GetStatus() bool

func (*AliveResponse) ProtoMessage

func (*AliveResponse) ProtoMessage()

func (*AliveResponse) Reset

func (m *AliveResponse) Reset()

func (*AliveResponse) String

func (m *AliveResponse) String() string

type AliveServiceClient

type AliveServiceClient interface {
	GetStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*AliveResponse, error)
}

func NewAliveServiceClient

func NewAliveServiceClient(cc *grpc.ClientConn) AliveServiceClient

type AliveServiceServer

type AliveServiceServer interface {
	GetStatus(context.Context, *Empty) (*AliveResponse, error)
}

type Empty

type Empty struct {
}

func (*Empty) Descriptor

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

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) Reset

func (m *Empty) Reset()

func (*Empty) String

func (m *Empty) String() string

type GetUserRequest

type GetUserRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
}

func (*GetUserRequest) Descriptor

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

func (*GetUserRequest) GetId

func (m *GetUserRequest) GetId() string

func (*GetUserRequest) ProtoMessage

func (*GetUserRequest) ProtoMessage()

func (*GetUserRequest) Reset

func (m *GetUserRequest) Reset()

func (*GetUserRequest) String

func (m *GetUserRequest) String() string

type Group

type Group int32
const (
	Group_USER      Group = 0
	Group_ADMIN     Group = 1
	Group_DEVELOPER Group = 2
)

func (Group) EnumDescriptor

func (Group) EnumDescriptor() ([]byte, []int)

func (Group) String

func (x Group) String() string

type UpdateUserRequest

type UpdateUserRequest struct {
	Id   string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
	Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
	Age  int32  `protobuf:"varint,3,opt,name=age" json:"age,omitempty"`
}

func (*UpdateUserRequest) Descriptor

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

func (*UpdateUserRequest) GetAge

func (m *UpdateUserRequest) GetAge() int32

func (*UpdateUserRequest) GetId

func (m *UpdateUserRequest) GetId() string

func (*UpdateUserRequest) GetName

func (m *UpdateUserRequest) GetName() string

func (*UpdateUserRequest) ProtoMessage

func (*UpdateUserRequest) ProtoMessage()

func (*UpdateUserRequest) Reset

func (m *UpdateUserRequest) Reset()

func (*UpdateUserRequest) String

func (m *UpdateUserRequest) String() string

type UserGroupRequest

type UserGroupRequest struct {
	Group Group `protobuf:"varint,1,opt,name=group,enum=gateway.Group" json:"group,omitempty"`
}

func (*UserGroupRequest) Descriptor

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

func (*UserGroupRequest) GetGroup

func (m *UserGroupRequest) GetGroup() Group

func (*UserGroupRequest) ProtoMessage

func (*UserGroupRequest) ProtoMessage()

func (*UserGroupRequest) Reset

func (m *UserGroupRequest) Reset()

func (*UserGroupRequest) String

func (m *UserGroupRequest) String() string

type UserResponse

type UserResponse struct {
	Id   string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
	Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
	Age  int32  `protobuf:"varint,3,opt,name=age" json:"age,omitempty"`
}

func (*UserResponse) Descriptor

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

func (*UserResponse) GetAge

func (m *UserResponse) GetAge() int32

func (*UserResponse) GetId

func (m *UserResponse) GetId() string

func (*UserResponse) GetName

func (m *UserResponse) GetName() string

func (*UserResponse) ProtoMessage

func (*UserResponse) ProtoMessage()

func (*UserResponse) Reset

func (m *UserResponse) Reset()

func (*UserResponse) String

func (m *UserResponse) String() string

type UserServiceClient

type UserServiceClient interface {
	GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*UserResponse, error)
	GetUsersByGroup(ctx context.Context, in *UserGroupRequest, opts ...grpc.CallOption) (*UsersResponse, error)
	UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*Empty, error)
}

func NewUserServiceClient

func NewUserServiceClient(cc *grpc.ClientConn) UserServiceClient

type UserServiceServer

type UserServiceServer interface {
	GetUser(context.Context, *GetUserRequest) (*UserResponse, error)
	GetUsersByGroup(context.Context, *UserGroupRequest) (*UsersResponse, error)
	UpdateUser(context.Context, *UpdateUserRequest) (*Empty, error)
}

type UsersResponse

type UsersResponse struct {
	Group Group           `protobuf:"varint,1,opt,name=group,enum=gateway.Group" json:"group,omitempty"`
	Users []*UserResponse `protobuf:"bytes,2,rep,name=users" json:"users,omitempty"`
}

func (*UsersResponse) Descriptor

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

func (*UsersResponse) GetGroup

func (m *UsersResponse) GetGroup() Group

func (*UsersResponse) GetUsers

func (m *UsersResponse) GetUsers() []*UserResponse

func (*UsersResponse) ProtoMessage

func (*UsersResponse) ProtoMessage()

func (*UsersResponse) Reset

func (m *UsersResponse) Reset()

func (*UsersResponse) String

func (m *UsersResponse) String() string

Jump to

Keyboard shortcuts

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