From 075a0d2441ef85a51bab59d8347c9b4414cab5a7 Mon Sep 17 00:00:00 2001 From: fish Date: Sat, 28 Mar 2026 18:28:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=9F=E4=B8=80=20Docker=20?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=91=BD=E5=90=8D=E8=A7=84=E8=8C=83=EF=BC=8C?= =?UTF-8?q?=E5=85=A8=E5=B0=8F=E5=86=99=E6=A8=AA=E6=9D=A0=E5=88=86=E9=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/common/common.pb.go | 292 ++++++++++++++ backend/docker-compose.dev.yml | 47 ++- backend/docker-compose.yml | 47 ++- backend/nginx/nginx.conf | 2 +- backend/user/user.pb.go | 682 +++++++++++++++++++++++++++++++++ backend/user/user_grpc.pb.go | 273 +++++++++++++ 6 files changed, 1302 insertions(+), 41 deletions(-) create mode 100644 backend/common/common.pb.go create mode 100644 backend/user/user.pb.go create mode 100644 backend/user/user_grpc.pb.go diff --git a/backend/common/common.pb.go b/backend/common/common.pb.go new file mode 100644 index 0000000..d492d4a --- /dev/null +++ b/backend/common/common.pb.go @@ -0,0 +1,292 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v6.31.1 +// source: shared/proto/common.proto + +package common + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Empty struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Empty) Reset() { + *x = Empty{} + mi := &file_shared_proto_common_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Empty) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Empty) ProtoMessage() {} + +func (x *Empty) ProtoReflect() protoreflect.Message { + mi := &file_shared_proto_common_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Empty.ProtoReflect.Descriptor instead. +func (*Empty) Descriptor() ([]byte, []int) { + return file_shared_proto_common_proto_rawDescGZIP(), []int{0} +} + +type Status struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Status) Reset() { + *x = Status{} + mi := &file_shared_proto_common_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Status) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Status) ProtoMessage() {} + +func (x *Status) ProtoReflect() protoreflect.Message { + mi := &file_shared_proto_common_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Status.ProtoReflect.Descriptor instead. +func (*Status) Descriptor() ([]byte, []int) { + return file_shared_proto_common_proto_rawDescGZIP(), []int{1} +} + +func (x *Status) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *Status) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *Status) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type Pagination struct { + state protoimpl.MessageState `protogen:"open.v1"` + Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + Total int32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Pagination) Reset() { + *x = Pagination{} + mi := &file_shared_proto_common_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Pagination) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Pagination) ProtoMessage() {} + +func (x *Pagination) ProtoReflect() protoreflect.Message { + mi := &file_shared_proto_common_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Pagination.ProtoReflect.Descriptor instead. +func (*Pagination) Descriptor() ([]byte, []int) { + return file_shared_proto_common_proto_rawDescGZIP(), []int{2} +} + +func (x *Pagination) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *Pagination) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *Pagination) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +type IdRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *IdRequest) Reset() { + *x = IdRequest{} + mi := &file_shared_proto_common_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *IdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdRequest) ProtoMessage() {} + +func (x *IdRequest) ProtoReflect() protoreflect.Message { + mi := &file_shared_proto_common_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdRequest.ProtoReflect.Descriptor instead. +func (*IdRequest) Descriptor() ([]byte, []int) { + return file_shared_proto_common_proto_rawDescGZIP(), []int{3} +} + +func (x *IdRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_shared_proto_common_proto protoreflect.FileDescriptor + +const file_shared_proto_common_proto_rawDesc = "" + + "\n" + + "\x19shared/proto/common.proto\x12\x06common\"\a\n" + + "\x05Empty\"P\n" + + "\x06Status\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\x12\x12\n" + + "\x04code\x18\x03 \x01(\tR\x04code\"S\n" + + "\n" + + "Pagination\x12\x12\n" + + "\x04page\x18\x01 \x01(\x05R\x04page\x12\x1b\n" + + "\tpage_size\x18\x02 \x01(\x05R\bpageSize\x12\x14\n" + + "\x05total\x18\x03 \x01(\x05R\x05total\"\x1b\n" + + "\tIdRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02idB\n" + + "Z\b./commonb\x06proto3" + +var ( + file_shared_proto_common_proto_rawDescOnce sync.Once + file_shared_proto_common_proto_rawDescData []byte +) + +func file_shared_proto_common_proto_rawDescGZIP() []byte { + file_shared_proto_common_proto_rawDescOnce.Do(func() { + file_shared_proto_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_shared_proto_common_proto_rawDesc), len(file_shared_proto_common_proto_rawDesc))) + }) + return file_shared_proto_common_proto_rawDescData +} + +var file_shared_proto_common_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_shared_proto_common_proto_goTypes = []any{ + (*Empty)(nil), // 0: common.Empty + (*Status)(nil), // 1: common.Status + (*Pagination)(nil), // 2: common.Pagination + (*IdRequest)(nil), // 3: common.IdRequest +} +var file_shared_proto_common_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_shared_proto_common_proto_init() } +func file_shared_proto_common_proto_init() { + if File_shared_proto_common_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_shared_proto_common_proto_rawDesc), len(file_shared_proto_common_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_shared_proto_common_proto_goTypes, + DependencyIndexes: file_shared_proto_common_proto_depIdxs, + MessageInfos: file_shared_proto_common_proto_msgTypes, + }.Build() + File_shared_proto_common_proto = out.File + file_shared_proto_common_proto_goTypes = nil + file_shared_proto_common_proto_depIdxs = nil +} diff --git a/backend/docker-compose.dev.yml b/backend/docker-compose.dev.yml index 043cd31..6b82889 100644 --- a/backend/docker-compose.dev.yml +++ b/backend/docker-compose.dev.yml @@ -1,42 +1,47 @@ version: '3.8' services: - nginx: + asset-helper-nginx: image: nginx:1.25-alpine + container_name: asset-helper-nginx-dev ports: - "80:80" volumes: - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro depends_on: - - gateway + - asset-helper-gateway networks: - - backend-network + - asset-helper-network - gateway: + asset-helper-gateway: build: context: ./gateway dockerfile: Dockerfile + image: asset-helper-gateway + container_name: asset-helper-gateway-dev ports: - "8080:8080" environment: - GO_ENV=development - - REDIS_ADDR=redis:6379 + - REDIS_ADDR=asset-helper-redis:6379 volumes: - ./gateway:/app depends_on: - - redis + - asset-helper-redis networks: - - backend-network + - asset-helper-network - user-svc: + asset-helper-user-svc: build: context: ./services/user-svc dockerfile: Dockerfile + image: asset-helper-user-svc + container_name: asset-helper-user-svc-dev ports: - "50051:50051" environment: - GO_ENV=development - - POSTGRES_HOST=postgres + - POSTGRES_HOST=asset-helper-postgres - POSTGRES_PORT=5432 - POSTGRES_USER=admin - POSTGRES_PASSWORD=password @@ -44,12 +49,13 @@ services: volumes: - ./services/user-svc:/app depends_on: - - postgres + - asset-helper-postgres networks: - - backend-network + - asset-helper-network - postgres: + asset-helper-postgres: image: postgres:18.3-alpine3.23 + container_name: asset-helper-postgres-dev ports: - "5432:5432" environment: @@ -57,23 +63,24 @@ services: - POSTGRES_PASSWORD=password - POSTGRES_DB=userdb volumes: - - postgres-data:/var/lib/postgresql/data + - asset-helper-postgres-data:/var/lib/postgresql/data networks: - - backend-network + - asset-helper-network - redis: + asset-helper-redis: image: redis:8.6.2-alpine + container_name: asset-helper-redis-dev ports: - "6379:6379" volumes: - - redis-data:/data + - asset-helper-redis-data:/data networks: - - backend-network + - asset-helper-network volumes: - postgres-data: - redis-data: + asset-helper-postgres-data: + asset-helper-redis-data: networks: - backend-network: + asset-helper-network: driver: bridge diff --git a/backend/docker-compose.yml b/backend/docker-compose.yml index 9ca9ee4..a4736ea 100644 --- a/backend/docker-compose.yml +++ b/backend/docker-compose.yml @@ -1,51 +1,57 @@ version: '3.8' services: - nginx: + asset-helper-nginx: image: nginx:1.25-alpine + container_name: asset-helper-nginx ports: - "80:80" volumes: - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro depends_on: - - gateway + - asset-helper-gateway networks: - - backend-network + - asset-helper-network - gateway: + asset-helper-gateway: build: context: ./gateway dockerfile: Dockerfile + image: asset-helper-gateway + container_name: asset-helper-gateway ports: - "8080:8080" environment: - GO_ENV=production - - REDIS_ADDR=redis:6379 + - REDIS_ADDR=asset-helper-redis:6379 depends_on: - - redis + - asset-helper-redis networks: - - backend-network + - asset-helper-network - user-svc: + asset-helper-user-svc: build: context: ./services/user-svc dockerfile: Dockerfile + image: asset-helper-user-svc + container_name: asset-helper-user-svc ports: - "50051:50051" environment: - GO_ENV=production - - POSTGRES_HOST=postgres + - POSTGRES_HOST=asset-helper-postgres - POSTGRES_PORT=5432 - POSTGRES_USER=admin - POSTGRES_PASSWORD=password - POSTGRES_DB=userdb depends_on: - - postgres + - asset-helper-postgres networks: - - backend-network + - asset-helper-network - postgres: + asset-helper-postgres: image: postgres:18.3-alpine3.23 + container_name: asset-helper-postgres ports: - "5432:5432" environment: @@ -53,23 +59,24 @@ services: - POSTGRES_PASSWORD=password - POSTGRES_DB=userdb volumes: - - postgres-data:/var/lib/postgresql/data + - asset-helper-postgres-data:/var/lib/postgresql/data networks: - - backend-network + - asset-helper-network - redis: + asset-helper-redis: image: redis:8.6.2-alpine + container_name: asset-helper-redis ports: - "6379:6379" volumes: - - redis-data:/data + - asset-helper-redis-data:/data networks: - - backend-network + - asset-helper-network volumes: - postgres-data: - redis-data: + asset-helper-postgres-data: + asset-helper-redis-data: networks: - backend-network: + asset-helper-network: driver: bridge diff --git a/backend/nginx/nginx.conf b/backend/nginx/nginx.conf index 8802235..3ebc0c3 100644 --- a/backend/nginx/nginx.conf +++ b/backend/nginx/nginx.conf @@ -19,7 +19,7 @@ http { keepalive_timeout 65; upstream gateway { - server gateway:8080; + server asset-helper-gateway:8080; } server { diff --git a/backend/user/user.pb.go b/backend/user/user.pb.go new file mode 100644 index 0000000..c158a85 --- /dev/null +++ b/backend/user/user.pb.go @@ -0,0 +1,682 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v6.31.1 +// source: services/user-svc/user.proto + +package user + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type User struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,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"` + Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *User) Reset() { + *x = User{} + mi := &file_services_user_svc_user_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *User) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*User) ProtoMessage() {} + +func (x *User) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use User.ProtoReflect.Descriptor instead. +func (*User) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{0} +} + +func (x *User) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *User) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *User) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *User) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type CreateUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + 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"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateUserRequest) Reset() { + *x = CreateUserRequest{} + mi := &file_services_user_svc_user_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserRequest) ProtoMessage() {} + +func (x *CreateUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserRequest.ProtoReflect.Descriptor instead. +func (*CreateUserRequest) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateUserRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateUserRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *CreateUserRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type CreateUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateUserResponse) Reset() { + *x = CreateUserResponse{} + mi := &file_services_user_svc_user_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateUserResponse) ProtoMessage() {} + +func (x *CreateUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateUserResponse.ProtoReflect.Descriptor instead. +func (*CreateUserResponse) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type GetUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserRequest) Reset() { + *x = GetUserRequest{} + mi := &file_services_user_svc_user_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserRequest) ProtoMessage() {} + +func (x *GetUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserRequest.ProtoReflect.Descriptor instead. +func (*GetUserRequest) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{3} +} + +func (x *GetUserRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type GetUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserResponse) Reset() { + *x = GetUserResponse{} + mi := &file_services_user_svc_user_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserResponse) ProtoMessage() {} + +func (x *GetUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserResponse.ProtoReflect.Descriptor instead. +func (*GetUserResponse) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{4} +} + +func (x *GetUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type ListUsersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUsersRequest) Reset() { + *x = ListUsersRequest{} + mi := &file_services_user_svc_user_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUsersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUsersRequest) ProtoMessage() {} + +func (x *ListUsersRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUsersRequest.ProtoReflect.Descriptor instead. +func (*ListUsersRequest) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{5} +} + +type ListUsersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Users []*User `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListUsersResponse) Reset() { + *x = ListUsersResponse{} + mi := &file_services_user_svc_user_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListUsersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUsersResponse) ProtoMessage() {} + +func (x *ListUsersResponse) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUsersResponse.ProtoReflect.Descriptor instead. +func (*ListUsersResponse) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{6} +} + +func (x *ListUsersResponse) GetUsers() []*User { + if x != nil { + return x.Users + } + return nil +} + +type UpdateUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,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"` + Password string `protobuf:"bytes,4,opt,name=password,proto3" json:"password,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserRequest) Reset() { + *x = UpdateUserRequest{} + mi := &file_services_user_svc_user_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserRequest) ProtoMessage() {} + +func (x *UpdateUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserRequest.ProtoReflect.Descriptor instead. +func (*UpdateUserRequest) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{7} +} + +func (x *UpdateUserRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateUserRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateUserRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +func (x *UpdateUserRequest) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +type UpdateUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateUserResponse) Reset() { + *x = UpdateUserResponse{} + mi := &file_services_user_svc_user_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateUserResponse) ProtoMessage() {} + +func (x *UpdateUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateUserResponse.ProtoReflect.Descriptor instead. +func (*UpdateUserResponse) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdateUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + +type DeleteUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteUserRequest) Reset() { + *x = DeleteUserRequest{} + mi := &file_services_user_svc_user_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserRequest) ProtoMessage() {} + +func (x *DeleteUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserRequest.ProtoReflect.Descriptor instead. +func (*DeleteUserRequest) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{9} +} + +func (x *DeleteUserRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type DeleteUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteUserResponse) Reset() { + *x = DeleteUserResponse{} + mi := &file_services_user_svc_user_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteUserResponse) ProtoMessage() {} + +func (x *DeleteUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_services_user_svc_user_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteUserResponse.ProtoReflect.Descriptor instead. +func (*DeleteUserResponse) Descriptor() ([]byte, []int) { + return file_services_user_svc_user_proto_rawDescGZIP(), []int{10} +} + +func (x *DeleteUserResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +var File_services_user_svc_user_proto protoreflect.FileDescriptor + +const file_services_user_svc_user_proto_rawDesc = "" + + "\n" + + "\x1cservices/user-svc/user.proto\x12\x04user\"\\\n" + + "\x04User\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x14\n" + + "\x05email\x18\x03 \x01(\tR\x05email\x12\x1a\n" + + "\bpassword\x18\x04 \x01(\tR\bpassword\"Y\n" + + "\x11CreateUserRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05email\x18\x02 \x01(\tR\x05email\x12\x1a\n" + + "\bpassword\x18\x03 \x01(\tR\bpassword\"4\n" + + "\x12CreateUserResponse\x12\x1e\n" + + "\x04user\x18\x01 \x01(\v2\n" + + ".user.UserR\x04user\" \n" + + "\x0eGetUserRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\"1\n" + + "\x0fGetUserResponse\x12\x1e\n" + + "\x04user\x18\x01 \x01(\v2\n" + + ".user.UserR\x04user\"\x12\n" + + "\x10ListUsersRequest\"5\n" + + "\x11ListUsersResponse\x12 \n" + + "\x05users\x18\x01 \x03(\v2\n" + + ".user.UserR\x05users\"i\n" + + "\x11UpdateUserRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x14\n" + + "\x05email\x18\x03 \x01(\tR\x05email\x12\x1a\n" + + "\bpassword\x18\x04 \x01(\tR\bpassword\"4\n" + + "\x12UpdateUserResponse\x12\x1e\n" + + "\x04user\x18\x01 \x01(\v2\n" + + ".user.UserR\x04user\"#\n" + + "\x11DeleteUserRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\".\n" + + "\x12DeleteUserResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess2\xc6\x02\n" + + "\vUserService\x12?\n" + + "\n" + + "CreateUser\x12\x17.user.CreateUserRequest\x1a\x18.user.CreateUserResponse\x126\n" + + "\aGetUser\x12\x14.user.GetUserRequest\x1a\x15.user.GetUserResponse\x12<\n" + + "\tListUsers\x12\x16.user.ListUsersRequest\x1a\x17.user.ListUsersResponse\x12?\n" + + "\n" + + "UpdateUser\x12\x17.user.UpdateUserRequest\x1a\x18.user.UpdateUserResponse\x12?\n" + + "\n" + + "DeleteUser\x12\x17.user.DeleteUserRequest\x1a\x18.user.DeleteUserResponseB\bZ\x06./userb\x06proto3" + +var ( + file_services_user_svc_user_proto_rawDescOnce sync.Once + file_services_user_svc_user_proto_rawDescData []byte +) + +func file_services_user_svc_user_proto_rawDescGZIP() []byte { + file_services_user_svc_user_proto_rawDescOnce.Do(func() { + file_services_user_svc_user_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_services_user_svc_user_proto_rawDesc), len(file_services_user_svc_user_proto_rawDesc))) + }) + return file_services_user_svc_user_proto_rawDescData +} + +var file_services_user_svc_user_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_services_user_svc_user_proto_goTypes = []any{ + (*User)(nil), // 0: user.User + (*CreateUserRequest)(nil), // 1: user.CreateUserRequest + (*CreateUserResponse)(nil), // 2: user.CreateUserResponse + (*GetUserRequest)(nil), // 3: user.GetUserRequest + (*GetUserResponse)(nil), // 4: user.GetUserResponse + (*ListUsersRequest)(nil), // 5: user.ListUsersRequest + (*ListUsersResponse)(nil), // 6: user.ListUsersResponse + (*UpdateUserRequest)(nil), // 7: user.UpdateUserRequest + (*UpdateUserResponse)(nil), // 8: user.UpdateUserResponse + (*DeleteUserRequest)(nil), // 9: user.DeleteUserRequest + (*DeleteUserResponse)(nil), // 10: user.DeleteUserResponse +} +var file_services_user_svc_user_proto_depIdxs = []int32{ + 0, // 0: user.CreateUserResponse.user:type_name -> user.User + 0, // 1: user.GetUserResponse.user:type_name -> user.User + 0, // 2: user.ListUsersResponse.users:type_name -> user.User + 0, // 3: user.UpdateUserResponse.user:type_name -> user.User + 1, // 4: user.UserService.CreateUser:input_type -> user.CreateUserRequest + 3, // 5: user.UserService.GetUser:input_type -> user.GetUserRequest + 5, // 6: user.UserService.ListUsers:input_type -> user.ListUsersRequest + 7, // 7: user.UserService.UpdateUser:input_type -> user.UpdateUserRequest + 9, // 8: user.UserService.DeleteUser:input_type -> user.DeleteUserRequest + 2, // 9: user.UserService.CreateUser:output_type -> user.CreateUserResponse + 4, // 10: user.UserService.GetUser:output_type -> user.GetUserResponse + 6, // 11: user.UserService.ListUsers:output_type -> user.ListUsersResponse + 8, // 12: user.UserService.UpdateUser:output_type -> user.UpdateUserResponse + 10, // 13: user.UserService.DeleteUser:output_type -> user.DeleteUserResponse + 9, // [9:14] is the sub-list for method output_type + 4, // [4:9] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_services_user_svc_user_proto_init() } +func file_services_user_svc_user_proto_init() { + if File_services_user_svc_user_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_services_user_svc_user_proto_rawDesc), len(file_services_user_svc_user_proto_rawDesc)), + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_services_user_svc_user_proto_goTypes, + DependencyIndexes: file_services_user_svc_user_proto_depIdxs, + MessageInfos: file_services_user_svc_user_proto_msgTypes, + }.Build() + File_services_user_svc_user_proto = out.File + file_services_user_svc_user_proto_goTypes = nil + file_services_user_svc_user_proto_depIdxs = nil +} diff --git a/backend/user/user_grpc.pb.go b/backend/user/user_grpc.pb.go new file mode 100644 index 0000000..34c265e --- /dev/null +++ b/backend/user/user_grpc.pb.go @@ -0,0 +1,273 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc v6.31.1 +// source: services/user-svc/user.proto + +package user + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + UserService_CreateUser_FullMethodName = "/user.UserService/CreateUser" + UserService_GetUser_FullMethodName = "/user.UserService/GetUser" + UserService_ListUsers_FullMethodName = "/user.UserService/ListUsers" + UserService_UpdateUser_FullMethodName = "/user.UserService/UpdateUser" + UserService_DeleteUser_FullMethodName = "/user.UserService/DeleteUser" +) + +// 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 UserServiceClient interface { + CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) + GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) + ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) + UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error) + DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) +} + +type userServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient { + return &userServiceClient{cc} +} + +func (c *userServiceClient) CreateUser(ctx context.Context, in *CreateUserRequest, opts ...grpc.CallOption) (*CreateUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateUserResponse) + err := c.cc.Invoke(ctx, UserService_CreateUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserResponse) + err := c.cc.Invoke(ctx, UserService_GetUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (*ListUsersResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListUsersResponse) + err := c.cc.Invoke(ctx, UserService_ListUsers_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) UpdateUser(ctx context.Context, in *UpdateUserRequest, opts ...grpc.CallOption) (*UpdateUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateUserResponse) + err := c.cc.Invoke(ctx, UserService_UpdateUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *userServiceClient) DeleteUser(ctx context.Context, in *DeleteUserRequest, opts ...grpc.CallOption) (*DeleteUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteUserResponse) + err := c.cc.Invoke(ctx, UserService_DeleteUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// UserServiceServer is the server API for UserService service. +// All implementations must embed UnimplementedUserServiceServer +// for forward compatibility. +type UserServiceServer interface { + CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) + GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) + ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) + UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error) + DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) + mustEmbedUnimplementedUserServiceServer() +} + +// UnimplementedUserServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedUserServiceServer struct{} + +func (UnimplementedUserServiceServer) CreateUser(context.Context, *CreateUserRequest) (*CreateUserResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateUser not implemented") +} +func (UnimplementedUserServiceServer) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetUser not implemented") +} +func (UnimplementedUserServiceServer) ListUsers(context.Context, *ListUsersRequest) (*ListUsersResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListUsers not implemented") +} +func (UnimplementedUserServiceServer) UpdateUser(context.Context, *UpdateUserRequest) (*UpdateUserResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateUser not implemented") +} +func (UnimplementedUserServiceServer) DeleteUser(context.Context, *DeleteUserRequest) (*DeleteUserResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteUser not implemented") +} +func (UnimplementedUserServiceServer) mustEmbedUnimplementedUserServiceServer() {} +func (UnimplementedUserServiceServer) testEmbeddedByValue() {} + +// 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 UnsafeUserServiceServer interface { + mustEmbedUnimplementedUserServiceServer() +} + +func RegisterUserServiceServer(s grpc.ServiceRegistrar, srv UserServiceServer) { + // If the following call panics, it indicates UnimplementedUserServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&UserService_ServiceDesc, srv) +} + +func _UserService_CreateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).CreateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_CreateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).CreateUser(ctx, req.(*CreateUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).GetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_GetUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).GetUser(ctx, req.(*GetUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_ListUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUsersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).ListUsers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_ListUsers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).ListUsers(ctx, req.(*ListUsersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_UpdateUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).UpdateUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_UpdateUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).UpdateUser(ctx, req.(*UpdateUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _UserService_DeleteUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServiceServer).DeleteUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: UserService_DeleteUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServiceServer).DeleteUser(ctx, req.(*DeleteUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// 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) +var UserService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "user.UserService", + HandlerType: (*UserServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateUser", + Handler: _UserService_CreateUser_Handler, + }, + { + MethodName: "GetUser", + Handler: _UserService_GetUser_Handler, + }, + { + MethodName: "ListUsers", + Handler: _UserService_ListUsers_Handler, + }, + { + MethodName: "UpdateUser", + Handler: _UserService_UpdateUser_Handler, + }, + { + MethodName: "DeleteUser", + Handler: _UserService_DeleteUser_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "services/user-svc/user.proto", +}