adding basic data storage
This commit is contained in:
@@ -6,15 +6,16 @@ import (
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
|
||||
type Article struct {
|
||||
SourceUrl string
|
||||
PublishDate time.Time
|
||||
FetchDate time.Time
|
||||
Title string
|
||||
Content string
|
||||
Identifier uint
|
||||
SourceUrl string
|
||||
PublishDate time.Time
|
||||
FetchDate time.Time
|
||||
Title string
|
||||
Content string
|
||||
}
|
||||
|
||||
|
||||
func (article *Article) Hash() string {
|
||||
/* Generates a hash based on the source url of the article. Can be used to
|
||||
* identify the article. */
|
||||
@@ -22,3 +23,10 @@ func (article *Article) Hash() string {
|
||||
hash := sha256.Sum256([]byte(article.SourceUrl))
|
||||
return hex.EncodeToString(hash[:])
|
||||
}
|
||||
|
||||
|
||||
// --- implementation of the IIdentifiable interface ---
|
||||
|
||||
func (article *Article) Id() uint {
|
||||
return article.Identifier
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user