2023-06-25 18:04:06 +00:00
|
|
|
package model
|
|
|
|
|
2024-02-13 20:43:52 +00:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
2023-06-25 18:04:06 +00:00
|
|
|
|
|
|
|
type EntryContent string
|
|
|
|
|
|
|
|
type Entry interface {
|
|
|
|
ID() string
|
|
|
|
Content() EntryContent
|
|
|
|
PublishedAt() *time.Time
|
2023-07-13 19:55:08 +00:00
|
|
|
AuthorId() string
|
2024-02-13 20:43:52 +00:00
|
|
|
MetaData() EntryMetaData
|
2023-07-09 17:51:49 +00:00
|
|
|
|
|
|
|
// Optional: can return empty string
|
|
|
|
Title() string
|
2023-07-08 13:56:42 +00:00
|
|
|
|
|
|
|
SetID(id string)
|
|
|
|
SetPublishedAt(publishedAt *time.Time)
|
2024-02-13 20:43:52 +00:00
|
|
|
SetMetaData(metaData EntryMetaData)
|
2023-07-13 19:55:08 +00:00
|
|
|
SetAuthorId(authorId string)
|
2023-06-25 18:04:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type EntryMetaData interface {
|
2024-02-21 19:24:18 +00:00
|
|
|
Formable
|
2023-06-25 18:04:06 +00:00
|
|
|
}
|
2023-07-08 13:56:42 +00:00
|
|
|
|
|
|
|
type EntryBase struct {
|
|
|
|
id string
|
|
|
|
publishedAt *time.Time
|
2023-07-13 19:55:08 +00:00
|
|
|
authorId string
|
2023-07-08 13:56:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EntryBase) ID() string {
|
|
|
|
return e.id
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EntryBase) PublishedAt() *time.Time {
|
|
|
|
return e.publishedAt
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EntryBase) SetID(id string) {
|
|
|
|
e.id = id
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EntryBase) SetPublishedAt(publishedAt *time.Time) {
|
|
|
|
e.publishedAt = publishedAt
|
|
|
|
}
|
2023-07-13 19:55:08 +00:00
|
|
|
|
|
|
|
func (e *EntryBase) AuthorId() string {
|
|
|
|
return e.authorId
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EntryBase) SetAuthorId(authorId string) {
|
|
|
|
e.authorId = authorId
|
|
|
|
}
|