简体   繁体   English

删除映射如何与 Spring WebFlux 和 Cassandra 数据库一起使用?

[英]How does delete mapping work with Spring WebFlux and Cassandra database?

I'm trying to get a handle on the Spring Web Flux.我正在尝试获取 Spring Web Flux 的句柄。 I was able to get the @getmapping to give me back my json parameters.我能够让@getmapping 返回我的 json 参数。 And in the cassandra database I was able to delete a row using that command in the repository, but I can't delete a row from the commandline.在 cassandra 数据库中,我能够在存储库中使用该命令删除一行,但我无法从命令行删除一行。 What would you guys recommend?你们会推荐什么?

//This code is in my controller 
//It's supposed to call method when I type in my terminal "curl localhost:8080/orders/delete/1"
   @DeleteMapping("/delete/{id}")
    public Mono<Integer> deleteOrder(@PathVariable("id") int id){

//This code is in my service called after the top portion
    public Mono<Integer> deleteOrder(int id) {return orderRepository.deleteOrder(id);} {
//And then in my repository this should be the last called method 
public Mono<Integer> deleteOrder(int uuid) {
      //  log.info("Attempting to delete");
        Flux.from(
                session.executeReactive(
                        SimpleStatement.builder("DELETE FROM LightNfresh.orders WHERE order_id = ?")
                            .addPositionalValue(uuid)
                            .build()))
                .subscribe();
        return Mono.just(uuid);
    }

Turns out it was just my curl command.原来这只是我的 curl 命令。 It should've been curl -X "DELETE" localhost:8080/orders/delete/1 Thanks to anyone that was looking into it.它应该是 curl -X "DELETE" localhost:8080/orders/delete/1 感谢任何正在调查它的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM