DATACASS-518 - Polishing.

Add convenience method to table specifications accepting String column names with ordering.
This commit is contained in:
Mark Paluch
2018-01-18 10:58:09 +01:00
parent 342b6b9334
commit 3eedafb3e4

View File

@@ -123,6 +123,24 @@ public class TableSpecification<T> extends TableOptionsSpecification<TableSpecif
return clusteredKeyColumn(of(name), type);
}
/**
* Adds the given primary key column to the table with ascending ordering. Must be specified after all partition key
* columns and before any non-key columns.
*
* @param name The column name; must be a valid unquoted or quoted identifier without the surrounding double quotes,
* must not be {@literal null}.
* @param type The data type of the column, must not be {@literal null}.
* @param ordering The data type of the column, must not be {@literal null}.
* @return this
* @since 2.1
*/
public T clusteredKeyColumn(String name, DataType type, Ordering ordering) {
Assert.notNull(ordering, "Ordering must not be null");
return column(CqlIdentifier.of(name), type, Optional.of(CLUSTERED), Optional.of(ordering));
}
/**
* Adds the given primary key column to the table with ascending ordering. Must be specified after all partition key
* columns and before any non-key columns.