diff options
| author | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-10-04 06:32:06 +0000 |
|---|---|---|
| committer | Pjotr <wrk@bosa.lan> | 2026-10-04 06:32:06 +0000 |
| commit | 0c8bad1cdb969cfec807cdd026313ffa848f4720 (patch) | |
| tree | 808fdfce9f77bd28e9bcb796053a0ced40f09f9b /src | |
| parent | 190c20497b015189f1ddd2ecdaf0d6e340c9141f (diff) | |
| download | genenetwork4-0c8bad1cdb969cfec807cdd026313ffa848f4720.tar.gz | |
Format with cargo fmt, matching 924bcf3's project-wide pass.
* src/db.rs, src/routes/groups.rs, tests/dataset_by_name.rs, tests/group_by_name.rs, tests/group_trait_info.rs: Run cargo fmt. No behavior change -- this code was written before the project adopted cargo fmt formatting in 924bcf3 and landed unformatted during the rebase that merged the two histories. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
Diffstat (limited to 'src')
| -rw-r--r-- | src/db.rs | 91 | ||||
| -rw-r--r-- | src/routes/groups.rs | 1 |
2 files changed, 78 insertions, 14 deletions
diff --git a/src/db.rs b/src/db.rs index 223bcde..393a861 100644 --- a/src/db.rs +++ b/src/db.rs @@ -282,7 +282,10 @@ pub struct TraitValue { /// is), so group_id is required to pick the right trait, the same way /// GeneNetwork2's trait_sample_data combines trait_name with a group /// or dataset to resolve a Publish trait. -pub fn get_group_trait_values(group_id: u16, trait_id: u32) -> Result<Vec<TraitValue>, mysql::Error> { +pub fn get_group_trait_values( + group_id: u16, + trait_id: u32, +) -> Result<Vec<TraitValue>, mysql::Error> { let pool = pool()?; let mut conn = pool.get_conn()?; conn.exec_map( @@ -342,7 +345,10 @@ pub struct TraitInfo { /// Fetch one published trait's metadata (see TraitInfo) within a /// group. Like get_group_trait_values, PublishXRef.Id alone isn't /// unique across groups, so group_id is required. -pub fn get_group_trait_info(group_id: u16, trait_id: u32) -> Result<Option<TraitInfo>, mysql::Error> { +pub fn get_group_trait_info( + group_id: u16, + trait_id: u32, +) -> Result<Option<TraitInfo>, mysql::Error> { let pool = pool()?; let mut conn = pool.get_conn()?; conn.exec_first( @@ -404,7 +410,18 @@ pub fn get_group_datasets(group_id: u16) -> Result<Vec<Dataset>, mysql::Error> { WHERE ProbeFreeze.InbredSetId = :group_id \ ORDER BY ProbeSetFreeze.Name", mysql::params! { "group_id" => group_id }, - |(id, probe_freeze_id, name, name2, full_name, short_name, create_time, public, confidentiality, data_scale)| { + |( + id, + probe_freeze_id, + name, + name2, + full_name, + short_name, + create_time, + public, + confidentiality, + data_scale, + )| { Dataset { id, probe_freeze_id, @@ -435,10 +452,21 @@ pub fn get_dataset_by_name(name: &str) -> Result<Option<Dataset>, mysql::Error> OR ShortName = :name OR CAST(Id AS CHAR) = :name", mysql::params! { "name" => name }, ) - .map(|row: Option<(u16, u16, String, Option<String>, String, String, String, u8, u8, String)>| { - row.map( - |(id, probe_freeze_id, name, name2, full_name, short_name, create_time, public, confidentiality, data_scale)| { - Dataset { + .map( + |row: Option<( + u16, + u16, + String, + Option<String>, + String, + String, + String, + u8, + u8, + String, + )>| { + row.map( + |( id, probe_freeze_id, name, @@ -449,10 +477,23 @@ pub fn get_dataset_by_name(name: &str) -> Result<Option<Dataset>, mysql::Error> public, confidentiality, data_scale, - } - }, - ) - }) + )| { + Dataset { + id, + probe_freeze_id, + name, + name2, + full_name, + short_name, + create_time, + public, + confidentiality, + data_scale, + } + }, + ) + }, + ) } /// One expression (ProbeSet) trait's metadata: its ProbeSetXRef @@ -498,9 +539,33 @@ pub fn get_dataset_probeset_info( mysql::params! { "dataset_id" => dataset_id, "probeset_name" => probeset_name }, ) .map( - |row: Option<(u32, String, Option<String>, Option<String>, Option<String>, Option<f64>, Option<f64>, Option<String>, Option<f64>, Option<f64>, Option<f64>)>| { + |row: Option<( + u32, + String, + Option<String>, + Option<String>, + Option<String>, + Option<f64>, + Option<f64>, + Option<String>, + Option<f64>, + Option<f64>, + Option<f64>, + )>| { row.map( - |(probeset_id, name, symbol, description, chr, mb, mean, locus, lrs, p_value, additive)| { + |( + probeset_id, + name, + symbol, + description, + chr, + mb, + mean, + locus, + lrs, + p_value, + additive, + )| { ProbeSetInfo { probeset_id, name, diff --git a/src/routes/groups.rs b/src/routes/groups.rs index 18a6f66..e4d512e 100644 --- a/src/routes/groups.rs +++ b/src/routes/groups.rs @@ -362,4 +362,3 @@ pub async fn group_datasets( .with_next("/groups") }) } - |
