gen

package
v0.0.0-...-87e39d3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: Apache-2.0 Imports: 18 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 CreateUser_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "models.CreateUser",
	HandlerType: (*CreateUserServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Echo",
			Handler:    _CreateUser_Echo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "user.proto",
}

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

Functions

func RegisterCreateUserHandler

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

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

func RegisterCreateUserHandlerClient

func RegisterCreateUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CreateUserClient) error

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

func RegisterCreateUserHandlerFromEndpoint

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

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

func RegisterCreateUserHandlerServer

func RegisterCreateUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CreateUserServer) error

RegisterCreateUserHandlerServer registers the http handlers for service CreateUser to "mux". UnaryRPC :call CreateUserServer 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 RegisterCreateUserHandlerFromEndpoint instead.

func RegisterCreateUserServer

func RegisterCreateUserServer(s grpc.ServiceRegistrar, srv CreateUserServer)

Types

type CreateUserClient

type CreateUserClient interface {
	Echo(ctx context.Context, in *User, opts ...grpc.CallOption) (*User, error)
}

CreateUserClient is the client API for CreateUser 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 NewCreateUserClient

func NewCreateUserClient(cc grpc.ClientConnInterface) CreateUserClient

type CreateUserServer

type CreateUserServer interface {
	Echo(context.Context, *User) (*User, error)
	// contains filtered or unexported methods
}

CreateUserServer is the server API for CreateUser service. All implementations must embed UnimplementedCreateUserServer for forward compatibility

type UnimplementedCreateUserServer

type UnimplementedCreateUserServer struct {
}

UnimplementedCreateUserServer must be embedded to have forward compatible implementations.

func (UnimplementedCreateUserServer) Echo

type UnsafeCreateUserServer

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

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

type User

type User struct {
	Name        string                 `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Id          int32                  `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` // Unique ID number for this person.
	Email       string                 `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	Created     *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created,proto3" json:"created,omitempty"`
	LastUpdated *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"`
	Deleted     bool                   `protobuf:"varint,6,opt,name=deleted,proto3" json:"deleted,omitempty"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetCreated

func (x *User) GetCreated() *timestamppb.Timestamp

func (*User) GetDeleted

func (x *User) GetDeleted() bool

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetId

func (x *User) GetId() int32

func (*User) GetLastUpdated

func (x *User) GetLastUpdated() *timestamppb.Timestamp

func (*User) GetName

func (x *User) GetName() string

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (*User) ProtoReflect

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

func (*User) Reset

func (x *User) Reset()

func (*User) String

func (x *User) String() string

Jump to

Keyboard shortcuts

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