func GetMessages(receiver string, sender string, last string, limit int) ([]*MessageWithId, error) { session := core.NewCassandraRConn() iter := session.Query(retrieveMessages, receiver, sender, last, limit).Iter() result := make([]*MessageWithId, iter.NumRows()) var id string var payload string index := 0 for iter.Scan(&id, &payload) { result[index] = &MessageWithId{id, payload} index++ log.Println(id, payload) } return result, iter.Close() }
func RetrieveChatList(owner string) { session := core.NewCassandraRConn() session.Query(retrieveChatLists, owner).Bind() }
func RetrieveChatListByType(owner string, chatType int) { session := core.NewCassandraRConn() session.Query(retrieveChatListByType, owner, chatType).Attempts() }