Finds the first type in the type hierarchy for which columns exist as direct members.
Finds the first type in the type hierarchy for which columns exist as direct members.
The type of the table.
An optional symbol, if such a type was found in the type hierarchy.
A "generic" type extractor that's meant to produce a list of fields from a record type.
A "generic" type extractor that's meant to produce a list of fields from a record type. We support a narrow domain of types for automated generation, currently including: - Case classes - Tuples
To achieve this, we simply have specific ways of extracting the types from the underlying records, and producing a Field for each of the members in the product type,
The underlying record type that was passed as the second argument to a Cassandra table.
An iterable of fields, each containing a TermName and a Type that describe a record member.
Extracts the name of the table that will be generated and used in Cassandra.
Extracts the name of the table that will be generated and used in Cassandra. This can be changed at runtime by the user by overriding CassandraTable.tableName. This mechanism is incompatible with the historical way we used to do this, effectively using the type inferred by the final database object.
Instead, at present times, it is the type hierarchy that dictates what a table will be called, and the first member of the type hierarchy of a table type with columns defined will dictate the name.
The source table type to extract the name from. We rely on this to be the first in the hierarchy to contain column definitions, determined by determineReferenceTable() above.
Finds a matching subset of columns inside a table definition where the extracted type from a table does not need to include all of the columns inside a table.
Finds a matching subset of columns inside a table definition where the extracted type from a table does not need to include all of the columns inside a table.
This addresses https://websudos.atlassian.net/browse/PHANTOM-237.
The type members of the table.
The type members of the record type.
This method will check for common Cassandra anti-patterns during the intialisation of a schema.
This method will check for common Cassandra anti-patterns during the intialisation of a schema. If the Schema definition violates valid CQL standard, this function will throw an error.
A perfect example is using a mixture of Primary keys and Clustering keys in the same schema. While a Clustering key is also a primary key, when defining a clustering key all other keys must become clustering keys and specify their order.
We could auto-generate this order but we wouldn't be making false assumptions about the desired ordering.
Materializes an extractor method for a table, the so called "fromRow" method.
Materializes an extractor method for a table, the so called "fromRow" method.
This will only work if the types of the record type match the types inferred by the return types of the columns inside the table.
If the implementation could not be inferred, the output of this method will be the unimplemented method exception and the user will have to manually override the fromRow definition and create one themselves.
def fromRow(row: Row): R = ???
Not only that but they also have to be in the same order. For example:
case class MyRecord( id: UUID, email: String, date: DateTime ) class MyTable extends CassandraTable[MyTable, MyRecord] { object id extends UUIDColumn(this) with PartitionKey object email extends StringColumn(this) object date extends DateTimeColumn(this) }
An interpolated tree that will contain the automatically generated implementation of the fromRow method in a Cassandra Table. Alternatively, this will return an unimplemented ??? method, provided a correct definition could not be inferred.