Created
October 15, 2014 15:36
-
-
Save ezhulenev/77725cb3d6ec2d82c143 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Mention of focus company | |
* | |
* @param ticker ticker of focus company | |
* @param source source of this mention (Twitter, RSS, etc...) | |
* @param sourceId source specific id | |
* @param time time | |
* @param mentions set of other tickers including focus ticker itself | |
*/ | |
case class Mention(ticker: Ticker, source: String, sourceId: String, time: DateTime, mentions: Set[Ticker]) | |
sealed class MentionRecord extends CassandraTable[MentionRecord, Mention] with Serializable { | |
override val tableName: String = "mention" | |
object ticker extends StringColumn (this) with PartitionKey[String] | |
object source extends StringColumn (this) with PrimaryKey[String] | |
object time extends DateTimeColumn (this) with PrimaryKey[DateTime] | |
object source_id extends StringColumn (this) with PrimaryKey[String] | |
object mentions extends SetColumn[MentionRecord, Mention, String] (this) | |
def fromRow(r: Row): Mention = { | |
Mention(Ticker(ticker(r)), source(r), source_id(r), time(r), mentions(r) map Ticker) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment