__

package
v0.0.0-...-1651264 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package __ is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_example_api_proto protoreflect.FileDescriptor
View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "mapi_grpc_example.api.v1.UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AddUser",
			Handler:    _UserService_AddUser_Handler,
		},
		{
			MethodName: "GetUsers",
			Handler:    _UserService_GetUsers_Handler,
		},
		{
			MethodName: "DeleteUser",
			Handler:    _UserService_DeleteUser_Handler,
		},
		{
			MethodName: "CheckReservedName",
			Handler:    _UserService_CheckReservedName_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "example-api.proto",
}

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

Functions

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

RegisterUserServiceHandlerClient 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 RegisterUserServiceHandlerServer

func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserServiceServer) error

RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux". UnaryRPC :call UserServiceServer 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 RegisterUserServiceHandlerFromEndpoint instead.

func RegisterUserServiceServer

func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)

Types

type AddUserRequest

type AddUserRequest struct {
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	Email    string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

Add a new user to the database

func (*AddUserRequest) Descriptor deprecated

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

Deprecated: Use AddUserRequest.ProtoReflect.Descriptor instead.

func (*AddUserRequest) GetEmail

func (x *AddUserRequest) GetEmail() string

func (*AddUserRequest) GetUsername

func (x *AddUserRequest) GetUsername() string

func (*AddUserRequest) ProtoMessage

func (*AddUserRequest) ProtoMessage()

func (*AddUserRequest) ProtoReflect

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

func (*AddUserRequest) Reset

func (x *AddUserRequest) Reset()

func (*AddUserRequest) String

func (x *AddUserRequest) String() string

type CheckReservedNameRequest

type CheckReservedNameRequest struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

Check to see if a name is reserved

func (*CheckReservedNameRequest) Descriptor deprecated

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

Deprecated: Use CheckReservedNameRequest.ProtoReflect.Descriptor instead.

func (*CheckReservedNameRequest) GetName

func (x *CheckReservedNameRequest) GetName() string

func (*CheckReservedNameRequest) ProtoMessage

func (*CheckReservedNameRequest) ProtoMessage()

func (*CheckReservedNameRequest) ProtoReflect

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

func (*CheckReservedNameRequest) Reset

func (x *CheckReservedNameRequest) Reset()

func (*CheckReservedNameRequest) String

func (x *CheckReservedNameRequest) String() string

type CheckReservedNameResult

type CheckReservedNameResult struct {
	Reserved string `protobuf:"bytes,1,opt,name=reserved,proto3" json:"reserved,omitempty"`
	// contains filtered or unexported fields
}

Returns reserved names matching the query

func (*CheckReservedNameResult) Descriptor deprecated

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

Deprecated: Use CheckReservedNameResult.ProtoReflect.Descriptor instead.

func (*CheckReservedNameResult) GetReserved

func (x *CheckReservedNameResult) GetReserved() string

func (*CheckReservedNameResult) ProtoMessage

func (*CheckReservedNameResult) ProtoMessage()

func (*CheckReservedNameResult) ProtoReflect

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

func (*CheckReservedNameResult) Reset

func (x *CheckReservedNameResult) Reset()

func (*CheckReservedNameResult) String

func (x *CheckReservedNameResult) String() string

type DeleteUserRequest

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

Delete a user by ID

func (*DeleteUserRequest) Descriptor deprecated

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

Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead.

func (*DeleteUserRequest) GetId

func (x *DeleteUserRequest) GetId() int64

func (*DeleteUserRequest) ProtoMessage

func (*DeleteUserRequest) ProtoMessage()

func (*DeleteUserRequest) ProtoReflect

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

func (*DeleteUserRequest) Reset

func (x *DeleteUserRequest) Reset()

func (*DeleteUserRequest) String

func (x *DeleteUserRequest) String() string

type DeleteUserResult

type DeleteUserResult struct {

	// Number of deleted users
	Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
	// contains filtered or unexported fields
}

Result from a deleted user

func (*DeleteUserResult) Descriptor deprecated

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

Deprecated: Use DeleteUserResult.ProtoReflect.Descriptor instead.

func (*DeleteUserResult) GetCount

func (x *DeleteUserResult) GetCount() int64

func (*DeleteUserResult) ProtoMessage

func (*DeleteUserResult) ProtoMessage()

func (*DeleteUserResult) ProtoReflect

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

func (*DeleteUserResult) Reset

func (x *DeleteUserResult) Reset()

func (*DeleteUserResult) String

func (x *DeleteUserResult) String() string

type GetUsersRequest

type GetUsersRequest struct {
	Filter string `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`
	// contains filtered or unexported fields
}

Get a collection of users with the given filter

func (*GetUsersRequest) Descriptor deprecated

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

Deprecated: Use GetUsersRequest.ProtoReflect.Descriptor instead.

func (*GetUsersRequest) GetFilter

func (x *GetUsersRequest) GetFilter() string

func (*GetUsersRequest) ProtoMessage

func (*GetUsersRequest) ProtoMessage()

func (*GetUsersRequest) ProtoReflect

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

func (*GetUsersRequest) Reset

func (x *GetUsersRequest) Reset()

func (*GetUsersRequest) String

func (x *GetUsersRequest) String() string

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) AddUser

func (UnimplementedUserServiceServer) CheckReservedName

func (UnimplementedUserServiceServer) DeleteUser

func (UnimplementedUserServiceServer) GetUsers

type UnsafeUserServiceServer

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

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

type UserResult

type UserResult struct {
	Id       int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	Email    string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	Created  string `protobuf:"bytes,4,opt,name=created,proto3" json:"created,omitempty"`
	// contains filtered or unexported fields
}

A user record

func (*UserResult) Descriptor deprecated

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

Deprecated: Use UserResult.ProtoReflect.Descriptor instead.

func (*UserResult) GetCreated

func (x *UserResult) GetCreated() string

func (*UserResult) GetEmail

func (x *UserResult) GetEmail() string

func (*UserResult) GetId

func (x *UserResult) GetId() int64

func (*UserResult) GetUsername

func (x *UserResult) GetUsername() string

func (*UserResult) ProtoMessage

func (*UserResult) ProtoMessage()

func (*UserResult) ProtoReflect

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

func (*UserResult) Reset

func (x *UserResult) Reset()

func (*UserResult) String

func (x *UserResult) String() string

type UserServiceClient

type UserServiceClient interface {
	AddUser(ctx context.Context, in *AddUserRequest, opts ...grpc.CallOption) (*UserResult, error)
	GetUsers(ctx context.Context, in *GetUsersRequest, opts ...grpc.CallOption) (*UsersResult, error)
	DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResult, error)
	CheckReservedName(ctx context.Context, in *CheckReservedNameRequest, opts ...grpc.CallOption) (*CheckReservedNameResult, error)
}

UserServiceClient is the client API for UserService 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 UserServiceServer

type UserServiceServer interface {
	AddUser(context.Context, *AddUserRequest) (*UserResult, error)
	GetUsers(context.Context, *GetUsersRequest) (*UsersResult, error)
	DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResult, error)
	CheckReservedName(context.Context, *CheckReservedNameRequest) (*CheckReservedNameResult, error)
	// contains filtered or unexported methods
}

UserServiceServer is the server API for UserService service. All implementations must embed UnimplementedUserServiceServer for forward compatibility

type UsersResult

type UsersResult struct {
	Users []*UserResult `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"`
	// contains filtered or unexported fields
}

A collection of user records

func (*UsersResult) Descriptor deprecated

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

Deprecated: Use UsersResult.ProtoReflect.Descriptor instead.

func (*UsersResult) GetUsers

func (x *UsersResult) GetUsers() []*UserResult

func (*UsersResult) ProtoMessage

func (*UsersResult) ProtoMessage()

func (*UsersResult) ProtoReflect

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

func (*UsersResult) Reset

func (x *UsersResult) Reset()

func (*UsersResult) String

func (x *UsersResult) String() string

Jump to

Keyboard shortcuts

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