Fix handling stack
parent: tbd commit: c53b026
1 | use Error; |
2 | |
3 | use Repository; |
4 | use AnySetting; |
5 | use User; |
6 | |
7 | use PgPool; |
8 | |
9 | use MetadataBackend; |
10 | |
11 | |
12 | pub pg_pool: PgPool, |
13 | |
14 | |
15 | |
16 | |
17 | async |
18 | let row = query_as! |
19 | UserSettingRow, |
20 | "SELECT * FROM user_settings WHERE username = $1 AND name = $2", |
21 | user.username, |
22 | name |
23 | |
24 | .fetch_one |
25 | .await?; |
26 | |
27 | let setting = from_str?; |
28 | |
29 | Ok |
30 | |
31 | async |
32 | &mut self, |
33 | user: &User, |
34 | name: &str, |
35 | value: AnySetting, |
36 | |
37 | ! | query
38 | user.username, name, to_string? |
39 | .execute .await?; |
40 | |
41 | Ok |
42 | |
43 | |
44 | async |
45 | &mut self, |
46 | repository: &Repository, |
47 | name: &str, |
48 | |
49 | let row = query_as! |
50 | RepositorySettingRow, |
51 | "SELECT * FROM repository_settings WHERE repository = $1 AND name = $2", |
52 | repository.to_string, |
53 | name |
54 | |
55 | .fetch_one |
56 | .await?; |
57 | |
58 | let setting = from_str?; |
59 | |
60 | Ok |
61 | |
62 | async |
63 | &mut self, |
64 | repository: &Repository, |
65 | name: &str, |
66 | value: AnySetting, |
67 | |
68 | ! | query
69 | format!, name, to_string? |
70 | .execute .await?; |
71 | |
72 | Ok |
73 | |
74 | |
75 | |
76 | |
77 | |
78 | |
79 | pub username: String, |
80 | pub name: String, |
81 | pub value: String, |
82 | |
83 | |
84 | |
85 | |
86 | |
87 | pub repository: String, |
88 | pub name: String, |
89 | pub value: String, |
90 | |
91 |