From 5f40b4b394d1e768d59cf33ec507451ec45accc5 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 29 Feb 2024 12:47:23 +0100 Subject: Small refactoring --- internal/feed/item.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'internal/feed/item.go') 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{} } -- cgit v1.2.3-70-g09d2