From f7d72adfb594980b0442c0fa7b5586e6248f96ac Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Fri, 6 May 2022 17:22:17 -0600 Subject: Implement post.Store --- srv/src/post/post.go | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'srv/src/post/post.go') 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 } -- cgit v1.2.3