user

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package user is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	User_Status_name = map[int32]string{
		0: "PENDING",
		1: "BUILDING",
		2: "PUBLISHED",
		3: "EXPIRED",
		4: "FAILED",
	}
	User_Status_value = map[string]int32{
		"PENDING":   0,
		"BUILDING":  1,
		"PUBLISHED": 2,
		"EXPIRED":   3,
		"FAILED":    4,
	}
)

Enum value maps for User_Status.

View Source
var File_user_user_proto protoreflect.FileDescriptor
View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "user.UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "List",
			Handler:    _UserService_List_Handler,
		},
		{
			MethodName: "Info",
			Handler:    _UserService_Info_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "user/user.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 UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) Info added in v0.0.3

func (UnimplementedUserServiceServer) List

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 User

type User struct {
	Id        string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" bson:"_id,omitempty"` // @gotags: bson:"_id,omitempty"
	Email     string                 `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
	OuterId   string                 `protobuf:"bytes,3,opt,name=outer_id,json=outerId,proto3" json:"outer_id,omitempty" bson:"outer_id,omitempty"` // @gotags: bson:"outer_id,omitempty"
	Nickname  string                 `protobuf:"bytes,4,opt,name=nickname,proto3" json:"nickname,omitempty"`
	Avatar    string                 `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"`
	Roles     []string               `protobuf:"bytes,6,rep,name=roles,proto3" json:"roles,omitempty"`
	Extra     map[string]*anypb.Any  `` /* 151-byte string literal not displayed */
	Provider  string                 `protobuf:"bytes,9,opt,name=provider,proto3" json:"provider,omitempty"`
	Status    User_Status            `protobuf:"varint,10,opt,name=status,proto3,enum=user.User_Status" json:"status,omitempty"`
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,101,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty" bson:"created_at,omitempty"` // @gotags: bson:"created_at,omitempty"
	UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,103,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty" bson:"updated_at,omitempty"` // @gotags: bson:"updated_at,omitempty"
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetAvatar

func (x *User) GetAvatar() string

func (*User) GetCreatedAt

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

func (*User) GetEmail

func (x *User) GetEmail() string

func (*User) GetExtra

func (x *User) GetExtra() map[string]*anypb.Any

func (*User) GetId

func (x *User) GetId() string

func (*User) GetNickname

func (x *User) GetNickname() string

func (*User) GetOuterId

func (x *User) GetOuterId() string

func (*User) GetProvider

func (x *User) GetProvider() string

func (*User) GetRoles

func (x *User) GetRoles() []string

func (*User) GetStatus

func (x *User) GetStatus() User_Status

func (*User) GetUpdatedAt

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

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

func (*User) Validate

func (m *User) Validate() error

Validate checks the field values on User 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 (*User) ValidateAll

func (m *User) ValidateAll() error

ValidateAll checks the field values on User 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 UserMultiError, or nil if none found.

type UserListRequest

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

func (*UserListRequest) Descriptor deprecated

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

Deprecated: Use UserListRequest.ProtoReflect.Descriptor instead.

func (*UserListRequest) GetUsername

func (x *UserListRequest) GetUsername() string

func (*UserListRequest) ProtoMessage

func (*UserListRequest) ProtoMessage()

func (*UserListRequest) ProtoReflect

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

func (*UserListRequest) Reset

func (x *UserListRequest) Reset()

func (*UserListRequest) String

func (x *UserListRequest) String() string

func (*UserListRequest) Validate

func (m *UserListRequest) Validate() error

Validate checks the field values on UserListRequest 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 (*UserListRequest) ValidateAll

func (m *UserListRequest) ValidateAll() error

ValidateAll checks the field values on UserListRequest 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 UserListRequestMultiError, or nil if none found.

type UserListRequestMultiError

type UserListRequestMultiError []error

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

func (UserListRequestMultiError) AllErrors

func (m UserListRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (UserListRequestMultiError) Error

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

type UserListRequestValidationError

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

UserListRequestValidationError is the validation error returned by UserListRequest.Validate if the designated constraints aren't met.

func (UserListRequestValidationError) Cause

Cause function returns cause value.

func (UserListRequestValidationError) Error

Error satisfies the builtin error interface

func (UserListRequestValidationError) ErrorName

func (e UserListRequestValidationError) ErrorName() string

ErrorName returns error name.

func (UserListRequestValidationError) Field

Field function returns field value.

func (UserListRequestValidationError) Key

Key function returns key value.

func (UserListRequestValidationError) Reason

Reason function returns reason value.

type UserListResponse

type UserListResponse struct {
	Items []*User `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	Total int64   `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
	// contains filtered or unexported fields
}

func (*UserListResponse) Descriptor deprecated

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

Deprecated: Use UserListResponse.ProtoReflect.Descriptor instead.

func (*UserListResponse) GetItems

func (x *UserListResponse) GetItems() []*User

func (*UserListResponse) GetTotal

func (x *UserListResponse) GetTotal() int64

func (*UserListResponse) ProtoMessage

func (*UserListResponse) ProtoMessage()

func (*UserListResponse) ProtoReflect

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

func (*UserListResponse) Reset

func (x *UserListResponse) Reset()

func (*UserListResponse) String

func (x *UserListResponse) String() string

func (*UserListResponse) Validate

func (m *UserListResponse) Validate() error

Validate checks the field values on UserListResponse 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 (*UserListResponse) ValidateAll

func (m *UserListResponse) ValidateAll() error

ValidateAll checks the field values on UserListResponse 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 UserListResponseMultiError, or nil if none found.

type UserListResponseMultiError

type UserListResponseMultiError []error

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

func (UserListResponseMultiError) AllErrors

func (m UserListResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (UserListResponseMultiError) Error

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

type UserListResponseValidationError

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

UserListResponseValidationError is the validation error returned by UserListResponse.Validate if the designated constraints aren't met.

func (UserListResponseValidationError) Cause

Cause function returns cause value.

func (UserListResponseValidationError) Error

Error satisfies the builtin error interface

func (UserListResponseValidationError) ErrorName

ErrorName returns error name.

func (UserListResponseValidationError) Field

Field function returns field value.

func (UserListResponseValidationError) Key

Key function returns key value.

func (UserListResponseValidationError) Reason

Reason function returns reason value.

type UserMultiError

type UserMultiError []error

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

func (UserMultiError) AllErrors

func (m UserMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (UserMultiError) Error

func (m UserMultiError) Error() string

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

type UserServiceClient

type UserServiceClient interface {
	List(ctx context.Context, in *UserListRequest, opts ...grpc.CallOption) (*UserListResponse, error)
	Info(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*User, 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 {
	List(context.Context, *UserListRequest) (*UserListResponse, error)
	Info(context.Context, *emptypb.Empty) (*User, error)
}

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

type UserValidationError

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

UserValidationError is the validation error returned by User.Validate if the designated constraints aren't met.

func (UserValidationError) Cause

func (e UserValidationError) Cause() error

Cause function returns cause value.

func (UserValidationError) Error

func (e UserValidationError) Error() string

Error satisfies the builtin error interface

func (UserValidationError) ErrorName

func (e UserValidationError) ErrorName() string

ErrorName returns error name.

func (UserValidationError) Field

func (e UserValidationError) Field() string

Field function returns field value.

func (UserValidationError) Key

func (e UserValidationError) Key() bool

Key function returns key value.

func (UserValidationError) Reason

func (e UserValidationError) Reason() string

Reason function returns reason value.

type User_Status

type User_Status int32
const (
	User_PENDING   User_Status = 0
	User_BUILDING  User_Status = 1
	User_PUBLISHED User_Status = 2
	User_EXPIRED   User_Status = 3
	User_FAILED    User_Status = 4
)

func (User_Status) Descriptor

func (User_Status) Enum

func (x User_Status) Enum() *User_Status

func (User_Status) EnumDescriptor deprecated

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

Deprecated: Use User_Status.Descriptor instead.

func (User_Status) Number

func (x User_Status) Number() protoreflect.EnumNumber

func (User_Status) String

func (x User_Status) String() string

func (User_Status) Type

Jump to

Keyboard shortcuts

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