diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-02-16 15:53:04 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-02-16 15:53:04 -0500 |
commit | eadf37ad7ab0c25764f22923bae60ef70daea75f (patch) | |
tree | f8566132e6af634d4138fd320a16bc629e600e10 /model | |
parent | 38c42ca53f23898206dce7466a2ec7fba9b61ac1 (diff) | |
download | chat-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')
-rw-r--r-- | model/post_list.go | 7 |
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 { |