diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2022-05-06 17:22:17 -0600 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2022-05-06 17:22:21 -0600 |
commit | f7d72adfb594980b0442c0fa7b5586e6248f96ac (patch) | |
tree | 05f3e80c1f8fc79b3ae67f886534681ddc8c0b62 /srv/src/post/post.go | |
parent | d8b12cf17a43e700d841402f712efa8666e6137f (diff) |
Implement post.Store
Diffstat (limited to 'srv/src/post/post.go')
-rw-r--r-- | srv/src/post/post.go | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/srv/src/post/post.go b/srv/src/post/post.go index 54555c3..7803c82 100644 --- a/srv/src/post/post.go +++ b/srv/src/post/post.go @@ -2,30 +2,10 @@ package post import ( - "fmt" - "path" "regexp" "strings" - "time" ) -// Date represents a calendar date with no timezone information attached. -type Date struct { - Year int - Month time.Month - Day int -} - -// DateFromTime converts a Time into a Date, truncating all non-date -// information. -func DateFromTime(t time.Time) Date { - return Date{ - Year: t.Year(), - Month: t.Month(), - Day: t.Day(), - } -} - var titleCleanRegexp = regexp.MustCompile(`[^a-z ]`) // NewID generates a (hopefully) unique ID based on the given title. @@ -43,22 +23,5 @@ type Post struct { Description string Tags []string Series string - - PublishedAt Date - LastUpdatedAt Date - - Body string -} - -// URL returns the relative URL of the Post. -func (p Post) URL() string { - return path.Join( - fmt.Sprintf( - "%d/%0d/%0d", - p.PublishedAt.Year, - p.PublishedAt.Month, - p.PublishedAt.Day, - ), - p.ID+".html", - ) + Body string } |