Package io.stargate.sdk.rest
Class TableClient
java.lang.Object
io.stargate.sdk.rest.TableClient
Operate on Tables in Cassandra.
- Author:
- Cedrick LUNVEN (@clunven)
-
Field Summary
FieldsModifier and TypeFieldDescription/v2/schemas/keyspaces/{keyspace}/tables/{tableName}/columns/v2/schemas/keyspaces/{keyspace}/tables/{tableName}/indexesstatic final StringURL Parts.static final StringURL Parts./v2/keyspaces/{keyspace}/tables/{tableName}/v2/schemas/keyspaces/{keyspace}/tables/{tableName} -
Constructor Summary
ConstructorsConstructorDescriptionTableClient(LoadBalancedHttpClient stargateHttpClient, KeyspaceClient keyspaceClient, String tableName) Full constructor. -
Method Summary
Modifier and TypeMethodDescriptionMove to columns clientRetrieve All column names.columns()Retrieve All columns.voidcreate(CreateTable tcr) Create a table.voidcreateColumn(String colName, ColumnDefinition cd) Create a Column.voidcreateIndex(String idxName, CreateIndex ci) Create an index.voiddelete()Delete a table.booleanexist()Check if the table exist.find()Get a table.Getter accessor for attribute 'tableName'.Move to columns clientindexes()Retrieve All indexes for a table.Retrieve All indexes names.Move to the Table clientsearch(SearchTableQuery query) Search a table.<T> Page<T> search(SearchTableQuery query, RowMapper<T> mapper) Retrieve a set of Rows from Primary key value.voidReplace a table definition (table options only).voidAdd Rows.
-
Field Details
-
PATH_COLUMNS
URL Parts.- See Also:
-
PATH_INDEXES
URL Parts.- See Also:
-
tableSchemaResource
/v2/schemas/keyspaces/{keyspace}/tables/{tableName} -
tableResource
/v2/keyspaces/{keyspace}/tables/{tableName} -
columnsSchemaResource
/v2/schemas/keyspaces/{keyspace}/tables/{tableName}/columns -
indexesSchemaResource
/v2/schemas/keyspaces/{keyspace}/tables/{tableName}/indexes
-
-
Constructor Details
-
TableClient
public TableClient(LoadBalancedHttpClient stargateHttpClient, KeyspaceClient keyspaceClient, String tableName) Full constructor.- Parameters:
stargateHttpClient- apiDataClientkeyspaceClient- KeyspaceClienttableName- name of the table
-
-
Method Details
-
find
Get a table.- Returns:
- metadata of the collection if its exist or empty
- See Also:
-
exist
public boolean exist()Check if the table exist.- Returns:
- boolean
-
create
Create a table.- Parameters:
tcr- creation request- See Also:
-
updateOptions
Replace a table definition (table options only).- Parameters:
to- TableOptions- See Also:
-
delete
public void delete()Delete a table.- See Also:
-
upsert
Add Rows.- Parameters:
record- map of recors- See Also:
-
search
Search a table.- Parameters:
query- search params with filters and ordering- Returns:
- RowResultPage
- See Also:
-
search
Retrieve a set of Rows from Primary key value.- Type Parameters:
T- marshalling bean- Parameters:
query- SearchTableQuerymapper- mapping result to bean with a mapper- Returns:
- ResultPage pageable result
- See Also:
-
columns
Retrieve All columns.- Returns:
- Sream of
ColumnDefinitionto describe a table - See Also:
-
createColumn
Create a Column.- Parameters:
colName- Stringcd- ColumnDefinition- See Also:
-
columnNames
Retrieve All column names.- Returns:
- a list of columns names;
-
indexes
Retrieve All indexes for a table.- Returns:
- Stream of
IndexDefinitionto describe a table - See Also:
-
createIndex
Create an index.- Parameters:
idxName- Stringci- CreateIndex- See Also:
-
indexesNames
Retrieve All indexes names.- Returns:
- a list of columns names;
-
column
Move to columns client- Parameters:
columnId- String- Returns:
- ColumnsClient
-
index
Move to columns client- Parameters:
indexName- String- Returns:
- IndexClient
-
key
Move to the Table client- Parameters:
keys- Object- Returns:
- KeyClient
-
getTableName
Getter accessor for attribute 'tableName'.- Returns:
- current value of 'tableName'
-