aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorAdam Mathes <adam@trenchant.org>2017-02-02 19:42:48 -0800
committerAdam Mathes <adam@trenchant.org>2017-02-02 19:42:48 -0800
commitdee417318bbed4cd14e21ec069ed5bc8d84df33b (patch)
tree4b87843f6c66148ea9fdb1ab44c1df234a04e233 /models
parent8ad7e867b96df3336c4fea8840297553125cc1d1 (diff)
downloadneko-dee417318bbed4cd14e21ec069ed5bc8d84df33b.tar.gz
neko-dee417318bbed4cd14e21ec069ed5bc8d84df33b.tar.bz2
neko-dee417318bbed4cd14e21ec069ed5bc8d84df33b.zip
slightly better handling of dates
Diffstat (limited to 'models')
-rw-r--r--models/item/item.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/models/item/item.go b/models/item/item.go
index 3cf8a19..da613ee 100644
--- a/models/item/item.go
+++ b/models/item/item.go
@@ -10,15 +10,18 @@ import (
type Item struct {
Id int64 `json:"_id,string,omitempty"`
+
Title string `json:"title"`
Url string `json:"url"`
Description string `json:"description"`
- ReadState bool `json:"read"`
- Starred bool `json:"starred"`
- FeedId int64
PublishDate string `json:"publish_date"`
+
+ FeedId int64
FeedTitle string `json:"feed_title"`
FeedUrl string `json:"feed_url"`
+
+ ReadState bool `json:"read"`
+ Starred bool `json:"starred"`
}
func (i *Item) Print() {
@@ -29,8 +32,8 @@ func (i *Item) Print() {
func (i *Item) Create() error {
res, err := models.DB.Exec(`INSERT INTO
- item(title, url, description, feed_id)
- VALUES(?, ?, ?, ?)`, i.Title, i.Url, i.Description, i.FeedId)
+ item(title, url, description, publish_date, feed_id)
+ VALUES(?, ?, ?, ?, ?)`, i.Title, i.Url, i.Description, i.PublishDate, i.FeedId)
if err != nil {
return err
}