fix: player update - revisar
This commit is contained in:
parent
6029cab244
commit
f005a056b7
@ -26,11 +26,11 @@ pub fn create_player(newplayer: &Player) -> Result<usize, diesel::result::Error>
|
|||||||
|
|
||||||
// update_player actualiza o xogador
|
// update_player actualiza o xogador
|
||||||
pub fn update_player(newplayer: &Player) -> Result<usize, diesel::result::Error> {
|
pub fn update_player(newplayer: &Player) -> Result<usize, diesel::result::Error> {
|
||||||
use crate::schema::player;
|
use crate::schema::player::dsl::*; // para ter o find no update
|
||||||
let conn = &mut establish_connection();
|
let conn = &mut establish_connection();
|
||||||
|
|
||||||
// FIXME: actualiza todos os rows...
|
// FIXME: actualiza todos os rows...
|
||||||
diesel::update(player::table)
|
diesel::update(player::find(player, &newplayer.tag))
|
||||||
.set(newplayer) // co trait AsChangeSet podese actualizar a struct enteira
|
.set(newplayer) // co trait AsChangeSet podese actualizar a struct enteira
|
||||||
.execute(conn)
|
.execute(conn)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user