Class TableDefinition
java.lang.Object
com.datastax.astra.client.tables.definition.TableDefinition
Definition of a table.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddColumn(String columnName, ColumnDefinition columnDefinition) Adds a column to the table definition.addColumn(String name, ColumnTypes type) Adds a column to the table with a specific type.addColumnAscii(String name) Adds an ascii column to the table.addColumnBigInt(String name) Adds a boolean column to the table.addColumnBlob(String name) Adds a blob column to the table.addColumnBoolean(String name) Adds a boolean column to the table.addColumnInt(String name) Adds an integer column to the table.addColumnList(String name, ColumnTypes valueType) Adds a list column to the table.addColumnMap(String name, ColumnTypes keyType, ColumnTypes valueType) Adds a map column to the table.addColumnSet(String name, ColumnTypes valueType) Adds a set column to the table.addColumnText(String name) Adds a text column to the table.addColumnTimestamp(String name) Adds a timestamp column to the table.addColumnVector(String name, ColumnDefinitionVector colDefVector) Adds a vector column to the table.addPartitionBy(String partitionKey) Adds a partition key to the table's primary key.addPartitionSort(Sort column) Adds a sort column to the table's primary key.clusteringColumns(Sort... clusteringColumns) Sets the clustering columns for the table.partitionKey(String... partitionKeys) Sets the partition keys for the table.toString()
-
Constructor Details
-
TableDefinition
public TableDefinition()Default constructor.
-
-
Method Details
-
addColumn
Adds a column to the table definition.- Parameters:
columnName- the name of the columncolumnDefinition- the definition of the column- Returns:
- the updated
TableDefinitioninstance - Throws:
IllegalArgumentException- ifcolumnNameis null
-
addColumn
Adds a column to the table with a specific type.- Parameters:
name- the name of the columntype- the type of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnText
Adds a text column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnAscii
Adds an ascii column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnInt
Adds an integer column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnTimestamp
Adds a timestamp column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnBoolean
Adds a boolean column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnBigInt
Adds a boolean column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnBlob
Adds a blob column to the table.- Parameters:
name- the name of the column- Returns:
- the updated
TableDefinitioninstance
-
addColumnList
Adds a list column to the table.- Parameters:
name- the name of the columnvalueType- the type of the elements in the list- Returns:
- the updated
TableDefinitioninstance
-
addColumnSet
Adds a set column to the table.- Parameters:
name- the name of the columnvalueType- the type of the elements in the set- Returns:
- the updated
TableDefinitioninstance
-
addColumnMap
Adds a map column to the table.- Parameters:
name- the name of the columnkeyType- the type of the keys in the mapvalueType- the type of the values in the map- Returns:
- the updated
TableDefinitioninstance
-
addColumnVector
Adds a vector column to the table.- Parameters:
name- the name of the columncolDefVector- the definition of the vector column- Returns:
- the updated
TableDefinitioninstance
-
addPartitionBy
Adds a partition key to the table's primary key.- Parameters:
partitionKey- the name of the partition key column- Returns:
- the updated
TableDefinitioninstance
-
addPartitionSort
Adds a sort column to the table's primary key.- Parameters:
column- the sort column to add- Returns:
- the updated
TableDefinitioninstance - Throws:
IllegalArgumentException- ifcolumnis null or invalid
-
partitionKey
Sets the partition keys for the table.- Parameters:
partitionKeys- the partition keys- Returns:
- the updated
TableDefinitioninstance - Throws:
IllegalArgumentException- if any of the partition keys are not valid columns
-
clusteringColumns
Sets the clustering columns for the table.- Parameters:
clusteringColumns- the clustering columns- Returns:
- the updated
TableDefinitioninstance - Throws:
IllegalArgumentException- if any of the clustering columns are not valid columns
-
toString
-