Fixes in table methods in module creator
This commit is contained in:
parent
3607030a87
commit
b10c97801b
@ -62,11 +62,12 @@ public interface ModuleCreator {
|
||||
* On [module upgrading][ModuleTemplate.Creator.upgradeTemplate] must be recreated if needed.
|
||||
*
|
||||
* @param TableUserExtension User's type for containing table-related descriptors.
|
||||
* @param namespace Way to group tables if there is a lot.
|
||||
* @param name Name of table for debugging.
|
||||
* @param initializer Table-related descriptors initializer.
|
||||
* @return Table descriptor.
|
||||
*/
|
||||
// todo name
|
||||
public fun <TableUserExtension : Any> createSessionScopeTemporaryTable(initializer: CreateTable<TableUserExtension>): Table<TableUserExtension, Nothing>
|
||||
public fun <TableUserExtension : Any> createSessionScopeTemporaryTable(namespace: Namespace, name: String, initializer: CreateTable<TableUserExtension>): Table<TableUserExtension, Nothing>
|
||||
|
||||
/**
|
||||
* Creates a temporary table that exits only inside [transaction][Transaction] and auto-deleted (or cleared, depends on driver implementation) when it [finished][Transaction._assertTransactionFinishedAndReleaseResources].
|
||||
@ -74,11 +75,12 @@ public interface ModuleCreator {
|
||||
* On [module upgrading][ModuleTemplate.Creator.upgradeTemplate] must be recreated if needed.
|
||||
*
|
||||
* @param TableUserExtension User's type for containing table-related descriptors.
|
||||
* @param namespace Way to group tables if there is a lot.
|
||||
* @param name Name of table for debugging.
|
||||
* @param initializer Table-related descriptors initializer.
|
||||
* @return Table descriptor.
|
||||
*/
|
||||
// todo name
|
||||
public fun <TableUserExtension : Any> createTransactionScopeTemporaryTable(initializer: CreateTable<TableUserExtension>): Table<TableUserExtension, Nothing>
|
||||
public fun <TableUserExtension : Any> createTransactionScopeTemporaryTable(namespace: Namespace, name: String, initializer: CreateTable<TableUserExtension>): Table<TableUserExtension, Nothing>
|
||||
|
||||
/**
|
||||
* Functional interface for updating table.
|
||||
@ -109,13 +111,39 @@ public interface ModuleCreator {
|
||||
public fun updateTable(oldTable: Table<TableOldUserExtension, *>, updater: TableUpdater<TableNewUserExtension, TableOldUserExtension>): TableNewUserExtension
|
||||
}
|
||||
|
||||
// todo keep table
|
||||
|
||||
/**
|
||||
* Marks that table wouldn't be changed in this module version.
|
||||
*
|
||||
* @param TableUserExtension User's type with descriptors of related to table.
|
||||
* @param oldTable Descriptor of table created in a previous template version.
|
||||
* @return New table descriptor.
|
||||
*/
|
||||
public fun <TableUserExtension : Any> keepTable(
|
||||
oldTable: Table<TableUserExtension, *>,
|
||||
): Table<TableUserExtension, *>
|
||||
|
||||
/**
|
||||
* Renames or moves table without changing its schema.
|
||||
*
|
||||
* @param TableUserExtension User's type with descriptors of related to table.
|
||||
* @param table Descriptor to table which should be renamed.
|
||||
* @param newNamespace New namespace of the table. May be `null` if not changed.
|
||||
* @param newName New namespace of the table. May be `null` if not changed.
|
||||
* @return New table descriptor.
|
||||
* @throws IllegalArgumentException If both [newName] and [newNamespace] are same as old or `null`.
|
||||
*/
|
||||
public fun <TableUserExtension : Any> renameTable(
|
||||
table: Table<TableUserExtension, *>,
|
||||
newNamespace: Namespace? = null,
|
||||
newName: String? = null
|
||||
): Table<TableUserExtension, *>
|
||||
|
||||
/**
|
||||
* Updates table's descriptors without changing its [name][Table.name] or [namespace][Table.namespacesFromModuleRoot].
|
||||
*
|
||||
* @param TableNewUserExtension User's type with table's descriptors from the previous table version.
|
||||
* @param TableOldUserExtension User's type with descriptors of updated table.
|
||||
* @param TableNewUserExtension User's type with descriptors of updated table.
|
||||
* @param TableOldUserExtension User's type with table's descriptors from the previous table version.
|
||||
* @param oldTable Descriptor to the previous version of table from which can be got user's extension with old descriptors.
|
||||
* @param updater Object with descriptor providers and factories.
|
||||
* @return New table descriptor.
|
||||
@ -125,55 +153,32 @@ public interface ModuleCreator {
|
||||
updater: UpdateTable<TableNewUserExtension, TableOldUserExtension>
|
||||
): Table<TableNewUserExtension, TableOldUserExtension>
|
||||
|
||||
// todo collapse
|
||||
public fun <TableNewUserExtension : Any, TableOldUserExtension : Any> renameTable(
|
||||
table: Table<TableNewUserExtension, TableOldUserExtension>,
|
||||
newName: String
|
||||
): Table<TableNewUserExtension, TableOldUserExtension>
|
||||
|
||||
/**
|
||||
* Renames or moves table without changing its schema.
|
||||
* Both updates table's schema and renames or moves table.
|
||||
*
|
||||
* @param TableNewUserExtension User's type with table's descriptors from the previous table version.
|
||||
* @param TableOldUserExtension User's type with descriptors of updated table.
|
||||
*
|
||||
* @param table Descriptor to table which should be renamed.
|
||||
* @param newNamespace New namespace of the table. Can be the same as old.
|
||||
* @param newName New namespace of the table. Can be the same as old.
|
||||
* @return New table descriptor.
|
||||
*/
|
||||
public fun <TableNewUserExtension : Any, TableOldUserExtension : Any> renameTable(
|
||||
table: Table<TableNewUserExtension, TableOldUserExtension>,
|
||||
newNamespace: Namespace,
|
||||
newName: String
|
||||
): Table<TableNewUserExtension, TableOldUserExtension>
|
||||
|
||||
// todo collapse
|
||||
public fun <TableNewUserExtension : Any, TableOldUserExtension : Any> updateAndRenameTable(
|
||||
table: Table<TableOldUserExtension, *>,
|
||||
newName: String,
|
||||
initializer: UpdateTable<TableNewUserExtension, TableOldUserExtension>
|
||||
): Table<TableNewUserExtension, TableOldUserExtension>
|
||||
|
||||
/**
|
||||
* Both updates table schema and renames or moves table.
|
||||
*
|
||||
* @param TableNewUserExtension User's type with table's descriptors from the previous table version.
|
||||
* @param TableOldUserExtension User's type with descriptors of updated table.
|
||||
* @param oldTable Descriptor to table which should be renamed.
|
||||
* @param newNamespace New namespace of the table. Can be the same as old.
|
||||
* @param newName New namespace of the table. Can be the same as old.
|
||||
* @param TableNewUserExtension User's type with descriptors of updated table.
|
||||
* @param TableOldUserExtension User's type with table's descriptors from the previous table version.
|
||||
* @param oldTable Descriptor of table which should be renamed and updated.
|
||||
* @param newNamespace New namespace of the table. May be `null` if not changed.
|
||||
* @param newName New namespace of the table. May be `null` if not changed.
|
||||
* @param updater Object with descriptor providers and factories.
|
||||
* @return New table descriptor.
|
||||
* @throws IllegalArgumentException If both [newName] and [newNamespace] are same as old or `null`.
|
||||
*/
|
||||
public fun <TableNewUserExtension : Any, TableOldUserExtension : Any> updateAndRenameTable(
|
||||
oldTable: Table<TableNewUserExtension, TableOldUserExtension>,
|
||||
newNamespace: Namespace,
|
||||
newName: String,
|
||||
newNamespace: Namespace? = null,
|
||||
newName: String? = null,
|
||||
updater: UpdateTable<TableNewUserExtension, TableOldUserExtension>
|
||||
): Table<TableNewUserExtension, TableOldUserExtension>
|
||||
|
||||
// todo table deletion and remove `createTempTable`
|
||||
public fun <TableUserExtension : Any> createTempTable(namespace: Namespace, name: String, initializer: CreateTable<TableUserExtension>): Table<TableUserExtension, Nothing>
|
||||
/**
|
||||
* Deletes table and all data in it.
|
||||
*
|
||||
* @param table Descriptor of table which should be deleted.
|
||||
*/
|
||||
public fun deleteTable(table: Table<*, *>)
|
||||
|
||||
/**
|
||||
* Functional interface for creating 'SELECT' query.
|
||||
|
Loading…
Reference in New Issue
Block a user