Base protocol refactor complete
parent: tbd commit: 079d544
1 | use Error; |
2 | |
3 | use ; |
4 | |
5 | use PgPool; |
6 | |
7 | use MetadataBackend; |
8 | |
9 | |
10 | pub pg_pool: PgPool, |
11 | |
12 | |
13 | |
14 | |
15 | async |
16 | todo! |
17 | |
18 | async |
19 | &mut self, |
20 | _user: &User, |
21 | _name: &str, |
22 | _value: AnySetting, |
23 | |
24 | // for (name, value) in settings { |
25 | // sqlx::query!("INSERT INTO user_settings VALUES ($1, $2, $3) ON CONFLICT (username, name) DO UPDATE SET value = $3", |
26 | // user.username, name, value) |
27 | // .execute(&self.pg_pool).await?; |
28 | // } |
29 | |
30 | // Ok(()) |
31 | |
32 | todo! |
33 | |
34 | |
35 | async |
36 | &mut self, |
37 | _repository: &Repository, |
38 | _name: &str, |
39 | |
40 | // let settings = sqlx::query_as!( |
41 | // RepositorySettingRow, |
42 | // r#"SELECT * FROM repository_settings WHERE repository = $1"#, |
43 | // repository.to_string() |
44 | // ) |
45 | // .fetch_many(&self.pg_pool) |
46 | // .filter_map(|result| async move { |
47 | // if let Ok(Either::Right(row)) = result { |
48 | // Some(row) |
49 | // } else { |
50 | // None |
51 | // } |
52 | // }) |
53 | // .filter_map(|row| async move { |
54 | // if let Ok(value) = serde_json::from_str(&row.value) { |
55 | // Some((row.name, value)) |
56 | // } else { |
57 | // None |
58 | // } |
59 | // }) |
60 | // .collect::<Vec<_>>() |
61 | // .await; |
62 | |
63 | // Ok(settings) |
64 | |
65 | todo! |
66 | |
67 | async |
68 | &mut self, |
69 | _repository: &Repository, |
70 | _name: &str, |
71 | _value: AnySetting, |
72 | |
73 | // for (name, value) in settings { |
74 | // sqlx::query!("INSERT INTO repository_settings VALUES ($1, $2, $3) ON CONFLICT (repository, name) DO UPDATE SET value = $3", |
75 | // repository.to_string(), name, value) |
76 | // .execute(&self.pg_pool).await?; |
77 | // } |
78 | |
79 | // Ok(()) |
80 | |
81 | todo! |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | |
88 | pub username: String, |
89 | pub name: String, |
90 | pub value: String, |
91 | |
92 | |
93 | |
94 | |
95 | |
96 | pub repository: String, |
97 | pub name: String, |
98 | pub value: String, |
99 | |
100 |