summaryrefslogtreecommitdiffstats
path: root/model/post_list.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-02-16 15:53:04 -0500
committerJoram Wilander <jwawilander@gmail.com>2017-02-16 15:53:04 -0500
commiteadf37ad7ab0c25764f22923bae60ef70daea75f (patch)
treef8566132e6af634d4138fd320a16bc629e600e10 /model/post_list.go
parent38c42ca53f23898206dce7466a2ec7fba9b61ac1 (diff)
downloadchat-eadf37ad7ab0c25764f22923bae60ef70daea75f.tar.gz
chat-eadf37ad7ab0c25764f22923bae60ef70daea75f.tar.bz2
chat-eadf37ad7ab0c25764f22923bae60ef70daea75f.zip
Added NewPostList constructor to set fields to be non-null (#5440)
Diffstat (limited to 'model/post_list.go')
-rw-r--r--model/post_list.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/model/post_list.go b/model/post_list.go
index 2de4df7d8..9b56f0233 100644
--- a/model/post_list.go
+++ b/model/post_list.go
@@ -13,6 +13,13 @@ type PostList struct {
Posts map[string]*Post `json:"posts"`
}
+func NewPostList() *PostList {
+ return &PostList{
+ Order: make([]string, 0),
+ Posts: make(map[string]*Post),
+ }
+}
+
func (o *PostList) ToJson() string {
b, err := json.Marshal(o)
if err != nil {