user

package
v0.0.0-...-c6aefec Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Enum value maps for ErrorReason.

View Source
var File_api_user_error_reason_proto protoreflect.FileDescriptor
View Source
var File_api_user_user_proto protoreflect.FileDescriptor
View Source
var User_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "api.user.User",
	HandlerType: (*UserServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "InfoByUsername",
			Handler:    _User_InfoByUsername_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/user/user.proto",
}

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

Functions

func ErrorContentMissing

func ErrorContentMissing(format string, args ...interface{}) *errors.Error

func ErrorUserHasExist

func ErrorUserHasExist(format string, args ...interface{}) *errors.Error

func ErrorUserNotFound

func ErrorUserNotFound(format string, args ...interface{}) *errors.Error

func IsContentMissing

func IsContentMissing(err error) bool

func IsUserHasExist

func IsUserHasExist(err error) bool

func IsUserNotFound

func IsUserNotFound(err error) bool

func RegisterUserServer

func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer)

Types

type ErrorReason

type ErrorReason int32
const (
	ErrorReason_USER_NOT_FOUND  ErrorReason = 0
	ErrorReason_CONTENT_MISSING ErrorReason = 1
	ErrorReason_User_HAS_EXIST  ErrorReason = 2
)

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 Menu struct {
	MenuId     int64  `protobuf:"varint,1,opt,name=menu_id,json=menuId,proto3" json:"menu_id,omitempty"`
	Permission string `protobuf:"bytes,2,opt,name=permission,proto3" json:"permission,omitempty"`
	Name       string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	Path       string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"`
	Type       string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"`
	Icon       string `protobuf:"bytes,6,opt,name=icon,proto3" json:"icon,omitempty"`
	Child      *Menu  `protobuf:"bytes,7,opt,name=child,proto3" json:"child,omitempty"`
	// contains filtered or unexported fields
}
func (*Menu) Descriptor() ([]byte, []int)

Deprecated: Use Menu.ProtoReflect.Descriptor instead.

func (x *Menu) GetChild() *Menu
func (x *Menu) GetIcon() string
func (x *Menu) GetMenuId() int64
func (x *Menu) GetName() string
func (x *Menu) GetPath() string
func (x *Menu) GetPermission() string
func (x *Menu) GetType() string
func (*Menu) ProtoMessage()
func (x *Menu) ProtoReflect() protoreflect.Message
func (x *Menu) Reset()
func (x *Menu) String() string
func (m *Menu) Validate() error

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

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

type MenuMultiError []error

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

func (m MenuMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (m MenuMultiError) Error() string

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

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

MenuValidationError is the validation error returned by Menu.Validate if the designated constraints aren't met.

func (e MenuValidationError) Cause() error

Cause function returns cause value.

func (e MenuValidationError) Error() string

Error satisfies the builtin error interface

func (e MenuValidationError) ErrorName() string

ErrorName returns error name.

func (e MenuValidationError) Field() string

Field function returns field value.

func (e MenuValidationError) Key() bool

Key function returns key value.

func (e MenuValidationError) Reason() string

Reason function returns reason value.

type Role

type Role struct {
	RoleId int64  `protobuf:"varint,1,opt,name=role_id,json=roleId,proto3" json:"role_id,omitempty"`
	Key    string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	Name   string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*Role) Descriptor deprecated

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

Deprecated: Use Role.ProtoReflect.Descriptor instead.

func (*Role) GetKey

func (x *Role) GetKey() string

func (*Role) GetName

func (x *Role) GetName() string

func (*Role) GetRoleId

func (x *Role) GetRoleId() int64

func (*Role) ProtoMessage

func (*Role) ProtoMessage()

func (*Role) ProtoReflect

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

func (*Role) Reset

func (x *Role) Reset()

func (*Role) String

func (x *Role) String() string

func (*Role) Validate

func (m *Role) Validate() error

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

func (m *Role) ValidateAll() error

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

type RoleMultiError

type RoleMultiError []error

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

func (RoleMultiError) AllErrors

func (m RoleMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (RoleMultiError) Error

func (m RoleMultiError) Error() string

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

type RoleValidationError

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

RoleValidationError is the validation error returned by Role.Validate if the designated constraints aren't met.

func (RoleValidationError) Cause

func (e RoleValidationError) Cause() error

Cause function returns cause value.

func (RoleValidationError) Error

func (e RoleValidationError) Error() string

Error satisfies the builtin error interface

func (RoleValidationError) ErrorName

func (e RoleValidationError) ErrorName() string

ErrorName returns error name.

func (RoleValidationError) Field

func (e RoleValidationError) Field() string

Field function returns field value.

func (RoleValidationError) Key

func (e RoleValidationError) Key() bool

Key function returns key value.

func (RoleValidationError) Reason

func (e RoleValidationError) Reason() string

Reason function returns reason value.

type UnimplementedUserServer

type UnimplementedUserServer struct {
}

UnimplementedUserServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServer) InfoByUsername

type UnsafeUserServer

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

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

type UserClient

type UserClient interface {
	InfoByUsername(ctx context.Context, in *UsernameRequest, opts ...grpc.CallOption) (*UserInfo, error)
}

UserClient is the client API for User 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 NewUserClient

func NewUserClient(cc grpc.ClientConnInterface) UserClient

type UserInfo

type UserInfo struct {
	UserId   int64   `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	Username string  `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	Password string  `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
	Phone    string  `protobuf:"bytes,4,opt,name=phone,proto3" json:"phone,omitempty"`
	Roles    []*Role `protobuf:"bytes,5,rep,name=roles,proto3" json:"roles,omitempty"`
	Menus    []*Menu `protobuf:"bytes,6,rep,name=menus,proto3" json:"menus,omitempty"`
	// contains filtered or unexported fields
}

func (*UserInfo) Descriptor deprecated

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

Deprecated: Use UserInfo.ProtoReflect.Descriptor instead.

func (*UserInfo) GetMenus

func (x *UserInfo) GetMenus() []*Menu

func (*UserInfo) GetPassword

func (x *UserInfo) GetPassword() string

func (*UserInfo) GetPhone

func (x *UserInfo) GetPhone() string

func (*UserInfo) GetRoles

func (x *UserInfo) GetRoles() []*Role

func (*UserInfo) GetUserId

func (x *UserInfo) GetUserId() int64

func (*UserInfo) GetUsername

func (x *UserInfo) GetUsername() string

func (*UserInfo) ProtoMessage

func (*UserInfo) ProtoMessage()

func (*UserInfo) ProtoReflect

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

func (*UserInfo) Reset

func (x *UserInfo) Reset()

func (*UserInfo) String

func (x *UserInfo) String() string

func (*UserInfo) Validate

func (m *UserInfo) Validate() error

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

func (m *UserInfo) ValidateAll() error

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

type UserInfoMultiError

type UserInfoMultiError []error

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

func (UserInfoMultiError) AllErrors

func (m UserInfoMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (UserInfoMultiError) Error

func (m UserInfoMultiError) Error() string

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

type UserInfoValidationError

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

UserInfoValidationError is the validation error returned by UserInfo.Validate if the designated constraints aren't met.

func (UserInfoValidationError) Cause

func (e UserInfoValidationError) Cause() error

Cause function returns cause value.

func (UserInfoValidationError) Error

func (e UserInfoValidationError) Error() string

Error satisfies the builtin error interface

func (UserInfoValidationError) ErrorName

func (e UserInfoValidationError) ErrorName() string

ErrorName returns error name.

func (UserInfoValidationError) Field

func (e UserInfoValidationError) Field() string

Field function returns field value.

func (UserInfoValidationError) Key

func (e UserInfoValidationError) Key() bool

Key function returns key value.

func (UserInfoValidationError) Reason

func (e UserInfoValidationError) Reason() string

Reason function returns reason value.

type UserServer

type UserServer interface {
	InfoByUsername(context.Context, *UsernameRequest) (*UserInfo, error)
	// contains filtered or unexported methods
}

UserServer is the server API for User service. All implementations must embed UnimplementedUserServer for forward compatibility

type UsernameRequest

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

func (*UsernameRequest) Descriptor deprecated

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

Deprecated: Use UsernameRequest.ProtoReflect.Descriptor instead.

func (*UsernameRequest) GetReq

func (x *UsernameRequest) GetReq() *UsernameRequest

func (*UsernameRequest) GetUsername

func (x *UsernameRequest) GetUsername() string

func (*UsernameRequest) ProtoMessage

func (*UsernameRequest) ProtoMessage()

func (*UsernameRequest) ProtoReflect

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

func (*UsernameRequest) Reset

func (x *UsernameRequest) Reset()

func (*UsernameRequest) String

func (x *UsernameRequest) String() string

func (*UsernameRequest) Validate

func (m *UsernameRequest) Validate() error

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

func (m *UsernameRequest) ValidateAll() error

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

type UsernameRequestMultiError

type UsernameRequestMultiError []error

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

func (UsernameRequestMultiError) AllErrors

func (m UsernameRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (UsernameRequestMultiError) Error

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

type UsernameRequestValidationError

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

UsernameRequestValidationError is the validation error returned by UsernameRequest.Validate if the designated constraints aren't met.

func (UsernameRequestValidationError) Cause

Cause function returns cause value.

func (UsernameRequestValidationError) Error

Error satisfies the builtin error interface

func (UsernameRequestValidationError) ErrorName

func (e UsernameRequestValidationError) ErrorName() string

ErrorName returns error name.

func (UsernameRequestValidationError) Field

Field function returns field value.

func (UsernameRequestValidationError) Key

Key function returns key value.

func (UsernameRequestValidationError) Reason

Reason function returns reason value.

Jump to

Keyboard shortcuts

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