Skip to content

Instantly share code, notes, and snippets.

@ezhulenev
Created October 15, 2014 15:36
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 ezhulenev/77725cb3d6ec2d82c143 to your computer and use it in GitHub Desktop.
Save ezhulenev/77725cb3d6ec2d82c143 to your computer and use it in GitHub Desktop.
/**
* 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