|
|
@ -190,15 +190,17 @@ impl Database {
|
|
|
|
users
|
|
|
|
users
|
|
|
|
.iter()
|
|
|
|
.iter()
|
|
|
|
// u64 must be converted to String for templates
|
|
|
|
// u64 must be converted to String for templates
|
|
|
|
.filter_map(|id| -> Option<Result<(String, User)>> {
|
|
|
|
.map(|id| -> Result<(String, User)> {
|
|
|
|
match conn.prepare("SELECT name, discriminator, avatar FROM User WHERE id = ?1") {
|
|
|
|
match conn.prepare("SELECT name, discriminator, avatar FROM User WHERE id = ?1") {
|
|
|
|
Ok(mut statement) => Some(statement.query_row(params![id], |row| Ok((id.to_string(), User {
|
|
|
|
Ok(mut statement) => statement.query_row(params![id], |row| {
|
|
|
|
|
|
|
|
Ok((id.to_string(), User {
|
|
|
|
id: *id,
|
|
|
|
id: *id,
|
|
|
|
name: row.get(0)?,
|
|
|
|
name: row.get(0)?,
|
|
|
|
discriminator: row.get(1)?,
|
|
|
|
discriminator: row.get(1)?,
|
|
|
|
avatar: row.get(2)?,
|
|
|
|
avatar: row.get(2)?,
|
|
|
|
}))).map_err(DatabaseError::Rusqlite)),
|
|
|
|
}))
|
|
|
|
Err(error) => Some(Err(DatabaseError::Rusqlite(error))),
|
|
|
|
}).map_err(|error| DatabaseError::Rusqlite(error)),
|
|
|
|
|
|
|
|
Err(error) => Err(DatabaseError::Rusqlite(error)),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.collect()
|
|
|
|
.collect()
|
|
|
|