user_v1

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package user_v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Role_name = map[int32]string{
		0: "USER",
		1: "ADMIN",
	}
	Role_value = map[string]int32{
		"USER":  0,
		"ADMIN": 1,
	}
)

Enum value maps for Role.

View Source
var UserV1_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "user_v1.UserV1",
	HandlerType: (*UserV1Server)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _UserV1_Create_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _UserV1_Get_Handler,
		},
		{
			MethodName: "Update",
			Handler:    _UserV1_Update_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _UserV1_Delete_Handler,
		},
		{
			MethodName: "FindByLogin",
			Handler:    _UserV1_FindByLogin_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "user.proto",
}

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

Functions

func RegisterUserV1Handler

func RegisterUserV1Handler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterUserV1Handler registers the http handlers for service UserV1 to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterUserV1HandlerClient

func RegisterUserV1HandlerClient(ctx context.Context, mux *runtime.ServeMux, client UserV1Client) error

RegisterUserV1HandlerClient registers the http handlers for service UserV1 to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserV1Client". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserV1Client" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "UserV1Client" to call the correct interceptors.

func RegisterUserV1HandlerFromEndpoint

func RegisterUserV1HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterUserV1HandlerFromEndpoint is same as RegisterUserV1Handler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterUserV1HandlerServer

func RegisterUserV1HandlerServer(ctx context.Context, mux *runtime.ServeMux, server UserV1Server) error

RegisterUserV1HandlerServer registers the http handlers for service UserV1 to "mux". UnaryRPC :call UserV1Server 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 RegisterUserV1HandlerFromEndpoint instead.

func RegisterUserV1Server

func RegisterUserV1Server(s grpc.ServiceRegistrar, srv UserV1Server)

Types

type CreateRequest

type CreateRequest struct {
	Name            string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Email           string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
	Password        string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
	PasswordConfirm string `protobuf:"bytes,4,opt,name=password_confirm,json=passwordConfirm,proto3" json:"password_confirm,omitempty"`
	Role            Role   `protobuf:"varint,5,opt,name=role,proto3,enum=user_v1.Role" json:"role,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetEmail

func (x *CreateRequest) GetEmail() string

func (*CreateRequest) GetName

func (x *CreateRequest) GetName() string

func (*CreateRequest) GetPassword

func (x *CreateRequest) GetPassword() string

func (*CreateRequest) GetPasswordConfirm

func (x *CreateRequest) GetPasswordConfirm() string

func (*CreateRequest) GetRole

func (x *CreateRequest) GetRole() Role

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type CreateResponse

type CreateResponse struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateResponse) Descriptor deprecated

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

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetId

func (x *CreateResponse) GetId() int64

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

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

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

type DeleteRequest

type DeleteRequest struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetId

func (x *DeleteRequest) GetId() int64

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type FindByLoginRequest added in v0.0.6

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

func (*FindByLoginRequest) Descriptor deprecated added in v0.0.6

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

Deprecated: Use FindByLoginRequest.ProtoReflect.Descriptor instead.

func (*FindByLoginRequest) GetName added in v0.0.6

func (x *FindByLoginRequest) GetName() string

func (*FindByLoginRequest) ProtoMessage added in v0.0.6

func (*FindByLoginRequest) ProtoMessage()

func (*FindByLoginRequest) ProtoReflect added in v0.0.6

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

func (*FindByLoginRequest) Reset added in v0.0.6

func (x *FindByLoginRequest) Reset()

func (*FindByLoginRequest) String added in v0.0.6

func (x *FindByLoginRequest) String() string

type FindByLoginResponse added in v0.0.6

type FindByLoginResponse struct {
	Results []*UserSearchItem `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
	// contains filtered or unexported fields
}

func (*FindByLoginResponse) Descriptor deprecated added in v0.0.6

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

Deprecated: Use FindByLoginResponse.ProtoReflect.Descriptor instead.

func (*FindByLoginResponse) GetResults added in v0.0.6

func (x *FindByLoginResponse) GetResults() []*UserSearchItem

func (*FindByLoginResponse) ProtoMessage added in v0.0.6

func (*FindByLoginResponse) ProtoMessage()

func (*FindByLoginResponse) ProtoReflect added in v0.0.6

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

func (*FindByLoginResponse) Reset added in v0.0.6

func (x *FindByLoginResponse) Reset()

func (*FindByLoginResponse) String added in v0.0.6

func (x *FindByLoginResponse) String() string

type GetRequest

type GetRequest struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetId

func (x *GetRequest) GetId() int64

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

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

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

type GetResponse

type GetResponse struct {
	Id        int64                `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name      string               `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Email     string               `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	Role      Role                 `protobuf:"varint,4,opt,name=role,proto3,enum=user_v1.Role" json:"role,omitempty"`
	CreatedAt *timestamp.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	UpdatedAt *timestamp.Timestamp `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"`
	// contains filtered or unexported fields
}

func (*GetResponse) Descriptor deprecated

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

Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.

func (*GetResponse) GetCreatedAt

func (x *GetResponse) GetCreatedAt() *timestamp.Timestamp

func (*GetResponse) GetEmail

func (x *GetResponse) GetEmail() string

func (*GetResponse) GetId

func (x *GetResponse) GetId() int64

func (*GetResponse) GetName

func (x *GetResponse) GetName() string

func (*GetResponse) GetRole

func (x *GetResponse) GetRole() Role

func (*GetResponse) GetUpdatedAt

func (x *GetResponse) GetUpdatedAt() *timestamp.Timestamp

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) ProtoReflect

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

func (*GetResponse) Reset

func (x *GetResponse) Reset()

func (*GetResponse) String

func (x *GetResponse) String() string

type Role

type Role int32

Роль пользователя

const (
	// Пользователь
	Role_USER Role = 0
	// Админ
	Role_ADMIN Role = 1
)

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 UnimplementedUserV1Server

type UnimplementedUserV1Server struct {
}

UnimplementedUserV1Server must be embedded to have forward compatible implementations.

func (UnimplementedUserV1Server) Create

func (UnimplementedUserV1Server) Delete

func (UnimplementedUserV1Server) FindByLogin added in v0.0.6

func (UnimplementedUserV1Server) Get

func (UnimplementedUserV1Server) Update

type UnsafeUserV1Server

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

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

type UpdateRequest

type UpdateRequest struct {
	Id    *wrappers.Int64Value  `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name  *wrappers.StringValue `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Email *wrappers.StringValue `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateRequest) Descriptor deprecated

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

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetEmail

func (x *UpdateRequest) GetEmail() *wrappers.StringValue

func (*UpdateRequest) GetId

func (x *UpdateRequest) GetId() *wrappers.Int64Value

func (*UpdateRequest) GetName

func (x *UpdateRequest) GetName() *wrappers.StringValue

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect

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

func (*UpdateRequest) Reset

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String

func (x *UpdateRequest) String() string

type UserSearchItem added in v0.0.6

type UserSearchItem struct {
	Id   int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*UserSearchItem) Descriptor deprecated added in v0.0.6

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

Deprecated: Use UserSearchItem.ProtoReflect.Descriptor instead.

func (*UserSearchItem) GetId added in v0.0.6

func (x *UserSearchItem) GetId() int64

func (*UserSearchItem) GetName added in v0.0.6

func (x *UserSearchItem) GetName() string

func (*UserSearchItem) ProtoMessage added in v0.0.6

func (*UserSearchItem) ProtoMessage()

func (*UserSearchItem) ProtoReflect added in v0.0.6

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

func (*UserSearchItem) Reset added in v0.0.6

func (x *UserSearchItem) Reset()

func (*UserSearchItem) String added in v0.0.6

func (x *UserSearchItem) String() string

type UserV1Client

type UserV1Client interface {
	// Создание нового пользователя
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	// Получение пользователя по ID
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
	// Обновление пользователя по ID
	Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Удаление пользователя по ID
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Поиск пользователя по логину
	FindByLogin(ctx context.Context, in *FindByLoginRequest, opts ...grpc.CallOption) (*FindByLoginResponse, error)
}

UserV1Client is the client API for UserV1 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 NewUserV1Client

func NewUserV1Client(cc grpc.ClientConnInterface) UserV1Client

type UserV1Server

type UserV1Server interface {
	// Создание нового пользователя
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	// Получение пользователя по ID
	Get(context.Context, *GetRequest) (*GetResponse, error)
	// Обновление пользователя по ID
	Update(context.Context, *UpdateRequest) (*empty.Empty, error)
	// Удаление пользователя по ID
	Delete(context.Context, *DeleteRequest) (*empty.Empty, error)
	// Поиск пользователя по логину
	FindByLogin(context.Context, *FindByLoginRequest) (*FindByLoginResponse, error)
	// contains filtered or unexported methods
}

UserV1Server is the server API for UserV1 service. All implementations must embed UnimplementedUserV1Server for forward compatibility

Jump to

Keyboard shortcuts

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