diff --git a/images/service.go b/images/service.go index 3a6356d0f8bbcfe6b928b144bc6074cee410ff3e..076bfc3afe1d49d8f241f44c0ceac39124feb90e 100644 --- a/images/service.go +++ b/images/service.go @@ -26,9 +26,9 @@ type GetOptions struct { } type Command struct { - CropCommand *CropCommand - FitCommand *FitCommand - ResizeCommand *ResizeCommand + Crop *CropCommand + Fit *FitCommand + Resize *ResizeCommand } type CropCommand struct { diff --git a/images/transport/grpc/protobuf_type_converters.microgen.go b/images/transport/grpc/protobuf_type_converters.microgen.go index 9072d866b658b1d6e66ccb37e7c78b204e487246..22ce821d34d0c6aad02cd5314d218bc614272447 100644 --- a/images/transport/grpc/protobuf_type_converters.microgen.go +++ b/images/transport/grpc/protobuf_type_converters.microgen.go @@ -88,19 +88,31 @@ func ProtoToPtrGetOptions(protoOpts *pbimage.GetRequest_GetOptions) (*service.Ge } func ProtoCommandToPtr(cmd *pbimage.Command) *service.Command { + if cmd == nil { + return nil + } switch cmd.GetCommandType().(type) { case *pbimage.Command_Crop: - return &service.Command{CropCommand: ProtoCropCommandToPtr(cmd.GetCrop())} + return &service.Command{ + Crop: ProtoCropCommandToPtr(cmd.GetCrop()), + } case *pbimage.Command_Fit: - return &service.Command{FitCommand: ProtoFitCommandToPtr(cmd.GetFit())} + return &service.Command{ + Fit: ProtoFitCommandToPtr(cmd.GetFit()), + } case *pbimage.Command_Resize: - return &service.Command{ResizeCommand: ProtoResizeCommandToPtr(cmd.GetResize())} + return &service.Command{ + Resize: ProtoResizeCommandToPtr(cmd.GetResize()), + } default: return nil } } func ProtoCropCommandToPtr(cmd *pbimage.CropCommand) *service.CropCommand { + if cmd == nil { + return nil + } return &service.CropCommand{ Width: int(cmd.Width), Height: int(cmd.Height), @@ -109,6 +121,9 @@ func ProtoCropCommandToPtr(cmd *pbimage.CropCommand) *service.CropCommand { } func ProtoFitCommandToPtr(cmd *pbimage.FitCommand) *service.FitCommand { + if cmd == nil { + return nil + } return &service.FitCommand{ Width: int(cmd.Width), Height: int(cmd.Height), @@ -117,6 +132,9 @@ func ProtoFitCommandToPtr(cmd *pbimage.FitCommand) *service.FitCommand { } func ProtoResizeCommandToPtr(cmd *pbimage.ResizeCommand) *service.ResizeCommand { + if cmd == nil { + return nil + } return &service.ResizeCommand{ Width: int(cmd.Width), Height: int(cmd.Height), @@ -125,23 +143,26 @@ func ProtoResizeCommandToPtr(cmd *pbimage.ResizeCommand) *service.ResizeCommand } func PtrCommandToProto(cmd *service.Command) *pbimage.Command { + if cmd == nil { + return nil + } switch { - case cmd.CropCommand != nil: + case cmd.Crop != nil: return &pbimage.Command{ CommandType: &pbimage.Command_Crop{ - Crop: PtrCropCommandToProto(cmd.CropCommand), + Crop: PtrCropCommandToProto(cmd.Crop), }, } - case cmd.FitCommand != nil: + case cmd.Fit != nil: return &pbimage.Command{ CommandType: &pbimage.Command_Fit{ - Fit: PtrFitCommandToProto(cmd.FitCommand), + Fit: PtrFitCommandToProto(cmd.Fit), }, } - case cmd.ResizeCommand != nil: + case cmd.Resize != nil: return &pbimage.Command{ CommandType: &pbimage.Command_Resize{ - Resize: PtrResizeCommandToProto(cmd.ResizeCommand), + Resize: PtrResizeCommandToProto(cmd.Resize), }, } default: @@ -150,6 +171,9 @@ func PtrCommandToProto(cmd *service.Command) *pbimage.Command { } func PtrCropCommandToProto(cmd *service.CropCommand) *pbimage.CropCommand { + if cmd == nil { + return nil + } return &pbimage.CropCommand{ Width: int64(cmd.Width), Height: int64(cmd.Height), @@ -158,6 +182,9 @@ func PtrCropCommandToProto(cmd *service.CropCommand) *pbimage.CropCommand { } func PtrFitCommandToProto(cmd *service.FitCommand) *pbimage.FitCommand { + if cmd == nil { + return nil + } return &pbimage.FitCommand{ Width: int64(cmd.Width), Height: int64(cmd.Height), @@ -166,6 +193,9 @@ func PtrFitCommandToProto(cmd *service.FitCommand) *pbimage.FitCommand { } func PtrResizeCommandToProto(cmd *service.ResizeCommand) *pbimage.ResizeCommand { + if cmd == nil { + return nil + } return &pbimage.ResizeCommand{ Width: int64(cmd.Width), Height: int64(cmd.Height), diff --git a/proto/images/images.pb.go b/proto/images/images.pb.go index 4606ba94ccc5798078be0043057953bfcf2cae79..d50077d4d131381509f095c50957670312fe9eb0 100644 --- a/proto/images/images.pb.go +++ b/proto/images/images.pb.go @@ -56,7 +56,7 @@ func (x *CropCommand) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CropCommand.ProtoReflect.Descriptor instead. +// Deprecated: Use Crop.ProtoReflect.Descriptor instead. func (*CropCommand) Descriptor() ([]byte, []int) { return file_images_images_proto_rawDescGZIP(), []int{0} } @@ -117,7 +117,7 @@ func (x *FitCommand) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use FitCommand.ProtoReflect.Descriptor instead. +// Deprecated: Use Fit.ProtoReflect.Descriptor instead. func (*FitCommand) Descriptor() ([]byte, []int) { return file_images_images_proto_rawDescGZIP(), []int{1} } @@ -178,7 +178,7 @@ func (x *ResizeCommand) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ResizeCommand.ProtoReflect.Descriptor instead. +// Deprecated: Use Resize.ProtoReflect.Descriptor instead. func (*ResizeCommand) Descriptor() ([]byte, []int) { return file_images_images_proto_rawDescGZIP(), []int{2} } @@ -579,9 +579,9 @@ func file_images_images_proto_rawDescGZIP() []byte { var file_images_images_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_images_images_proto_goTypes = []any{ - (*CropCommand)(nil), // 0: images.CropCommand - (*FitCommand)(nil), // 1: images.FitCommand - (*ResizeCommand)(nil), // 2: images.ResizeCommand + (*CropCommand)(nil), // 0: images.Crop + (*FitCommand)(nil), // 1: images.Fit + (*ResizeCommand)(nil), // 2: images.Resize (*Command)(nil), // 3: images.Command (*GetRequest)(nil), // 4: images.GetRequest (*GetResponse)(nil), // 5: images.GetResponse @@ -589,9 +589,9 @@ var file_images_images_proto_goTypes = []any{ (*files.File)(nil), // 7: files.File } var file_images_images_proto_depIdxs = []int32{ - 0, // 0: images.Command.crop:type_name -> images.CropCommand - 1, // 1: images.Command.fit:type_name -> images.FitCommand - 2, // 2: images.Command.resize:type_name -> images.ResizeCommand + 0, // 0: images.Command.crop:type_name -> images.Crop + 1, // 1: images.Command.fit:type_name -> images.Fit + 2, // 2: images.Command.resize:type_name -> images.Resize 7, // 3: images.GetRequest.source:type_name -> files.File 6, // 4: images.GetRequest.opts:type_name -> images.GetRequest.GetOptions 7, // 5: images.GetResponse.result:type_name -> files.File