This commit is contained in:
Laurent Ulrich
2025-08-19 09:56:13 +02:00
parent 9f88d84513
commit 8c76f5e6f0
4 changed files with 46 additions and 24 deletions

15
blog.go
View File

@@ -22,3 +22,18 @@ type Blog struct {
Posts []Post
mutex sync.Mutex
}
func (b *Blog) GetPost(Id string) (Post, bool) {
var ret Post
b.mutex.Lock()
defer b.mutex.Unlock()
for _, p := range b.Posts {
if p.Id == Id {
ret = p
ret.BlogTitle = b.Title
ret.Lang = b.Lang
return ret, true
}
}
return ret, false
}