-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #209 from zinal/rename_tables
Support RenameTables() operation in YDB Java SDK
- Loading branch information
Showing
8 changed files
with
305 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
table/src/main/java/tech/ydb/table/settings/RenameTablesSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package tech.ydb.table.settings; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* | ||
* @author Maksim Zinal | ||
*/ | ||
public class RenameTablesSettings extends RequestSettings<RenameTablesSettings> { | ||
|
||
private final List<Item> items = new ArrayList<>(); | ||
|
||
public List<Item> getItems() { | ||
return items; | ||
} | ||
|
||
public RenameTablesSettings addTable(String sourcePath, String destinationPath, | ||
boolean replaceDestination) { | ||
items.add(new Item(sourcePath, destinationPath, replaceDestination)); | ||
return this; | ||
} | ||
|
||
public RenameTablesSettings addTable(String sourcePath, String destinationPath) { | ||
items.add(new Item(sourcePath, destinationPath)); | ||
return this; | ||
} | ||
|
||
public static class Item { | ||
private final String sourcePath; | ||
private final String destinationPath; | ||
private final boolean replaceDestination; | ||
|
||
public Item(String sourcePath, String destinationPath, boolean replaceDestination) { | ||
this.sourcePath = sourcePath; | ||
this.destinationPath = destinationPath; | ||
this.replaceDestination = replaceDestination; | ||
} | ||
|
||
public Item(String sourcePath, String destinationPath) { | ||
this.sourcePath = sourcePath; | ||
this.destinationPath = destinationPath; | ||
this.replaceDestination = false; | ||
} | ||
|
||
public String getSourcePath() { | ||
return sourcePath; | ||
} | ||
|
||
public String getDestinationPath() { | ||
return destinationPath; | ||
} | ||
|
||
public boolean isReplaceDestination() { | ||
return replaceDestination; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.