v1

package
v0.0.0-...-31da580 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: MIT Imports: 33 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 (
	RoleType_name = map[int32]string{
		0:  "UNDEFINED",
		1:  "Normal_USER",
		8:  "VIP_USER",
		9:  "ADMIN_USER",
		64: "SUPPER_USER",
	}
	RoleType_value = map[string]int32{
		"UNDEFINED":   0,
		"Normal_USER": 1,
		"VIP_USER":    8,
		"ADMIN_USER":  9,
		"SUPPER_USER": 64,
	}
)

Enum value maps for RoleType.

View Source
var (
	ErrorReason_name = map[int32]string{
		0: "INTERNAL_ERROR",
		1: "USER_NOT_FOUND",
	}
	ErrorReason_value = map[string]int32{
		"INTERNAL_ERROR": 0,
		"USER_NOT_FOUND": 1,
	}
)

Enum value maps for ErrorReason.

View Source
var Account_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "api.account.service.v1.Account",
	HandlerType: (*AccountServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetUserInfo",
			Handler:    _Account_GetUserInfo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "v1/account.proto",
}

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

View Source
var File_v1_account_proto protoreflect.FileDescriptor
View Source
var File_v1_error_reason_proto protoreflect.FileDescriptor

Functions

func RegisterAccountHTTPServer

func RegisterAccountHTTPServer(s *http.Server, srv AccountHTTPServer)

func RegisterAccountHandler

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

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

func RegisterAccountHandlerClient

func RegisterAccountHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountClient) error

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

func RegisterAccountHandlerFromEndpoint

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

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

func RegisterAccountHandlerServer

func RegisterAccountHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServer) error

RegisterAccountHandlerServer registers the http handlers for service Account to "mux". UnaryRPC :call AccountServer 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 RegisterAccountHandlerFromEndpoint instead.

func RegisterAccountServer

func RegisterAccountServer(s grpc.ServiceRegistrar, srv AccountServer)

Types

type AccountClient

type AccountClient interface {
	GetUserInfo(ctx context.Context, in *GetUserInfoParams, opts ...grpc.CallOption) (*GetUserInfoReply, error)
}

AccountClient is the client API for Account 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 NewAccountClient

func NewAccountClient(cc grpc.ClientConnInterface) AccountClient

type AccountHTTPClient

type AccountHTTPClient interface {
	GetUserInfo(ctx context.Context, req *GetUserInfoParams, opts ...http.CallOption) (rsp *GetUserInfoReply, err error)
}

func NewAccountHTTPClient

func NewAccountHTTPClient(client *http.Client) AccountHTTPClient

type AccountHTTPClientImpl

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

func (*AccountHTTPClientImpl) GetUserInfo

type AccountHTTPServer

type AccountHTTPServer interface {
	GetUserInfo(context.Context, *GetUserInfoParams) (*GetUserInfoReply, error)
}

type AccountServer

type AccountServer interface {
	GetUserInfo(context.Context, *GetUserInfoParams) (*GetUserInfoReply, error)
	// contains filtered or unexported methods
}

AccountServer is the server API for Account service. All implementations must embed UnimplementedAccountServer for forward compatibility

type ErrorReason

type ErrorReason int32
const (
	ErrorReason_INTERNAL_ERROR ErrorReason = 0
	ErrorReason_USER_NOT_FOUND ErrorReason = 1
)

func (ErrorReason) Descriptor

func (ErrorReason) Enum

func (x ErrorReason) Enum() *ErrorReason

func (ErrorReason) EnumDescriptor deprecated

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

Deprecated: Use ErrorReason.Descriptor instead.

func (ErrorReason) Number

func (x ErrorReason) Number() protoreflect.EnumNumber

func (ErrorReason) String

func (x ErrorReason) String() string

func (ErrorReason) Type

type GetUserInfoParams

type GetUserInfoParams struct {

	// 用户ID
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetUserInfoParams) Descriptor deprecated

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

Deprecated: Use GetUserInfoParams.ProtoReflect.Descriptor instead.

func (*GetUserInfoParams) GetId

func (x *GetUserInfoParams) GetId() string

func (*GetUserInfoParams) ProtoMessage

func (*GetUserInfoParams) ProtoMessage()

func (*GetUserInfoParams) ProtoReflect

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

func (*GetUserInfoParams) Reset

func (x *GetUserInfoParams) Reset()

func (*GetUserInfoParams) String

func (x *GetUserInfoParams) String() string

func (*GetUserInfoParams) Validate

func (m *GetUserInfoParams) Validate() error

Validate checks the field values on GetUserInfoParams with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*GetUserInfoParams) ValidateAll

func (m *GetUserInfoParams) ValidateAll() error

ValidateAll checks the field values on GetUserInfoParams with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetUserInfoParamsMultiError, or nil if none found.

type GetUserInfoParamsMultiError

type GetUserInfoParamsMultiError []error

GetUserInfoParamsMultiError is an error wrapping multiple validation errors returned by GetUserInfoParams.ValidateAll() if the designated constraints aren't met.

func (GetUserInfoParamsMultiError) AllErrors

func (m GetUserInfoParamsMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetUserInfoParamsMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type GetUserInfoParamsValidationError

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

GetUserInfoParamsValidationError is the validation error returned by GetUserInfoParams.Validate if the designated constraints aren't met.

func (GetUserInfoParamsValidationError) Cause

Cause function returns cause value.

func (GetUserInfoParamsValidationError) Error

Error satisfies the builtin error interface

func (GetUserInfoParamsValidationError) ErrorName

ErrorName returns error name.

func (GetUserInfoParamsValidationError) Field

Field function returns field value.

func (GetUserInfoParamsValidationError) Key

Key function returns key value.

func (GetUserInfoParamsValidationError) Reason

Reason function returns reason value.

type GetUserInfoReply

type GetUserInfoReply struct {

	// 用户ID
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// 用户名
	Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	// 用户角色类型
	RoleType RoleType `protobuf:"varint,3,opt,name=role_type,json=roleType,proto3,enum=api.account.service.v1.RoleType" json:"role_type,omitempty"`
	// 截止时间
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// 开始时间
	UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

func (*GetUserInfoReply) Descriptor deprecated

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

Deprecated: Use GetUserInfoReply.ProtoReflect.Descriptor instead.

func (*GetUserInfoReply) GetCreatedAt

func (x *GetUserInfoReply) GetCreatedAt() *timestamppb.Timestamp

func (*GetUserInfoReply) GetId

func (x *GetUserInfoReply) GetId() string

func (*GetUserInfoReply) GetRoleType

func (x *GetUserInfoReply) GetRoleType() RoleType

func (*GetUserInfoReply) GetUpdatedAt

func (x *GetUserInfoReply) GetUpdatedAt() *timestamppb.Timestamp

func (*GetUserInfoReply) GetUsername

func (x *GetUserInfoReply) GetUsername() string

func (*GetUserInfoReply) ProtoMessage

func (*GetUserInfoReply) ProtoMessage()

func (*GetUserInfoReply) ProtoReflect

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

func (*GetUserInfoReply) Reset

func (x *GetUserInfoReply) Reset()

func (*GetUserInfoReply) String

func (x *GetUserInfoReply) String() string

func (*GetUserInfoReply) Validate

func (m *GetUserInfoReply) Validate() error

Validate checks the field values on GetUserInfoReply with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*GetUserInfoReply) ValidateAll

func (m *GetUserInfoReply) ValidateAll() error

ValidateAll checks the field values on GetUserInfoReply with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in GetUserInfoReplyMultiError, or nil if none found.

type GetUserInfoReplyMultiError

type GetUserInfoReplyMultiError []error

GetUserInfoReplyMultiError is an error wrapping multiple validation errors returned by GetUserInfoReply.ValidateAll() if the designated constraints aren't met.

func (GetUserInfoReplyMultiError) AllErrors

func (m GetUserInfoReplyMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (GetUserInfoReplyMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type GetUserInfoReplyValidationError

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

GetUserInfoReplyValidationError is the validation error returned by GetUserInfoReply.Validate if the designated constraints aren't met.

func (GetUserInfoReplyValidationError) Cause

Cause function returns cause value.

func (GetUserInfoReplyValidationError) Error

Error satisfies the builtin error interface

func (GetUserInfoReplyValidationError) ErrorName

ErrorName returns error name.

func (GetUserInfoReplyValidationError) Field

Field function returns field value.

func (GetUserInfoReplyValidationError) Key

Key function returns key value.

func (GetUserInfoReplyValidationError) Reason

Reason function returns reason value.

type RoleType

type RoleType int32
const (
	// 未定义用户类型
	RoleType_UNDEFINED RoleType = 0
	// 普通用户
	RoleType_Normal_USER RoleType = 1
	// VIP 用户
	RoleType_VIP_USER RoleType = 8
	// 应用管理员
	RoleType_ADMIN_USER RoleType = 9
	// 超级管理员
	RoleType_SUPPER_USER RoleType = 64
)

func (RoleType) Descriptor

func (RoleType) Descriptor() protoreflect.EnumDescriptor

func (RoleType) Enum

func (x RoleType) Enum() *RoleType

func (RoleType) EnumDescriptor deprecated

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

Deprecated: Use RoleType.Descriptor instead.

func (RoleType) Number

func (x RoleType) Number() protoreflect.EnumNumber

func (RoleType) String

func (x RoleType) String() string

func (RoleType) Type

type UnimplementedAccountServer

type UnimplementedAccountServer struct {
}

UnimplementedAccountServer must be embedded to have forward compatible implementations.

func (UnimplementedAccountServer) GetUserInfo

type UnsafeAccountServer

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

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

Jump to

Keyboard shortcuts

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