diff --git a/hw12_13_14_15_calendar/Makefile b/hw12_13_14_15_calendar/Makefile index 84c3ed7..b5cd668 100644 --- a/hw12_13_14_15_calendar/Makefile +++ b/hw12_13_14_15_calendar/Makefile @@ -16,6 +16,6 @@ install-lint-deps: (which golangci-lint > /dev/null) || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.30.0 generate: - protoc -I ./grpc --go_out=plugins=grpc:./internal/grpc --grpc-gateway_out=logtostderr=true:./internal/grpc ./grpc/grpc.proto + protoc -I ./grpcserver --go_out=plugins=grpc:./internal/grpcserver --grpc-gateway_out=logtostderr=true:./internal/grpcserver ./grpcserver/grpcserver.proto .PHONY: build run test lint \ No newline at end of file diff --git a/hw12_13_14_15_calendar/cmd/calendar/main.go b/hw12_13_14_15_calendar/cmd/calendar/main.go index f206138..30e8acf 100644 --- a/hw12_13_14_15_calendar/cmd/calendar/main.go +++ b/hw12_13_14_15_calendar/cmd/calendar/main.go @@ -9,7 +9,7 @@ import ( _ "github.com/go-sql-driver/mysql" "github.com/tiburon-777/HW_OTUS/hw12_13_14_15_calendar/internal/app" "github.com/tiburon-777/HW_OTUS/hw12_13_14_15_calendar/internal/config" - "github.com/tiburon-777/HW_OTUS/hw12_13_14_15_calendar/internal/grpc" + "github.com/tiburon-777/HW_OTUS/hw12_13_14_15_calendar/internal/grpcserver" "github.com/tiburon-777/HW_OTUS/hw12_13_14_15_calendar/internal/logger" internalhttp "github.com/tiburon-777/HW_OTUS/hw12_13_14_15_calendar/internal/server/http" store "github.com/tiburon-777/HW_OTUS/hw12_13_14_15_calendar/internal/storage" @@ -51,7 +51,7 @@ func main() { } }() - serverGRPC := grpc.New(calendar) + serverGRPC := grpcserver.New(calendar) go func() { if err := serverGRPC.Start(conf); err != nil { log.Errorf("failed to start grpc server: " + err.Error()) diff --git a/hw12_13_14_15_calendar/grpc/google/api/annotations.proto b/hw12_13_14_15_calendar/grpcserver/google/api/annotations.proto similarity index 100% rename from hw12_13_14_15_calendar/grpc/google/api/annotations.proto rename to hw12_13_14_15_calendar/grpcserver/google/api/annotations.proto diff --git a/hw12_13_14_15_calendar/grpc/google/api/http.proto b/hw12_13_14_15_calendar/grpcserver/google/api/http.proto similarity index 100% rename from hw12_13_14_15_calendar/grpc/google/api/http.proto rename to hw12_13_14_15_calendar/grpcserver/google/api/http.proto diff --git a/hw12_13_14_15_calendar/grpc/google/api/httpbody.proto b/hw12_13_14_15_calendar/grpcserver/google/api/httpbody.proto similarity index 100% rename from hw12_13_14_15_calendar/grpc/google/api/httpbody.proto rename to hw12_13_14_15_calendar/grpcserver/google/api/httpbody.proto diff --git a/hw12_13_14_15_calendar/grpc/grpc.proto b/hw12_13_14_15_calendar/grpcserver/grpcserver.proto similarity index 96% rename from hw12_13_14_15_calendar/grpc/grpc.proto rename to hw12_13_14_15_calendar/grpcserver/grpcserver.proto index cafcb6b..cd40793 100644 --- a/hw12_13_14_15_calendar/grpc/grpc.proto +++ b/hw12_13_14_15_calendar/grpcserver/grpcserver.proto @@ -1,5 +1,8 @@ syntax = "proto3"; +package grpcserver; + +option go_package = "grpcserver"; import "google/protobuf/timestamp.proto"; import "google/protobuf/duration.proto"; diff --git a/hw12_13_14_15_calendar/internal/grpc/converters.go b/hw12_13_14_15_calendar/internal/grpcserver/converters.go similarity index 98% rename from hw12_13_14_15_calendar/internal/grpc/converters.go rename to hw12_13_14_15_calendar/internal/grpcserver/converters.go index 8e424e7..1b2ea7c 100644 --- a/hw12_13_14_15_calendar/internal/grpc/converters.go +++ b/hw12_13_14_15_calendar/internal/grpcserver/converters.go @@ -1,4 +1,4 @@ -package grpc +package grpcserver import ( "time" diff --git a/hw12_13_14_15_calendar/internal/grpc/grpc.pb.go b/hw12_13_14_15_calendar/internal/grpcserver/grpcserver.pb.go similarity index 76% rename from hw12_13_14_15_calendar/internal/grpc/grpc.pb.go rename to hw12_13_14_15_calendar/internal/grpcserver/grpcserver.pb.go index 967c203..913c7d7 100644 --- a/hw12_13_14_15_calendar/internal/grpc/grpc.pb.go +++ b/hw12_13_14_15_calendar/internal/grpcserver/grpcserver.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: grpc.proto +// source: grpcserver.proto -package grpc +package grpcserver import ( context "context" @@ -53,7 +53,7 @@ func (x QueryRange) String() string { } func (QueryRange) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_bedfbfc9b54e5600, []int{0} + return fileDescriptor_afa6debe97205904, []int{0} } type Event struct { @@ -73,7 +73,7 @@ func (m *Event) Reset() { *m = Event{} } func (m *Event) String() string { return proto.CompactTextString(m) } func (*Event) ProtoMessage() {} func (*Event) Descriptor() ([]byte, []int) { - return fileDescriptor_bedfbfc9b54e5600, []int{0} + return fileDescriptor_afa6debe97205904, []int{0} } func (m *Event) XXX_Unmarshal(b []byte) error { @@ -154,7 +154,7 @@ func (m *EventList) Reset() { *m = EventList{} } func (m *EventList) String() string { return proto.CompactTextString(m) } func (*EventList) ProtoMessage() {} func (*EventList) Descriptor() ([]byte, []int) { - return fileDescriptor_bedfbfc9b54e5600, []int{1} + return fileDescriptor_afa6debe97205904, []int{1} } func (m *EventList) XXX_Unmarshal(b []byte) error { @@ -193,7 +193,7 @@ func (m *EventID) Reset() { *m = EventID{} } func (m *EventID) String() string { return proto.CompactTextString(m) } func (*EventID) ProtoMessage() {} func (*EventID) Descriptor() ([]byte, []int) { - return fileDescriptor_bedfbfc9b54e5600, []int{2} + return fileDescriptor_afa6debe97205904, []int{2} } func (m *EventID) XXX_Unmarshal(b []byte) error { @@ -233,7 +233,7 @@ func (m *EventWthID) Reset() { *m = EventWthID{} } func (m *EventWthID) String() string { return proto.CompactTextString(m) } func (*EventWthID) ProtoMessage() {} func (*EventWthID) Descriptor() ([]byte, []int) { - return fileDescriptor_bedfbfc9b54e5600, []int{3} + return fileDescriptor_afa6debe97205904, []int{3} } func (m *EventWthID) XXX_Unmarshal(b []byte) error { @@ -270,7 +270,7 @@ func (m *EventWthID) GetEvent() *Event { type Date struct { Date *timestamp.Timestamp `protobuf:"bytes,1,opt,name=Date,proto3" json:"Date,omitempty"` - Range QueryRange `protobuf:"varint,2,opt,name=Range,proto3,enum=QueryRange" json:"Range,omitempty"` + Range QueryRange `protobuf:"varint,2,opt,name=Range,proto3,enum=grpcserver.QueryRange" json:"Range,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -280,7 +280,7 @@ func (m *Date) Reset() { *m = Date{} } func (m *Date) String() string { return proto.CompactTextString(m) } func (*Date) ProtoMessage() {} func (*Date) Descriptor() ([]byte, []int) { - return fileDescriptor_bedfbfc9b54e5600, []int{4} + return fileDescriptor_afa6debe97205904, []int{4} } func (m *Date) XXX_Unmarshal(b []byte) error { @@ -316,51 +316,53 @@ func (m *Date) GetRange() QueryRange { } func init() { - proto.RegisterEnum("QueryRange", QueryRange_name, QueryRange_value) - proto.RegisterType((*Event)(nil), "Event") - proto.RegisterType((*EventList)(nil), "EventList") - proto.RegisterType((*EventID)(nil), "EventID") - proto.RegisterType((*EventWthID)(nil), "EventWthID") - proto.RegisterType((*Date)(nil), "Date") + proto.RegisterEnum("grpcserver.QueryRange", QueryRange_name, QueryRange_value) + proto.RegisterType((*Event)(nil), "grpcserver.Event") + proto.RegisterType((*EventList)(nil), "grpcserver.EventList") + proto.RegisterType((*EventID)(nil), "grpcserver.EventID") + proto.RegisterType((*EventWthID)(nil), "grpcserver.EventWthID") + proto.RegisterType((*Date)(nil), "grpcserver.Date") } -func init() { proto.RegisterFile("grpc.proto", fileDescriptor_bedfbfc9b54e5600) } +func init() { proto.RegisterFile("grpcserver.proto", fileDescriptor_afa6debe97205904) } -var fileDescriptor_bedfbfc9b54e5600 = []byte{ - // 519 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0xad, 0x1d, 0xff, 0x24, 0x37, 0xfa, 0xf2, 0x85, 0x2b, 0x54, 0x5c, 0x53, 0x95, 0xe0, 0x0d, - 0x51, 0x90, 0xc6, 0x52, 0xba, 0x40, 0xcd, 0x06, 0x01, 0x13, 0x81, 0x45, 0x09, 0xc2, 0x4a, 0x55, - 0x75, 0xe9, 0xb6, 0xd3, 0x60, 0x29, 0xb1, 0x2d, 0x67, 0x82, 0x14, 0x45, 0xd9, 0xf0, 0x0a, 0xbc, - 0x18, 0x12, 0xaf, 0xc0, 0x4b, 0xb0, 0x43, 0xbe, 0x9e, 0xfc, 0x90, 0xa8, 0x82, 0x95, 0x7d, 0xef, - 0x39, 0x67, 0xce, 0xbd, 0x67, 0x06, 0x60, 0x94, 0x67, 0x37, 0x2c, 0xcb, 0x53, 0x99, 0xba, 0x4f, - 0x46, 0x69, 0x3a, 0x1a, 0x0b, 0x9f, 0xaa, 0xeb, 0xd9, 0x9d, 0x2f, 0xe3, 0x89, 0x98, 0xca, 0x68, - 0x92, 0x29, 0xc2, 0xc9, 0x2e, 0xe1, 0x76, 0x96, 0x47, 0x32, 0x4e, 0x13, 0x85, 0x3f, 0xde, 0xc5, - 0xc5, 0x24, 0x93, 0x73, 0x05, 0x1e, 0x2b, 0x30, 0xca, 0x62, 0x3f, 0x4a, 0x92, 0x54, 0x92, 0x72, - 0x5a, 0xa2, 0xde, 0x2f, 0x0d, 0xcc, 0xfe, 0x17, 0x91, 0x48, 0x6c, 0x80, 0x1e, 0x70, 0x47, 0x6b, - 0x69, 0xed, 0x4a, 0xa8, 0x07, 0x1c, 0x1f, 0x82, 0x39, 0x8c, 0xe5, 0x58, 0x38, 0x7a, 0x4b, 0x6b, - 0xd7, 0xc2, 0xb2, 0x40, 0x06, 0x06, 0x8f, 0xa4, 0x70, 0x2a, 0x2d, 0xad, 0x5d, 0xef, 0xba, 0xac, - 0x3c, 0x9c, 0xad, 0x9c, 0xd9, 0x70, 0x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 0xb5, 0xb7, - 0x57, 0xff, 0xfa, 0xe3, 0xe7, 0x37, 0xdd, 0xf4, 0x0e, 0x7a, 0x5a, 0x07, 0x5f, 0x82, 0x75, 0x91, - 0xdd, 0x16, 0xc4, 0x3a, 0xdb, 0x6c, 0xef, 0x1e, 0xee, 0x4d, 0xde, 0x2f, 0xde, 0xa2, 0xd7, 0x24, - 0x2d, 0xb8, 0xa6, 0xbf, 0x08, 0xf8, 0xb2, 0x38, 0xe0, 0x0c, 0x2c, 0x2e, 0xc6, 0x42, 0x0a, 0x5c, - 0x3b, 0xdc, 0xab, 0xfe, 0x8f, 0xd4, 0x76, 0xa7, 0x54, 0x63, 0x0f, 0x0c, 0xba, 0xb3, 0x7b, 0xe8, - 0x2e, 0xb0, 0xf5, 0xbd, 0x7a, 0x0d, 0x92, 0x56, 0xd1, 0xf2, 0x05, 0x3d, 0x73, 0x06, 0xf6, 0x5b, - 0x21, 0x5f, 0xcf, 0x03, 0xbe, 0xe5, 0xbb, 0x2d, 0x50, 0x5e, 0xa8, 0xbc, 0x5e, 0x40, 0x8d, 0xf8, - 0x94, 0xba, 0xc9, 0x8a, 0xcf, 0x1f, 0xf4, 0x47, 0x44, 0x7f, 0x80, 0xff, 0xfb, 0x8b, 0x02, 0x5b, - 0xfa, 0x0b, 0xca, 0x7b, 0x79, 0x6d, 0xd1, 0x50, 0xa7, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xa5, - 0xa3, 0x2a, 0x4c, 0xea, 0x03, 0x00, 0x00, +var fileDescriptor_afa6debe97205904 = []byte{ + // 546 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xdd, 0x8a, 0xd3, 0x5c, + 0x14, 0x9d, 0xb4, 0xf9, 0x99, 0xee, 0x7e, 0x5f, 0xcd, 0x6c, 0xb5, 0x66, 0xa2, 0x68, 0xc9, 0x8d, + 0xb5, 0x48, 0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0xcd, 0xaf, 0x3f, 0x7e, 0x7e, 0xab, 0x29, 0xd6, 0xde, 0x0b, 0xa9, 0x87, 0xef, 0x40, 0x3d, 0x4b, + 0x46, 0x79, 0x7a, 0xbb, 0xc2, 0xa5, 0xa1, 0x99, 0xed, 0x4a, 0x97, 0x6e, 0xfe, 0x9a, 0x2d, 0x9d, + 0x64, 0xc0, 0x54, 0x9c, 0x85, 0xc7, 0x96, 0xb9, 0x16, 0x03, 0x95, 0xf1, 0x09, 0x17, 0x1c, 0xb7, + 0xf9, 0xee, 0x14, 0xfa, 0x9f, 0x84, 0xb4, 0x5e, 0x21, 0x84, 0x2e, 0xc8, 0xf4, 0x00, 0x76, 0xd0, + 0xcd, 0xbb, 0x15, 0xed, 0x9c, 0x6e, 0xb5, 0x48, 0x65, 0x1f, 0x55, 0x87, 0xd3, 0xe7, 0xc3, 0x40, + 0x7b, 0xc3, 0xc5, 0xf1, 0xdc, 0x63, 0xdb, 0xab, 0xd9, 0x21, 0x53, 0x16, 0x83, 0x65, 0x31, 0xa7, + 0xd0, 0x20, 0x15, 0xda, 0xa6, 0xbe, 0x9e, 0x92, 0x47, 0x76, 0x89, 0xdc, 0x23, 0x91, 0x03, 0xbc, + 0xe5, 0x2c, 0x72, 0xda, 0xd2, 0x59, 0xd0, 0x4a, 0x97, 0xc7, 0xff, 0x7d, 0x5e, 0xfb, 0xcf, 0x5c, + 0xa8, 0xd4, 0xd9, 0xd1, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x78, 0x0d, 0x16, 0xbf, 0x8e, 0x04, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -393,7 +395,7 @@ func NewGrpcClient(cc *grpc.ClientConn) GrpcClient { func (c *grpcClient) Create(ctx context.Context, in *Event, opts ...grpc.CallOption) (*EventID, error) { out := new(EventID) - err := c.cc.Invoke(ctx, "/grpc/Create", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpcserver.grpc/Create", in, out, opts...) if err != nil { return nil, err } @@ -402,7 +404,7 @@ func (c *grpcClient) Create(ctx context.Context, in *Event, opts ...grpc.CallOpt func (c *grpcClient) Update(ctx context.Context, in *EventWthID, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc/Update", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpcserver.grpc/Update", in, out, opts...) if err != nil { return nil, err } @@ -411,7 +413,7 @@ func (c *grpcClient) Update(ctx context.Context, in *EventWthID, opts ...grpc.Ca func (c *grpcClient) Delete(ctx context.Context, in *EventID, opts ...grpc.CallOption) (*empty.Empty, error) { out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/grpc/Delete", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpcserver.grpc/Delete", in, out, opts...) if err != nil { return nil, err } @@ -420,7 +422,7 @@ func (c *grpcClient) Delete(ctx context.Context, in *EventID, opts ...grpc.CallO func (c *grpcClient) List(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*EventList, error) { out := new(EventList) - err := c.cc.Invoke(ctx, "/grpc/List", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpcserver.grpc/List", in, out, opts...) if err != nil { return nil, err } @@ -429,7 +431,7 @@ func (c *grpcClient) List(ctx context.Context, in *empty.Empty, opts ...grpc.Cal func (c *grpcClient) GetByID(ctx context.Context, in *EventID, opts ...grpc.CallOption) (*EventList, error) { out := new(EventList) - err := c.cc.Invoke(ctx, "/grpc/GetByID", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpcserver.grpc/GetByID", in, out, opts...) if err != nil { return nil, err } @@ -438,7 +440,7 @@ func (c *grpcClient) GetByID(ctx context.Context, in *EventID, opts ...grpc.Call func (c *grpcClient) GetByDate(ctx context.Context, in *Date, opts ...grpc.CallOption) (*EventList, error) { out := new(EventList) - err := c.cc.Invoke(ctx, "/grpc/GetByDate", in, out, opts...) + err := c.cc.Invoke(ctx, "/grpcserver.grpc/GetByDate", in, out, opts...) if err != nil { return nil, err } @@ -492,7 +494,7 @@ func _Grpc_Create_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc/Create", + FullMethod: "/grpcserver.grpc/Create", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GrpcServer).Create(ctx, req.(*Event)) @@ -510,7 +512,7 @@ func _Grpc_Update_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc/Update", + FullMethod: "/grpcserver.grpc/Update", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GrpcServer).Update(ctx, req.(*EventWthID)) @@ -528,7 +530,7 @@ func _Grpc_Delete_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc/Delete", + FullMethod: "/grpcserver.grpc/Delete", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GrpcServer).Delete(ctx, req.(*EventID)) @@ -546,7 +548,7 @@ func _Grpc_List_Handler(srv interface{}, ctx context.Context, dec func(interface } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc/List", + FullMethod: "/grpcserver.grpc/List", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GrpcServer).List(ctx, req.(*empty.Empty)) @@ -564,7 +566,7 @@ func _Grpc_GetByID_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc/GetByID", + FullMethod: "/grpcserver.grpc/GetByID", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GrpcServer).GetByID(ctx, req.(*EventID)) @@ -582,7 +584,7 @@ func _Grpc_GetByDate_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/grpc/GetByDate", + FullMethod: "/grpcserver.grpc/GetByDate", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GrpcServer).GetByDate(ctx, req.(*Date)) @@ -591,7 +593,7 @@ func _Grpc_GetByDate_Handler(srv interface{}, ctx context.Context, dec func(inte } var _Grpc_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc", + ServiceName: "grpcserver.grpc", HandlerType: (*GrpcServer)(nil), Methods: []grpc.MethodDesc{ { @@ -620,5 +622,5 @@ var _Grpc_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "grpc.proto", + Metadata: "grpcserver.proto", } diff --git a/hw12_13_14_15_calendar/internal/grpc/grpc.pb.gw.go b/hw12_13_14_15_calendar/internal/grpcserver/grpcserver.pb.gw.go similarity index 99% rename from hw12_13_14_15_calendar/internal/grpc/grpc.pb.gw.go rename to hw12_13_14_15_calendar/internal/grpcserver/grpcserver.pb.gw.go index c809891..2ad6b6b 100644 --- a/hw12_13_14_15_calendar/internal/grpc/grpc.pb.gw.go +++ b/hw12_13_14_15_calendar/internal/grpcserver/grpcserver.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: grpc.proto +// source: grpcserver.proto /* -Package grpc is a reverse proxy. +Package grpcserver is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package grpc +package grpcserver import ( "io" diff --git a/hw12_13_14_15_calendar/internal/grpc/handlers.go b/hw12_13_14_15_calendar/internal/grpcserver/handlers.go similarity index 94% rename from hw12_13_14_15_calendar/internal/grpc/handlers.go rename to hw12_13_14_15_calendar/internal/grpcserver/handlers.go index 11509bc..01706a1 100644 --- a/hw12_13_14_15_calendar/internal/grpc/handlers.go +++ b/hw12_13_14_15_calendar/internal/grpcserver/handlers.go @@ -1,4 +1,4 @@ -package grpc +package grpcserver import ( "context" @@ -35,12 +35,10 @@ func (s Service) Update(ctx context.Context, e *EventWthID) (*empty.Empty, error return nil, s.App.Storage.Update(cid, ce) } -// TODO: Implement func (s Service) Delete(ctx context.Context, e *EventID) (*empty.Empty, error) { return nil, s.App.Storage.Delete(event.ID(e.ID)) } -// TODO: Implement func (s Service) List(ctx context.Context, e *empty.Empty) (*EventList, error) { tmp, err := s.App.Storage.List() if err != nil { @@ -49,7 +47,6 @@ func (s Service) List(ctx context.Context, e *empty.Empty) (*EventList, error) { return evtMap2pbEventList(tmp) } -// TODO: Implement func (s Service) GetByID(ctx context.Context, e *EventID) (*EventList, error) { tmp, ok := s.App.Storage.GetByID(event.ID(e.ID)) if !ok { @@ -58,7 +55,6 @@ func (s Service) GetByID(ctx context.Context, e *EventID) (*EventList, error) { return evtMap2pbEventList(map[event.ID]event.Event{event.ID(e.ID): tmp}) } -// TODO: Implement func (s Service) GetByDate(ctx context.Context, e *Date) (*EventList, error) { d, r, err := pbDate2Time(e) if err != nil { diff --git a/hw12_13_14_15_calendar/internal/grpc/server.go b/hw12_13_14_15_calendar/internal/grpcserver/server.go similarity index 97% rename from hw12_13_14_15_calendar/internal/grpc/server.go rename to hw12_13_14_15_calendar/internal/grpcserver/server.go index 1076a1f..a3fedab 100644 --- a/hw12_13_14_15_calendar/internal/grpc/server.go +++ b/hw12_13_14_15_calendar/internal/grpcserver/server.go @@ -1,4 +1,4 @@ -package grpc +package grpcserver import ( "net"