Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mccraigmccraig
Created October 27, 2017 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mccraigmccraig/1b6eefd2d7035a52a3347cdfca69f3fb to your computer and use it in GitHub Desktop.
Save mccraigmccraig/1b6eefd2d7035a52a3347cdfca69f3fb to your computer and use it in GitHub Desktop.
(s/defn last-n-conversation-messages
([cassandra conversation]
(last-n-conversation-messages cassandra
conversation
max-recent-messages))
([cassandra
conversation
n]
(ddo [:let [[org-id con-id] (t/extract-uber-key-value conv.ent/Conversations
conversation)]
msgs (cm/select
cassandra
conv.ent/ConversationMessages
[:org_id :conversation_id]
[org-id con-id]
{:limit n})]
(return
(filter
(comp not :deleted)
msgs)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment