Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)
- type CreateUserRequest
- func (*CreateUserRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateUserRequest) GetCreateBy() string
- func (x *CreateUserRequest) GetDomain() string
- func (x *CreateUserRequest) GetName() string
- func (x *CreateUserRequest) GetPassword() string
- func (*CreateUserRequest) ProtoMessage()
- func (x *CreateUserRequest) ProtoReflect() protoreflect.Message
- func (x *CreateUserRequest) Reset()
- func (x *CreateUserRequest) String() string
- func (req *CreateUserRequest) Validate() error
- type DeleteUserRequest
- type DescribeBy
- func (DescribeBy) Descriptor() protoreflect.EnumDescriptor
- func (x DescribeBy) Enum() *DescribeBy
- func (DescribeBy) EnumDescriptor() ([]byte, []int)deprecated
- func (t DescribeBy) Equal(target DescribeBy) bool
- func (t DescribeBy) IsIn(targets ...DescribeBy) bool
- func (t DescribeBy) MarshalJSON() ([]byte, error)
- func (x DescribeBy) Number() protoreflect.EnumNumber
- func (x DescribeBy) String() string
- func (DescribeBy) Type() protoreflect.EnumType
- func (t *DescribeBy) UnmarshalJSON(b []byte) error
- type DescribeUserRequest
- func (*DescribeUserRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DescribeUserRequest) GetDescribeBy() DescribeBy
- func (x *DescribeUserRequest) GetDomain() string
- func (x *DescribeUserRequest) GetUserId() string
- func (x *DescribeUserRequest) GetUserName() string
- func (*DescribeUserRequest) ProtoMessage()
- func (x *DescribeUserRequest) ProtoReflect() protoreflect.Message
- func (x *DescribeUserRequest) Reset()
- func (x *DescribeUserRequest) String() string
- type PageRequest
- func (*PageRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PageRequest) GetOffset() int64
- func (x *PageRequest) GetPageNumber() uint64
- func (x *PageRequest) GetPageSize() uint64
- func (*PageRequest) ProtoMessage()
- func (x *PageRequest) ProtoReflect() protoreflect.Message
- func (x *PageRequest) Reset()
- func (x *PageRequest) String() string
- type QueryUserRequest
- func (*QueryUserRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryUserRequest) GetKeywords() string
- func (x *QueryUserRequest) GetPage() *PageRequest
- func (*QueryUserRequest) ProtoMessage()
- func (x *QueryUserRequest) ProtoReflect() protoreflect.Message
- func (x *QueryUserRequest) Reset()
- func (x *QueryUserRequest) String() string
- type ServiceClient
- type ServiceServer
- type UnimplementedServiceServer
- func (UnimplementedServiceServer) CreateUser(context.Context, *CreateUserRequest) (*User, error)
- func (UnimplementedServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*User, error)
- func (UnimplementedServiceServer) DescribeUser(context.Context, *DescribeUserRequest) (*User, error)
- func (UnimplementedServiceServer) QueryUser(context.Context, *QueryUserRequest) (*UserSet, error)
- func (UnimplementedServiceServer) UpdateUser(context.Context, *UpdateUserRequest) (*User, error)
- type UnsafeServiceServer
- type UpdateMode
- type UpdateUserRequest
- func (*UpdateUserRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateUserRequest) GetData() *CreateUserRequest
- func (x *UpdateUserRequest) GetId() string
- func (x *UpdateUserRequest) GetUpdateAt() int64
- func (x *UpdateUserRequest) GetUpdateBy() string
- func (x *UpdateUserRequest) GetUpdateMode() UpdateMode
- func (*UpdateUserRequest) ProtoMessage()
- func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateUserRequest) Reset()
- func (x *UpdateUserRequest) String() string
- type User
- func (u *User) CheckPassword(password string) bool
- func (*User) Descriptor() ([]byte, []int)deprecated
- func (x *User) GetCreateAt() int64
- func (x *User) GetData() *CreateUserRequest
- func (x *User) GetId() string
- func (x *User) GetUpdateAt() int64
- func (x *User) GetUpdateBy() string
- func (*User) ProtoMessage()
- func (x *User) ProtoReflect() protoreflect.Message
- func (x *User) Reset()
- func (x *User) String() string
- type UserSet
- func (s *UserSet) Add(item *User)
- func (*UserSet) Descriptor() ([]byte, []int)deprecated
- func (x *UserSet) GetItems() []*User
- func (x *UserSet) GetTotal() int64
- func (*UserSet) ProtoMessage()
- func (x *UserSet) ProtoReflect() protoreflect.Message
- func (x *UserSet) Reset()
- func (x *UserSet) String() string
Constants ¶
const ( // DefaultPageSize 默认分页大小 DefaultPageSize = 20 // DefaultPageNumber 默认页号 DefaultPageNumber = 1 )
const (
AppName = "user"
)
const (
DefaultDomain = "default"
)
Variables ¶
var ( DescribeBy_name = map[int32]string{ 0: "USER_ID", 1: "USER_NAME", } DescribeBy_value = map[string]int32{ "USER_ID": 0, "USER_NAME": 1, } )
Enum value maps for DescribeBy.
var ( UpdateMode_name = map[int32]string{ 0: "PUT", 1: "PATCH", } UpdateMode_value = map[string]int32{ "PUT": 0, "PATCH": 1, } )
Enum value maps for UpdateMode.
var File_apps_user_pb_user_proto protoreflect.FileDescriptor
var Service_ServiceDesc = grpc.ServiceDesc{ ServiceName: "ginkgo_keyauth.user.Service", HandlerType: (*ServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateUser", Handler: _Service_CreateUser_Handler, }, { MethodName: "QueryUser", Handler: _Service_QueryUser_Handler, }, { MethodName: "DescribeUser", Handler: _Service_DescribeUser_Handler, }, { MethodName: "UpdateUser", Handler: _Service_UpdateUser_Handler, }, { MethodName: "DeleteUser", Handler: _Service_DeleteUser_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "apps/user/pb/user.proto", }
Service_ServiceDesc is the grpc.ServiceDesc for Service service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterServiceServer ¶
func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)
Types ¶
type CreateUserRequest ¶
type CreateUserRequest struct { // 创建人 // @gotags: json:"create_by" bson:"create_by" CreateBy string `protobuf:"bytes,1,opt,name=create_by,json=createBy,proto3" json:"create_by" bson:"create_by"` // 用户名称 // @gotags: json:"name" bson:"name" validate:"required" Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name" bson:"name" validate:"required"` // 用户的密码 // @gotags: json:"password" bson:"password" validate:"required" Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password" bson:"password" validate:"required"` // 用户属于那个组织或者公司 // @gotags: json:"domain" bson:"domain" Domain string `protobuf:"bytes,4,opt,name=domain,proto3" json:"domain" bson:"domain"` // contains filtered or unexported fields }
func NewCreateUserRequest ¶
func NewCreateUserRequest() *CreateUserRequest
func (*CreateUserRequest) Descriptor
deprecated
func (*CreateUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead.
func (*CreateUserRequest) GetCreateBy ¶
func (x *CreateUserRequest) GetCreateBy() string
func (*CreateUserRequest) GetDomain ¶
func (x *CreateUserRequest) GetDomain() string
func (*CreateUserRequest) GetName ¶
func (x *CreateUserRequest) GetName() string
func (*CreateUserRequest) GetPassword ¶
func (x *CreateUserRequest) GetPassword() string
func (*CreateUserRequest) ProtoMessage ¶
func (*CreateUserRequest) ProtoMessage()
func (*CreateUserRequest) ProtoReflect ¶
func (x *CreateUserRequest) ProtoReflect() protoreflect.Message
func (*CreateUserRequest) Reset ¶
func (x *CreateUserRequest) Reset()
func (*CreateUserRequest) String ¶
func (x *CreateUserRequest) String() string
func (*CreateUserRequest) Validate ¶
func (req *CreateUserRequest) Validate() error
type DeleteUserRequest ¶
type DeleteUserRequest struct { // book id // @gotags: json:"id" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` // contains filtered or unexported fields }
func (*DeleteUserRequest) Descriptor
deprecated
func (*DeleteUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead.
func (*DeleteUserRequest) GetId ¶
func (x *DeleteUserRequest) GetId() string
func (*DeleteUserRequest) ProtoMessage ¶
func (*DeleteUserRequest) ProtoMessage()
func (*DeleteUserRequest) ProtoReflect ¶
func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message
func (*DeleteUserRequest) Reset ¶
func (x *DeleteUserRequest) Reset()
func (*DeleteUserRequest) String ¶
func (x *DeleteUserRequest) String() string
type DescribeBy ¶
type DescribeBy int32
const ( DescribeBy_USER_ID DescribeBy = 0 DescribeBy_USER_NAME DescribeBy = 1 )
func ParseDescribeByFromString ¶
func ParseDescribeByFromString(str string) (DescribeBy, error)
ParseDescribeByFromString Parse DescribeBy from string
func (DescribeBy) Descriptor ¶
func (DescribeBy) Descriptor() protoreflect.EnumDescriptor
func (DescribeBy) Enum ¶
func (x DescribeBy) Enum() *DescribeBy
func (DescribeBy) EnumDescriptor
deprecated
func (DescribeBy) EnumDescriptor() ([]byte, []int)
Deprecated: Use DescribeBy.Descriptor instead.
func (DescribeBy) Number ¶
func (x DescribeBy) Number() protoreflect.EnumNumber
func (DescribeBy) String ¶
func (x DescribeBy) String() string
func (DescribeBy) Type ¶
func (DescribeBy) Type() protoreflect.EnumType
func (*DescribeBy) UnmarshalJSON ¶
func (t *DescribeBy) UnmarshalJSON(b []byte) error
UnmarshalJSON todo
type DescribeUserRequest ¶
type DescribeUserRequest struct { // describe_by // @gotags: json:"describe_by" DescribeBy DescribeBy `protobuf:"varint,1,opt,name=describe_by,json=describeBy,proto3,enum=ginkgo_keyauth.user.DescribeBy" json:"describe_by"` // user_id // @gotags: json:"user_id" UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id"` // domain // @gotags: json:"domain" Domain string `protobuf:"bytes,3,opt,name=domain,proto3" json:"domain"` // user_name // @gotags: json:"user_name" UserName string `protobuf:"bytes,4,opt,name=user_name,json=userName,proto3" json:"user_name"` // contains filtered or unexported fields }
希望通过 domain+username 可以查询到用户 同时兼容Id和domain+username
func NewDescribeUserRequestById ¶
func NewDescribeUserRequestById(id string) *DescribeUserRequest
func NewDescribeUserRequestByName ¶
func NewDescribeUserRequestByName(domain, name string) *DescribeUserRequest
func (*DescribeUserRequest) Descriptor
deprecated
func (*DescribeUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use DescribeUserRequest.ProtoReflect.Descriptor instead.
func (*DescribeUserRequest) GetDescribeBy ¶
func (x *DescribeUserRequest) GetDescribeBy() DescribeBy
func (*DescribeUserRequest) GetDomain ¶
func (x *DescribeUserRequest) GetDomain() string
func (*DescribeUserRequest) GetUserId ¶
func (x *DescribeUserRequest) GetUserId() string
func (*DescribeUserRequest) GetUserName ¶
func (x *DescribeUserRequest) GetUserName() string
func (*DescribeUserRequest) ProtoMessage ¶
func (*DescribeUserRequest) ProtoMessage()
func (*DescribeUserRequest) ProtoReflect ¶
func (x *DescribeUserRequest) ProtoReflect() protoreflect.Message
func (*DescribeUserRequest) Reset ¶
func (x *DescribeUserRequest) Reset()
func (*DescribeUserRequest) String ¶
func (x *DescribeUserRequest) String() string
type PageRequest ¶
type PageRequest struct { PageSize uint64 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` PageNumber uint64 `protobuf:"varint,2,opt,name=page_number,json=pageNumber,proto3" json:"page_number,omitempty"` Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` // contains filtered or unexported fields }
func NewPageRequestFromHTTP ¶
func NewPageRequestFromHTTP(req *http.Request) *PageRequest
NewPageRequestFromHTTP 从HTTP请求中加载分页请求
func (*PageRequest) Descriptor
deprecated
func (*PageRequest) Descriptor() ([]byte, []int)
Deprecated: Use PageRequest.ProtoReflect.Descriptor instead.
func (*PageRequest) GetOffset ¶
func (x *PageRequest) GetOffset() int64
func (*PageRequest) GetPageNumber ¶
func (x *PageRequest) GetPageNumber() uint64
func (*PageRequest) GetPageSize ¶
func (x *PageRequest) GetPageSize() uint64
func (*PageRequest) ProtoMessage ¶
func (*PageRequest) ProtoMessage()
func (*PageRequest) ProtoReflect ¶
func (x *PageRequest) ProtoReflect() protoreflect.Message
func (*PageRequest) Reset ¶
func (x *PageRequest) Reset()
func (*PageRequest) String ¶
func (x *PageRequest) String() string
type QueryUserRequest ¶
type QueryUserRequest struct { // 分页参数 // @gotags: json:"page" Page *PageRequest `protobuf:"bytes,1,opt,name=page,proto3" json:"page"` // 关键字参数 // @gotags: json:"keywords" Keywords string `protobuf:"bytes,2,opt,name=keywords,proto3" json:"keywords"` // contains filtered or unexported fields }
func NewQueryUserRequestFromHTTP ¶
func NewQueryUserRequestFromHTTP(r *http.Request) *QueryUserRequest
func (*QueryUserRequest) Descriptor
deprecated
func (*QueryUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryUserRequest.ProtoReflect.Descriptor instead.
func (*QueryUserRequest) GetKeywords ¶
func (x *QueryUserRequest) GetKeywords() string
func (*QueryUserRequest) GetPage ¶
func (x *QueryUserRequest) GetPage() *PageRequest
func (*QueryUserRequest) ProtoMessage ¶
func (*QueryUserRequest) ProtoMessage()
func (*QueryUserRequest) ProtoReflect ¶
func (x *QueryUserRequest) ProtoReflect() protoreflect.Message
func (*QueryUserRequest) Reset ¶
func (x *QueryUserRequest) Reset()
func (*QueryUserRequest) String ¶
func (x *QueryUserRequest) String() string
type ServiceClient ¶
type ServiceClient interface { CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*User, error) QueryUser(ctx context.Context, in *QueryUserRequest, opts ...grpc.CallOption) (*UserSet, error) DescribeUser(ctx context.Context, in *DescribeUserRequest, opts ...grpc.CallOption) (*User, error) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*User, error) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*User, error) }
ServiceClient is the client API for Service 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 NewServiceClient ¶
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient
type ServiceServer ¶
type ServiceServer interface { CreateUser(context.Context, *CreateUserRequest) (*User, error) QueryUser(context.Context, *QueryUserRequest) (*UserSet, error) DescribeUser(context.Context, *DescribeUserRequest) (*User, error) UpdateUser(context.Context, *UpdateUserRequest) (*User, error) DeleteUser(context.Context, *DeleteUserRequest) (*User, error) // contains filtered or unexported methods }
ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility
type UnimplementedServiceServer ¶
type UnimplementedServiceServer struct { }
UnimplementedServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedServiceServer) CreateUser ¶
func (UnimplementedServiceServer) CreateUser(context.Context, *CreateUserRequest) (*User, error)
func (UnimplementedServiceServer) DeleteUser ¶
func (UnimplementedServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*User, error)
func (UnimplementedServiceServer) DescribeUser ¶
func (UnimplementedServiceServer) DescribeUser(context.Context, *DescribeUserRequest) (*User, error)
func (UnimplementedServiceServer) QueryUser ¶
func (UnimplementedServiceServer) QueryUser(context.Context, *QueryUserRequest) (*UserSet, error)
func (UnimplementedServiceServer) UpdateUser ¶
func (UnimplementedServiceServer) UpdateUser(context.Context, *UpdateUserRequest) (*User, error)
type UnsafeServiceServer ¶
type UnsafeServiceServer interface {
// contains filtered or unexported methods
}
UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer will result in compilation errors.
type UpdateMode ¶
type UpdateMode int32
const ( UpdateMode_PUT UpdateMode = 0 UpdateMode_PATCH UpdateMode = 1 )
func (UpdateMode) Descriptor ¶
func (UpdateMode) Descriptor() protoreflect.EnumDescriptor
func (UpdateMode) Enum ¶
func (x UpdateMode) Enum() *UpdateMode
func (UpdateMode) EnumDescriptor
deprecated
func (UpdateMode) EnumDescriptor() ([]byte, []int)
Deprecated: Use UpdateMode.Descriptor instead.
func (UpdateMode) Number ¶
func (x UpdateMode) Number() protoreflect.EnumNumber
func (UpdateMode) String ¶
func (x UpdateMode) String() string
func (UpdateMode) Type ¶
func (UpdateMode) Type() protoreflect.EnumType
type UpdateUserRequest ¶
type UpdateUserRequest struct { // book id // @gotags: json:"id" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` // 更新模式 // @gotags: json:"update_mode" UpdateMode UpdateMode `protobuf:"varint,2,opt,name=update_mode,json=updateMode,proto3,enum=ginkgo_keyauth.user.UpdateMode" json:"update_mode"` // 更新人 // @gotags: json:"update_by" UpdateBy string `protobuf:"bytes,3,opt,name=update_by,json=updateBy,proto3" json:"update_by"` // 更新时间 // @gotags: json:"update_at" UpdateAt int64 `protobuf:"varint,4,opt,name=update_at,json=updateAt,proto3" json:"update_at"` // 更新的书本信息 // @gotags: json:"data" Data *CreateUserRequest `protobuf:"bytes,5,opt,name=data,proto3" json:"data"` // contains filtered or unexported fields }
func NewPatchUserRequest ¶
func NewPatchUserRequest(id string) *UpdateUserRequest
func NewPutUserRequest ¶
func NewPutUserRequest(id string) *UpdateUserRequest
func (*UpdateUserRequest) Descriptor
deprecated
func (*UpdateUserRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead.
func (*UpdateUserRequest) GetData ¶
func (x *UpdateUserRequest) GetData() *CreateUserRequest
func (*UpdateUserRequest) GetId ¶
func (x *UpdateUserRequest) GetId() string
func (*UpdateUserRequest) GetUpdateAt ¶
func (x *UpdateUserRequest) GetUpdateAt() int64
func (*UpdateUserRequest) GetUpdateBy ¶
func (x *UpdateUserRequest) GetUpdateBy() string
func (*UpdateUserRequest) GetUpdateMode ¶
func (x *UpdateUserRequest) GetUpdateMode() UpdateMode
func (*UpdateUserRequest) ProtoMessage ¶
func (*UpdateUserRequest) ProtoMessage()
func (*UpdateUserRequest) ProtoReflect ¶
func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message
func (*UpdateUserRequest) Reset ¶
func (x *UpdateUserRequest) Reset()
func (*UpdateUserRequest) String ¶
func (x *UpdateUserRequest) String() string
type User ¶
type User struct { // 唯一ID // @gotags: json:"id" bson:"_id" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` // 录入时间 // @gotags: json:"create_at" bson:"create_at" CreateAt int64 `protobuf:"varint,2,opt,name=create_at,json=createAt,proto3" json:"create_at" bson:"create_at"` // 更新时间 // @gotags: json:"update_at" bson:"update_at" UpdateAt int64 `protobuf:"varint,3,opt,name=update_at,json=updateAt,proto3" json:"update_at" bson:"update_at"` // 更新人 // @gotags: json:"update_by" bson:"update_by" UpdateBy string `protobuf:"bytes,4,opt,name=update_by,json=updateBy,proto3" json:"update_by" bson:"update_by"` // 书本信息 // @gotags: json:"data" bson:"data" Data *CreateUserRequest `protobuf:"bytes,5,opt,name=data,proto3" json:"data" bson:"data"` // contains filtered or unexported fields }
User todo
func NewDefaultUser ¶
func NewDefaultUser() *User
func (*User) CheckPassword ¶
func (*User) Descriptor
deprecated
func (*User) GetCreateAt ¶
func (*User) GetData ¶
func (x *User) GetData() *CreateUserRequest
func (*User) GetUpdateAt ¶
func (*User) GetUpdateBy ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) ProtoReflect ¶
func (x *User) ProtoReflect() protoreflect.Message
type UserSet ¶
type UserSet struct { // 分页时,返回总数量 // @gotags: json:"total" Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` // 一页的数据 // @gotags: json:"items" Items []*User `protobuf:"bytes,2,rep,name=items,proto3" json:"items"` // contains filtered or unexported fields }
UserSet todo
func NewUserSet ¶
func NewUserSet() *UserSet
func (*UserSet) Descriptor
deprecated
func (*UserSet) ProtoMessage ¶
func (*UserSet) ProtoMessage()
func (*UserSet) ProtoReflect ¶
func (x *UserSet) ProtoReflect() protoreflect.Message