Skip to content

Instantly share code, notes, and snippets.

@bradfordcp
Created March 23, 2018 00:46
Show Gist options
  • Save bradfordcp/9a10fdb0588e00c3fc69716eb1edac68 to your computer and use it in GitHub Desktop.
Save bradfordcp/9a10fdb0588e00c3fc69716eb1edac68 to your computer and use it in GitHub Desktop.
class UDTExampleFeed(cass: Cassandra, keyspace: String) extends AbstractContactFeed {
private def getTelecommunicationUDT = {
val telecommunication_type = cass.getCluster.getMetadata.getKeyspace(keyspace).getUserType("telecommunication")
val telecommunication = telecommunication_type.newValue()
val row = getTelecommunicationRow
row.foreach(p => telecommunication.setString(p._1, p._2))
telecommunication
}
def getTelecommunicationsUDT = {
def telecommunicationsData = {
Map("telecommunications" -> (1 to 3).map(_ => {
getTelecommunicationUDT
}).filter(_ != false).foldLeft(Set[UDTValue]())((s, a) => s + a.asInstanceOf[UDTValue]))
}
Iterator.continually(telecommunicationsData)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment