user

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package user is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

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

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 File_user_user_enum_proto protoreflect.FileDescriptor
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: "Signup",
			Handler:    _UserService_Signup_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 MarshalGender

func MarshalGender(x Gender) graphql.Marshaler

func MarshalRole

func MarshalRole(x Role) graphql.Marshaler

func MarshalUserStatus

func MarshalUserStatus(x UserStatus) graphql.Marshaler

func RegisterUserServiceHandler

func RegisterUserServiceHandler(ctx context.Context, mux *gin.Engine, 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 *gin.Engine, 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 *gin.Engine, 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(mux *gin.Engine, 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 Gender

type Gender int32

用户性别

const (
	GenderPlaceholder Gender = 0
	GenderUnfilled    Gender = 1
	GenderMale        Gender = 2
	GenderFemale      Gender = 3
)

func UnmarshalGender

func UnmarshalGender(v interface{}) (Gender, error)

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) MarshalGQL

func (x Gender) MarshalGQL(w io.Writer)

func (Gender) Number

func (x Gender) Number() protoreflect.EnumNumber

func (Gender) OrigString

func (x Gender) OrigString() string

func (Gender) String

func (x Gender) String() string

func (Gender) Type

func (Gender) Type() protoreflect.EnumType

func (*Gender) UnmarshalGQL

func (x *Gender) UnmarshalGQL(v interface{}) error

type Role

type Role int32

用户角色

const (
	PlaceholderRole Role = 0
	RoleNormal      Role = 1
	RoleAdmin       Role = 2
	RoleSuperAdmin  Role = 3
)

func UnmarshalRole

func UnmarshalRole(v interface{}) (Role, error)

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) MarshalGQL

func (x Role) MarshalGQL(w io.Writer)

func (Role) Number

func (x Role) Number() protoreflect.EnumNumber

func (Role) OrigString

func (x Role) OrigString() string

func (Role) String

func (x Role) String() string

func (Role) Type

func (Role) Type() protoreflect.EnumType

func (*Role) UnmarshalGQL

func (x *Role) UnmarshalGQL(v interface{}) error

type SignupReq

type SignupReq struct {

	// 密码
	Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty" validate:"required,gte=6,lte=15" annotation:"密码"`
	Name     string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty" validate:"required,gte=3,lte=10" annotation:"昵称"`
	Gender   Gender `protobuf:"varint,3,opt,name=gender,proto3,enum=user.Gender" json:"gender,omitempty" validate:"required" annotation:"性别"`
	// 邮箱
	Mail string `protobuf:"bytes,6,opt,name=mail,proto3" json:"mail,omitempty" validate:"omitempty,email" annotation:"邮箱"`
	// 手机号
	Phone string `protobuf:"bytes,7,opt,name=phone,proto3" json:"phone,omitempty" validate:"omitempty,phone" annotation:"手机号"`
	// 验证码
	VCode string `protobuf:"bytes,8,opt,name=vCode,proto3" json:"vCode,omitempty" validate:"required" annotation:"验证码"`
	// 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 (this *SignupReq) Validate() error

type SignupReqInput

type SignupReqInput = SignupReq

type UnimplementedUserServiceServer

type UnimplementedUserServiceServer struct {
}

UnimplementedUserServiceServer must be embedded to have forward compatible implementations.

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" annotation:"昵称"`
	Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"-" gorm:"size:32;not null" validate:"gte=8,lte=15" annotation:"密码"`
	Mail     string `protobuf:"bytes,6,opt,name=mail,proto3" json:"mail,omitempty" gorm:"size:32;default:''" validate:"email" annotation:"邮箱"`
	Phone    string `` /* 129-byte string literal not displayed */
	// 性别,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"`
	CreatedAt   string     `protobuf:"bytes,25,opt,name=createdAt,proto3" json:"createdAt,omitempty" gorm:"type:timestamptz(6);default:now();index"`
	ActivatedAt string     `protobuf:"bytes,3,opt,name=activatedAt,proto3" json:"activatedAt,omitempty" gorm:"<-:false;type:timestamptz(6);index"`
	DeletedAt   string     `protobuf:"bytes,27,opt,name=deletedAt,proto3" json:"deletedAt,omitempty" gorm:"<-:false;type:timestamptz(6);index"` // uint32 isDeleted = 29 [(go.field) = {tags:'gorm:"default:0"'}];
	// contains filtered or unexported fields
}

func (*User) Descriptor deprecated

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

Deprecated: Use User.ProtoReflect.Descriptor instead.

func (*User) GetActivatedAt

func (x *User) GetActivatedAt() string

func (*User) GetCreatedAt

func (x *User) GetCreatedAt() string

func (*User) GetDeletedAt

func (x *User) GetDeletedAt() string

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

type UserInput

type UserInput = User

type UserServiceClient

type UserServiceClient interface {
	// 注册
	Signup(ctx context.Context, in *SignupReq, opts ...grpc.CallOption) (*wrapperspb.StringValue, 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 UserServiceResolvers

type UserServiceResolvers struct{ Service UserServiceServer }

func (*UserServiceResolvers) UserServiceSignup

func (s *UserServiceResolvers) UserServiceSignup(ctx context.Context, in *SignupReq) (*wrapperspb.StringValue, error)

type UserServiceServer

type UserServiceServer interface {
	// 注册
	Signup(context.Context, *SignupReq) (*wrapperspb.StringValue, 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 (
	UserStatusPlaceholder UserStatus = 0
	UserStatusInActive    UserStatus = 1
	UserStatusActivated   UserStatus = 2
	UserStatusFrozen      UserStatus = 3
	UserStatusDeleted     UserStatus = 4
)

func UnmarshalUserStatus

func UnmarshalUserStatus(v interface{}) (UserStatus, error)

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) MarshalGQL

func (x UserStatus) MarshalGQL(w io.Writer)

func (UserStatus) Number

func (x UserStatus) Number() protoreflect.EnumNumber

func (UserStatus) OrigString

func (x UserStatus) OrigString() string

func (UserStatus) String

func (x UserStatus) String() string

func (UserStatus) Type

func (*UserStatus) UnmarshalGQL

func (x *UserStatus) UnmarshalGQL(v interface{}) error

Jump to

Keyboard shortcuts

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