zz
This commit is contained in:
15
blog.go
15
blog.go
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user