diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2024-02-29 12:47:23 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2024-05-12 23:10:36 +0200 |
commit | 5f40b4b394d1e768d59cf33ec507451ec45accc5 (patch) | |
tree | dbb1a04364d3d4b2cef4f726b361c25bf2921b0b /internal/feed/item.go | |
parent | 503fa62794ccca8e27cde99f3fbabf41adad5f3f (diff) | |
download | feed2imap-go-5f40b4b394d1e768d59cf33ec507451ec45accc5.tar.gz feed2imap-go-5f40b4b394d1e768d59cf33ec507451ec45accc5.tar.bz2 feed2imap-go-5f40b4b394d1e768d59cf33ec507451ec45accc5.zip |
Small refactoring
Diffstat (limited to '')
-rw-r--r-- | internal/feed/item.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/feed/item.go b/internal/feed/item.go index bc1865a..4482a5c 100644 --- a/internal/feed/item.go +++ b/internal/feed/item.go @@ -20,6 +20,12 @@ type feedImage struct { name string } +type ItemID uuid.UUID + +func newItemID() ItemID { + return ItemID(uuid.New()) +} + type Item struct { *gofeed.Item // access fields implicitly Feed *gofeed.Feed // named explicitly to not shadow common fields with Item @@ -27,9 +33,9 @@ type Item struct { Body string TextBody string UpdateOnly bool + ID ItemID reasons []string images []feedImage - ID uuid.UUID } func (item *Item) DateParsed() *time.Time { @@ -77,6 +83,7 @@ func (item *Item) addImage(img []byte, mime string, name string) int { } func (item *Item) clearImages() { + clear(item.images) item.images = []feedImage{} } |