diff --git a/rss/handler/crawl.go b/rss/handler/crawl.go index 5d15b27..1a9b88d 100644 --- a/rss/handler/crawl.go +++ b/rss/handler/crawl.go @@ -90,7 +90,7 @@ func (e *Rss) fetch(f *pb.Feed) error { Feed: f.Url, Link: item.Link, Content: content, - Date: item.Date.Unix(), + Date: item.Date.Format(time.RFC3339Nano), }) if err != nil { return fmt.Errorf("Error saving item: %v", err) diff --git a/rss/proto/rss.pb.go b/rss/proto/rss.pb.go index 2469742..457334b 100644 --- a/rss/proto/rss.pb.go +++ b/rss/proto/rss.pb.go @@ -115,7 +115,7 @@ type Entry struct { // article content Content string `protobuf:"bytes,6,opt,name=content,proto3" json:"content,omitempty"` // data of the entry - Date int64 `protobuf:"varint,7,opt,name=date,proto3" json:"date,omitempty"` + Date string `protobuf:"bytes,7,opt,name=date,proto3" json:"date,omitempty"` } func (x *Entry) Reset() { @@ -192,11 +192,11 @@ func (x *Entry) GetContent() string { return "" } -func (x *Entry) GetDate() int64 { +func (x *Entry) GetDate() string { if x != nil { return x.Date } - return 0 + return "" } type AddRequest struct { @@ -591,7 +591,7 @@ var file_proto_rss_proto_rawDesc = []byte{ 0x61, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x64, 0x61, 0x74, 0x65, + 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x65, 0x22, 0x4e, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, diff --git a/rss/proto/rss.proto b/rss/proto/rss.proto index eef8ba7..c2bb5a5 100644 --- a/rss/proto/rss.proto +++ b/rss/proto/rss.proto @@ -38,7 +38,7 @@ message Entry { // article content string content = 6; // data of the entry - int64 date = 7; + string date = 7; } message AddRequest {