user

package
v1.21.4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserService_Signup_FullMethodName  = "/user.UserService/Signup"
	UserService_GetUser_FullMethodName = "/user.UserService/GetUser"
)

Variables

View Source
var (
	Gender_name = map[int32]string{
		0: "GenderPlaceholder",
		1: "GenderUnfilled",
		2: "GenderMale",
		3: "GenderFemale",
	}
	Gender_value = map[string]int32{
		"GenderPlaceholder": 0,
		"GenderUnfilled":    1,
		"GenderMale":        2,
		"GenderFemale":      3,
	}
)

Enum value maps for Gender.

View Source
var (
	Role_name = map[int32]string{
		0: "PlaceholderRole",
		1: "RoleNormal",
		2: "RoleAdmin",
		3: "RoleSuperAdmin",
	}
	Role_value = map[string]int32{
		"PlaceholderRole": 0,
		"RoleNormal":      1,
		"RoleAdmin":       2,
		"RoleSuperAdmin":  3,
	}
)

Enum value maps for Role.

View Source
var (
	UserStatus_name = map[int32]string{
		0: "UserStatusPlaceholder",
		1: "UserStatusInActive",
		2: "UserStatusActivated",
		3: "UserStatusFrozen",
		4: "UserStatusDeleted",
	}
	UserStatus_value = map[string]int32{
		"UserStatusPlaceholder": 0,
		"UserStatusInActive":    1,
		"UserStatusActivated":   2,
		"UserStatusFrozen":      3,
		"UserStatusDeleted":     4,
	}
)

Enum value maps for UserStatus.

View Source
var (
	UserErr_name = map[int32]string{
		0:    "UserErrPlaceholder",
		1000: "UserErrLogin",
		1001: "UserErrNoActive",
		1002: "UserErrNoAuthority",
		1003: "UserErrLoginTimeout",
		1004: "UserErrInvalidToken",
		1005: "UserErrNoLogin",
	}
	UserErr_value = map[string]int32{
		"UserErrPlaceholder":  0,
		"UserErrLogin":        1000,
		"UserErrNoActive":     1001,
		"UserErrNoAuthority":  1002,
		"UserErrLoginTimeout": 1003,
		"UserErrInvalidToken": 1004,
		"UserErrNoLogin":      1005,
	}
)

Enum value maps for UserErr.

View Source
var File_proto_user_proto protoreflect.FileDescriptor
View Source
var UserService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "user.UserService",
	HandlerType: (*UserServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Signup",
			Handler:    _UserService_Signup_Handler,
		},
		{
			MethodName: "GetUser",
			Handler:    _UserService_GetUser_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/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 RegisterUserServiceServer

func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer)

Types

type Gender

type Gender int32

用户性别

const (
	Gender_GenderPlaceholder Gender = 0
	Gender_GenderUnfilled    Gender = 1
	Gender_GenderMale        Gender = 2
	Gender_GenderFemale      Gender = 3
)

func (Gender) Descriptor

func (Gender) Descriptor() protoreflect.EnumDescriptor

func (Gender) Enum

func (x Gender) Enum() *Gender

func (Gender) EnumDescriptor deprecated

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

Deprecated: Use Gender.Descriptor instead.

func (Gender) Number

func (x Gender) Number() protoreflect.EnumNumber

func (Gender) String

func (x Gender) String() string

func (Gender) Type

func (Gender) Type() protoreflect.EnumType

type GetUserReq

type GetUserReq struct {
	Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primaryKey;"`
	// contains filtered or unexported fields
}

func (*GetUserReq) Descriptor deprecated

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

Deprecated: Use GetUserReq.ProtoReflect.Descriptor instead.

func (*GetUserReq) GetId

func (x *GetUserReq) GetId() uint64

func (*GetUserReq) ProtoMessage

func (*GetUserReq) ProtoMessage()

func (*GetUserReq) ProtoReflect

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

func (*GetUserReq) Reset

func (x *GetUserReq) Reset()

func (*GetUserReq) String

func (x *GetUserReq) String() string

func (*GetUserReq) Validate

func (x *GetUserReq) Validate() error

type Role

type Role int32

用户角色

const (
	Role_PlaceholderRole Role = 0
	Role_RoleNormal      Role = 1
	Role_RoleAdmin       Role = 2
	Role_RoleSuperAdmin  Role = 3
)

func (Role) Descriptor

func (Role) Descriptor() protoreflect.EnumDescriptor

func (Role) Enum

func (x Role) Enum() *Role

func (Role) EnumDescriptor deprecated

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

Deprecated: Use Role.Descriptor instead.

func (Role) Number

func (x Role) Number() protoreflect.EnumNumber

func (Role) String

func (x Role) String() string

func (Role) Type

func (Role) Type() protoreflect.EnumType

type SignupReq

type SignupReq struct {

	// 密码
	Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty" validate:"required,gte=6,lte=15" comment:"密码"`
	Name     string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" validate:"required,gte=3,lte=10" comment:"昵称"`
	Gender   Gender `protobuf:"varint,3,opt,name=gender,proto3,enum=user.Gender" json:"gender,omitempty" validate:"required" comment:"性别"`
	// 邮箱
	Mail string `protobuf:"bytes,6,opt,name=mail,proto3" json:"mail,omitempty" validate:"omitempty,email" comment:"邮箱"`
	// 手机号
	Phone string `protobuf:"bytes,7,opt,name=phone,proto3" json:"phone,omitempty" validate:"omitempty,phone" comment:"手机号"`
	// 验证码
	VCode string `protobuf:"bytes,8,opt,name=vCode,proto3" json:"vCode,omitempty" validate:"required" comment:"验证码"`
	// contains filtered or unexported fields
}

func (*SignupReq) Descriptor deprecated

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

Deprecated: Use SignupReq.ProtoReflect.Descriptor instead.

func (*SignupReq) GetGender

func (x *SignupReq) GetGender() Gender

func (*SignupReq) GetMail

func (x *SignupReq) GetMail() string

func (*SignupReq) GetName

func (x *SignupReq) GetName() string

func (*SignupReq) GetPassword

func (x *SignupReq) GetPassword() string

func (*SignupReq) GetPhone

func (x *SignupReq) GetPhone() string

func (*SignupReq) GetVCode

func (x *SignupReq) GetVCode() string

func (*SignupReq) ProtoMessage

func (*SignupReq) ProtoMessage()

func (*SignupReq) ProtoReflect

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

func (*SignupReq) Reset

func (x *SignupReq) Reset()

func (*SignupReq) String

func (x *SignupReq) String() string

func (*SignupReq) Validate

func (x *SignupReq) Validate() error

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedUserServiceServer) GetUser

func (UnimplementedUserServiceServer) Signup

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       uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty" gorm:"primaryKey;"`
	Name     string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty" gorm:"size:10;not null" comment:"昵称"`
	Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"-" gorm:"size:32;not null" validate:"gte=8,lte=15" comment:"密码"`
	Mail     string `protobuf:"bytes,6,opt,name=mail,proto3" json:"mail,omitempty" gorm:"size:32" validate:"email" comment:"邮箱"`
	Phone    string `protobuf:"bytes,7,opt,name=phone,proto3" json:"phone,omitempty" gorm:"size:32" validate:"phone" comment:"手机号"`
	// 性别,0未填写,1男,2女
	Gender Gender     `protobuf:"varint,8,opt,name=gender,proto3,enum=user.Gender" json:"gender,omitempty" gorm:"type:int2;default:0"`
	Role   Role       `protobuf:"varint,24,opt,name=role,proto3,enum=user.Role" json:"role,omitempty" gorm:"type:int2;default:0"`
	Status UserStatus `protobuf:"varint,28,opt,name=status,proto3,enum=user.UserStatus" json:"status,omitempty" gorm:"type:int2;default:0"`
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetGender

func (x *User) GetGender() Gender

func (*User) GetId

func (x *User) GetId() uint64

func (*User) GetMail

func (x *User) GetMail() string

func (*User) GetName

func (x *User) GetName() string

func (*User) GetPassword

func (x *User) GetPassword() string

func (*User) GetPhone

func (x *User) GetPhone() string

func (*User) GetRole

func (x *User) GetRole() Role

func (*User) GetStatus

func (x *User) GetStatus() UserStatus

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 (x *User) Validate() error

type UserErr

type UserErr int32
const (
	UserErr_UserErrPlaceholder  UserErr = 0
	UserErr_UserErrLogin        UserErr = 1000
	UserErr_UserErrNoActive     UserErr = 1001
	UserErr_UserErrNoAuthority  UserErr = 1002
	UserErr_UserErrLoginTimeout UserErr = 1003
	UserErr_UserErrInvalidToken UserErr = 1004
	UserErr_UserErrNoLogin      UserErr = 1005
)

func (UserErr) Descriptor

func (UserErr) Descriptor() protoreflect.EnumDescriptor

func (UserErr) Enum

func (x UserErr) Enum() *UserErr

func (UserErr) EnumDescriptor deprecated

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

Deprecated: Use UserErr.Descriptor instead.

func (UserErr) Number

func (x UserErr) Number() protoreflect.EnumNumber

func (UserErr) String

func (x UserErr) String() string

func (UserErr) Type

func (UserErr) Type() protoreflect.EnumType

type UserServiceClient

type UserServiceClient interface {
	// 注册
	Signup(ctx context.Context, in *SignupReq, opts ...grpc.CallOption) (*wrapperspb.StringValue, error)
	GetUser(ctx context.Context, in *GetUserReq, 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 {
	// 注册
	Signup(context.Context, *SignupReq) (*wrapperspb.StringValue, error)
	GetUser(context.Context, *GetUserReq) (*User, error)
	// contains filtered or unexported methods
}

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

type UserStatus

type UserStatus int32

用户角色

const (
	UserStatus_UserStatusPlaceholder UserStatus = 0
	UserStatus_UserStatusInActive    UserStatus = 1
	UserStatus_UserStatusActivated   UserStatus = 2
	UserStatus_UserStatusFrozen      UserStatus = 3
	UserStatus_UserStatusDeleted     UserStatus = 4
)

func (UserStatus) Descriptor

func (UserStatus) Descriptor() protoreflect.EnumDescriptor

func (UserStatus) Enum

func (x UserStatus) Enum() *UserStatus

func (UserStatus) EnumDescriptor deprecated

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

Deprecated: Use UserStatus.Descriptor instead.

func (UserStatus) Number

func (x UserStatus) Number() protoreflect.EnumNumber

func (UserStatus) String

func (x UserStatus) String() string

func (UserStatus) Type

Jump to

Keyboard shortcuts

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