change IIdentifiable interface to use a string instead of int

This commit is contained in:
2024-12-29 01:05:04 +01:00
parent b47b6d51b2
commit e3fcd62159
4 changed files with 10 additions and 17 deletions

View File

@@ -8,7 +8,6 @@ import (
// TODO docstring
type Article struct {
Identifier uint
SourceUrl string
PublishDate time.Time
FetchDate time.Time
@@ -21,7 +20,6 @@ type Article struct {
// Generates a hash based on the source url of the article. Can be used to
// identify the article.
func (article *Article) Hash() string {
hash := sha256.Sum256([]byte(article.SourceUrl))
return hex.EncodeToString(hash[:])
}
@@ -30,6 +28,6 @@ func (article *Article) Hash() string {
// --- implement IIdentifiable interface ---
// Using the Identifier attribute as the Id.
func (article *Article) Id() uint {
return article.Identifier
func (article *Article) Id() string {
return article.Hash()
}