-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
237 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
/** | ||
* ClusterQueryResponse | ||
* TODO : 변경필요 | ||
* | ||
* @author akageun | ||
* @since 2024-07-03 | ||
|
57 changes: 57 additions & 0 deletions
57
...n/java/kr/hakdang/cadio/web/route/cluster/table/pureselect/ClusterTablePureSelectApi.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,57 @@ | ||
package kr.hakdang.cadio.web.route.cluster.table.pureselect; | ||
|
||
import com.datastax.oss.driver.api.core.CqlSession; | ||
import kr.hakdang.cadio.core.domain.cluster.ClusterQueryCommanderResult; | ||
import kr.hakdang.cadio.core.domain.cluster.keyspace.table.ClusterTableCommander; | ||
import kr.hakdang.cadio.core.domain.cluster.keyspace.table.ClusterTablePureSelectResult; | ||
import kr.hakdang.cadio.web.common.dto.response.ApiResponse; | ||
import kr.hakdang.cadio.web.route.BaseSample; | ||
import kr.hakdang.cadio.web.route.cluster.query.ClusterQueryRequest; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* ClusterTablePureSelectApi | ||
* | ||
* @author akageun | ||
* @since 2024-07-03 | ||
*/ | ||
@Slf4j | ||
@RestController | ||
@RequestMapping("/api/cassandra/cluster/{clusterId}/keyspace/{keyspace}") | ||
public class ClusterTablePureSelectApi extends BaseSample { | ||
|
||
@Autowired | ||
private ClusterTableCommander clusterTableCommander; | ||
|
||
@PostMapping("/table/{table}/query") | ||
public ApiResponse<Map<String, Object>> clusterQueryCommand( | ||
@PathVariable String clusterId, | ||
@PathVariable String keyspace, | ||
@PathVariable String table, | ||
@RequestBody ClusterTablePureSelectRequest request | ||
) { | ||
Map<String, Object> map = new HashMap<>(); | ||
try (CqlSession session = makeSession()) { //TODO : interface 작업할 때 facade layer 로 변경 예정 | ||
ClusterTablePureSelectResult result1 = clusterTableCommander.pureSelect(session, request.makeArgs(keyspace, table)); | ||
|
||
map.put("wasApplied", result1.isWasApplied()); | ||
map.put("nextCursor", result1.getNextCursor()); | ||
map.put("rows", result1.getRows()); | ||
map.put("columnNames", result1.getColumnNames()); | ||
} catch (Exception e) { | ||
log.error("error : {}", e.getMessage(), e); | ||
throw e; | ||
} | ||
|
||
return ApiResponse.ok(map); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...va/kr/hakdang/cadio/web/route/cluster/table/pureselect/ClusterTablePureSelectRequest.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,35 @@ | ||
package kr.hakdang.cadio.web.route.cluster.table.pureselect; | ||
|
||
import kr.hakdang.cadio.core.domain.cluster.keyspace.table.ClusterTablePureSelectArgs; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* ClusterTablePureSelectRequest | ||
* | ||
* @author akageun | ||
* @since 2024-07-03 | ||
*/ | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class ClusterTablePureSelectRequest { | ||
private String cursor; | ||
private int pageSize; | ||
|
||
@Builder | ||
public ClusterTablePureSelectRequest(String cursor, int pageSize) { | ||
this.cursor = cursor; | ||
this.pageSize = pageSize; | ||
} | ||
|
||
public ClusterTablePureSelectArgs makeArgs(String keyspace, String table) { | ||
return ClusterTablePureSelectArgs.builder() | ||
.keyspace(keyspace) | ||
.table(table) | ||
.cursor(cursor) | ||
.pageSize(pageSize) | ||
.build(); | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
cadio-web/src/main/webapp/src/pages/cluster/components/keyspace/table/table-export.js
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,10 @@ | ||
const TableExport = () => { | ||
|
||
return ( | ||
<> | ||
Export | ||
</> | ||
) | ||
} | ||
|
||
export default TableExport; |
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
10 changes: 10 additions & 0 deletions
10
cadio-web/src/main/webapp/src/pages/cluster/components/keyspace/table/table-import.js
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,10 @@ | ||
const TableImport = () => { | ||
|
||
return ( | ||
<> | ||
Infomation | ||
</> | ||
) | ||
} | ||
|
||
export default TableImport; |
10 changes: 10 additions & 0 deletions
10
cadio-web/src/main/webapp/src/pages/cluster/components/keyspace/table/table-information.js
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,10 @@ | ||
const TableInformation = () => { | ||
|
||
return ( | ||
<> | ||
Infomation | ||
</> | ||
) | ||
} | ||
|
||
export default TableInformation; |
Oops, something went wrong.