-
-
Save jelmerk/27f335f77f728768d26a387a2459ec1a to your computer and use it in GitHub Desktop.
This file contains 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
class FooDatabase(val connection: CassandraConnection, archiveTables: Seq[String]) | |
extends Database[FooDatabase](connection)(new DatabaseHelper[FooDatabase] { | |
override def tables(db: FooDatabase): Seq[CassandraTable[_, _]] = db.myTables | |
override def createQueries(db: FooDatabase)(implicit ks: KeySpace): QueryCollection[Seq] = | |
new QueryCollection[Seq](tables(db).map(_.autocreate(ks).executableQuery)) | |
}) { | |
lazy val myTables: Seq[BarTable] = archiveTables.map { tableName => | |
new BarTable(tableName) with Connector { | |
override def autocreate(keySpace: KeySpace): Default[BarTable, BazRecord] = { | |
create | |
.ifNotExists() | |
.`with`(compaction eqs LeveledCompactionStrategy) | |
.and(default_time_to_live eqs 100.days) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment