move from file storage to sqlite3
This commit is contained in:
@@ -2,13 +2,12 @@ package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
|
||||
// TODO docstring
|
||||
type Article struct {
|
||||
Identifier int
|
||||
SourceUrl string
|
||||
PublishDate time.Time
|
||||
FetchDate time.Time
|
||||
@@ -42,13 +41,3 @@ func (a *Article) ViewModel() *ArticleViewModel {
|
||||
Summary: summary,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- implement IIdentifiable interface ---
|
||||
|
||||
// Generates a hash based on the source url of the article. Can be used to
|
||||
// identify the article.
|
||||
func (article *Article) Id() string {
|
||||
hash := sha256.Sum256([]byte(article.SourceUrl))
|
||||
return hex.EncodeToString(hash[:])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user