summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-25 09:32:42 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-01-25 09:32:42 -0500
commitd245b29f82a03f1aff966a2fb2100a5703d82f32 (patch)
treecf204039af74fa2579e0291e9e595f08411b0a7a /store/sql_post_store.go
parent8ed665cb76c0763e83a2949c4bdd70153baf72f7 (diff)
downloadchat-d245b29f82a03f1aff966a2fb2100a5703d82f32.tar.gz
chat-d245b29f82a03f1aff966a2fb2100a5703d82f32.tar.bz2
chat-d245b29f82a03f1aff966a2fb2100a5703d82f32.zip
More app code migration (#5170)
* Migrate admin functions into app package * More user function refactoring * Move post functions into app package
Diffstat (limited to 'store/sql_post_store.go')
-rw-r--r--store/sql_post_store.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index c1aaee3e6..ed87b01f7 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -222,6 +222,27 @@ func (s SqlPostStore) Get(id string) StoreChannel {
return storeChannel
}
+func (s SqlPostStore) GetSingle(id string) StoreChannel {
+ storeChannel := make(StoreChannel, 1)
+
+ go func() {
+ result := StoreResult{}
+
+ var post model.Post
+ err := s.GetReplica().SelectOne(&post, "SELECT * FROM Posts WHERE Id = :Id AND DeleteAt = 0", map[string]interface{}{"Id": id})
+ if err != nil {
+ result.Err = model.NewLocAppError("SqlPostStore.GetSingle", "store.sql_post.get.app_error", nil, "id="+id+err.Error())
+ }
+
+ result.Data = &post
+
+ storeChannel <- result
+ close(storeChannel)
+ }()
+
+ return storeChannel
+}
+
type etagPosts struct {
Id string
UpdateAt int64