More progress :)
parent: tbd commit: 92c3f32
1 | use ; |
2 | |
3 | use Error; |
4 | use ; |
5 | use |
6 | , | PluginInitializationState
7 | , |
8 | , |
9 | ; |
10 | use PluginStackBuilder; |
11 | use |
12 | create_issue_request, edit_issue_request, issue_get_setting_contents, issue_get_setting_name, |
13 | issue_post_comment_request, issue_set_setting_contents, issue_set_setting_name, |
14 | issue_value_author, issue_value_comment_count, issue_value_creation_date, query_issues_request, |
15 | ; |
16 | use ; |
17 | use NotificationsOverride; |
18 | use ; |
19 | use ; |
20 | use Table; |
21 | use ; |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | /// An issue, defined by the repository which owns it and its index. |
30 | /// |
31 | /// # Textual Format |
32 | /// An issue's textual format is defined as: |
33 | /// |
34 | /// `@{index: u32}:{repository: Repository}` |
35 | |
36 | |
37 | pub repository: Repository, |
38 | pub id: u32, |
39 | |
40 | |
41 | |
42 | |
43 | f.write_str |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | "issue" |
50 | |
51 | |
52 | |
53 | self.repository.home_uri |
54 | |
55 | |
56 | |
57 | Ok |
58 | |
59 | |
60 | |
61 | |
62 | type Err = IssueParseError; |
63 | |
64 | |
65 | let = s.split_once .ok_or?; |
66 | |
67 | let id: u32 = index.parse .map_err?; |
68 | let repository = from_str .map_err?; |
69 | |
70 | Ok |
71 | |
72 | |
73 | |
74 | |
75 | |
76 | ; |
77 | |
78 | static INIT_VTABLE: = new; |
79 | static ASYNC_RUNTIME: = new; |
80 | |
81 | |
82 | pub extern "C" |
83 | const PLUGIN_NAME: &str = "Giterated [Issues]"; |
84 | const PLUGIN_VERSION: &str = "0.1.0"; |
85 | |
86 | FFIPluginMeta |
87 | name: PLUGIN_NAME.as_ptr, |
88 | name_len: PLUGIN_NAME.len, |
89 | version: PLUGIN_VERSION.as_ptr, |
90 | version_len: PLUGIN_VERSION.len, |
91 | |
92 | |
93 | |
94 | |
95 | pub extern "C" |
96 | println!; |
97 | |
98 | |
99 | |
100 | pub extern "C" |
101 | INIT_VTABLE.set .unwrap; |
102 | println!; |
103 | |
104 | |
105 | |
106 | pub extern "C" |
107 | // tracing_subscriber::fmt() |
108 | // .pretty() |
109 | // .with_thread_names(true) |
110 | // .with_max_level(Level::TRACE) |
111 | // .init(); |
112 | |
113 | PluginState |
114 | inner: Box into_raw, |
115 | |
116 | |
117 | |
118 | |
119 | pub extern "C" |
120 | state: *mut PluginInitializationState, |
121 | *mut PluginInitializationState |
122 | let runtime = new .unwrap; |
123 | |
124 | // let _guard: tracing::span::EnteredSpan = trace_span!("initialize_registration").entered(); |
125 | let init_vtable = INIT_VTABLE.get .unwrap; |
126 | |
127 | let db_pool = runtime.block_on |
128 | let config: Table = |
129 | let mut file = open .await.unwrap; |
130 | let mut text = String new; |
131 | file.read_to_string .await.unwrap; |
132 | text.parse .unwrap |
133 | ; |
134 | let db_conn_options = new |
135 | .host |
136 | .port |
137 | .database |
138 | .username |
139 | .password; |
140 | let db_pool = connect_with .await.unwrap; |
141 | |
142 | debug!; |
143 | // sqlx::migrate!().run(&db_pool).await.unwrap(); |
144 | info!; |
145 | |
146 | db_pool |
147 | ; |
148 | |
149 | ASYNC_RUNTIME.set .unwrap; |
150 | |
151 | let plugin_state = IssuesPluginState ; |
152 | |
153 | let mut builder: = |
154 | ; | new
155 | |
156 | builder.; |
157 | |
158 | builder |
159 | .object_setting |
160 | .object_setting; |
161 | |
162 | builder.; |
163 | |
164 | builder |
165 | .value |
166 | .value |
167 | .value |
168 | .value; |
169 | |
170 | builder |
171 | .operation |
172 | .operation |
173 | .operation |
174 | .operation; |
175 | |
176 | state |
177 | |
178 | |
179 | |
180 | |
181 | pub pool: PgPool, |
182 | |
183 |