Skip to content

Commit

Permalink
Add scaladoc for CreateTables.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtar committed Dec 15, 2023
1 parent d1a7ea2 commit 9ec6c9b
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import cats.syntax.all._
import com.evolutiongaming.catshelper.{Log, LogOf}
import com.evolutiongaming.kafka.journal.eventual.cassandra.CassandraHelper._

/** Creates tables in a specific keyspace */
trait CreateTables[F[_]] {
import CreateTables.{Fresh, Table}

Expand All @@ -15,6 +16,7 @@ trait CreateTables[F[_]] {

object CreateTables { self =>

/** `true` if all tables passed to `CreateTables` did not exist and were created */
type Fresh = Boolean


Expand Down Expand Up @@ -72,6 +74,15 @@ object CreateTables { self =>
def const[F[_]](fresh: F[Fresh]): CreateTables[F] = (_: String, _: Nel[Table]) => fresh


/** Table to be created in a specific keyspace.
*
* @param name
* Table name (without a keyspace) used to check if table already exists.
* @param queries
* CQL statements (including keyspace) used to create a table. I.e. it
* could contain `CREATE TABLE` statement and also related `CREATE INDEX`
* statements.
*/
final case class Table(name: String, queries: Nel[String])

object Table {
Expand All @@ -80,4 +91,4 @@ object CreateTables { self =>

def apply(name: String, query: String): Table = Table(name, Nel.of(query))
}
}
}

0 comments on commit 9ec6c9b

Please sign in to comment.