db_dump/lib.rs
1//! [![github]](https://github.com/dtolnay/db-dump) [![crates-io]](https://crates.io/crates/db-dump) [![docs-rs]](https://docs.rs/db-dump)
2//!
3//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
4//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
5//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs
6
7#![doc(html_root_url = "https://docs.rs/db-dump/0.8.0")]
8#![cfg_attr(not(check_cfg), allow(unexpected_cfgs))]
9#![allow(
10 clippy::cast_lossless,
11 clippy::cast_possible_truncation,
12 clippy::doc_markdown,
13 clippy::elidable_lifetime_names,
14 clippy::missing_errors_doc,
15 clippy::missing_panics_doc,
16 clippy::module_name_repetitions,
17 clippy::must_use_candidate,
18 clippy::needless_lifetimes,
19 clippy::needless_type_cast,
20 clippy::too_many_lines,
21 clippy::uninlined_format_args,
22 clippy::unnecessary_map_or,
23 clippy::unreadable_literal,
24 clippy::unseparated_literal_suffix
25)]
26
27extern crate self as db_dump;
28
29mod bool;
30mod date;
31mod datetime;
32mod error;
33mod ignore;
34mod load;
35mod set;
36
37pub mod categories;
38pub mod crate_downloads;
39pub mod crate_owners;
40pub mod crates;
41pub mod crates_categories;
42pub mod crates_keywords;
43pub mod default_versions;
44pub mod deleted_crates;
45pub mod dependencies;
46pub mod keywords;
47pub mod metadata;
48pub mod oauth_github;
49pub mod reserved_crate_names;
50pub mod reserved_usernames;
51pub mod teams;
52pub mod users;
53pub mod version_downloads;
54pub mod versions;
55
56pub use crate::date::Date;
57pub use crate::error::{Error, Result};
58pub use crate::load::{Loader, load_all};
59
60/// A crates.io DB dump with *everything* deserialized into memory. Use
61/// [`Loader`] to load only parts of a dump, which is more efficient.
62///
63/// One of these full dumps can be loaded via [`db_dump::load_all`].
64#[derive(Default)]
65#[non_exhaustive]
66pub struct DbDump {
67 /// <table style="width:initial"><tr>
68 /// <th>categories.csv</th>
69 /// <td>id</td>
70 /// <td>category</td>
71 /// <td>slug</td>
72 /// <td>description</td>
73 /// <td>crates_cnt</td>
74 /// <td>created_at</td>
75 /// <td>path</td>
76 /// </tr></table>
77 pub categories: Vec<categories::Row>,
78
79 /// <table style="width:initial"><tr>
80 /// <th>crate_downloads.csv</th>
81 /// <td>crate_id</td>
82 /// <td>downloads</td>
83 /// </tr></table>
84 pub crate_downloads: Vec<crate_downloads::Row>,
85
86 /// <table style="width:initial"><tr>
87 /// <th>crate_owners.csv</th>
88 /// <td>crate_id</td>
89 /// <td>owner_id</td>
90 /// <td>created_at</td>
91 /// <td>created_by</td>
92 /// <td>owner_kind</td>
93 /// </tr></table>
94 pub crate_owners: Vec<crate_owners::Row>,
95
96 /// <table style="width:initial"><tr>
97 /// <th>crates.csv</th>
98 /// <td>id</td>
99 /// <td>name</td>
100 /// <td>updated_at</td>
101 /// <td>created_at</td>
102 /// <td>description</td>
103 /// <td>homepage</td>
104 /// <td>documentation</td>
105 /// <td>readme</td>
106 /// <td>repository</td>
107 /// <td>max_upload_size</td>
108 /// <td>max_features</td>
109 /// <td>trustpub_only</td>
110 /// </tr></table>
111 pub crates: Vec<crates::Row>,
112
113 /// <table style="width:initial"><tr>
114 /// <th>crates_categories.csv</th>
115 /// <td>crate_id</td>
116 /// <td>category_id</td>
117 /// </tr></table>
118 pub crates_categories: Vec<crates_categories::Row>,
119
120 /// <table style="width:initial"><tr>
121 /// <th>crates_keywords.csv</th>
122 /// <td>crate_id</td>
123 /// <td>keyword_id</td>
124 /// </tr></table>
125 pub crates_keywords: Vec<crates_keywords::Row>,
126
127 /// <table style="width:initial"><tr>
128 /// <th>default_versions.csv</th>
129 /// <td>crate_id</td>
130 /// <td>version_id</td>
131 /// <td>num_versions</td>
132 /// </tr></table>
133 pub default_versions: Vec<default_versions::Row>,
134
135 /// <table style="width:initial"><tr>
136 /// <th>deleted_crates.csv</th>
137 /// <td>id</td>
138 /// <td>name</td>
139 /// <td>created_at</td>
140 /// <td>deleted_at</td>
141 /// <td>deleted_by</td>
142 /// <td>message</td>
143 /// <td>available_at</td>
144 /// </tr></table>
145 pub deleted_crates: Vec<deleted_crates::Row>,
146
147 /// <table style="width:initial"><tr>
148 /// <th>dependencies.csv</th>
149 /// <td>id</td>
150 /// <td>version_id</td>
151 /// <td>crate_id</td>
152 /// <td>req</td>
153 /// <td>optional</td>
154 /// <td>default_features</td>
155 /// <td>features</td>
156 /// <td>target</td>
157 /// <td>kind</td>
158 /// <td>explicit_name</td>
159 /// </tr></table>
160 pub dependencies: Vec<dependencies::Row>,
161
162 /// <table style="width:initial"><tr>
163 /// <th>keywords.csv</th>
164 /// <td>id</td>
165 /// <td>keyword</td>
166 /// <td>crates_cnt</td>
167 /// <td>created_at</td>
168 /// </tr></table>
169 pub keywords: Vec<keywords::Row>,
170
171 /// <table style="width:initial"><tr>
172 /// <th>metadata.csv</th>
173 /// <td>total_downloads</td>
174 /// </tr></table>
175 pub metadata: metadata::Row,
176
177 /// <table style="width:initial"><tr>
178 /// <th>oauth_github.csv</th>
179 /// <td>user_id</td>
180 /// <td>account_id</td>
181 /// <td>login</td>
182 /// <td>avatar</td>
183 /// </tr></table>
184 pub oauth_github: Vec<oauth_github::Row>,
185
186 /// <table style="width:initial"><tr>
187 /// <th>reserved_crate_names.csv</th>
188 /// <td>name</td>
189 /// </tr></table>
190 pub reserved_crate_names: Vec<reserved_crate_names::Row>,
191
192 /// <table style="width:initial"><tr>
193 /// <th>reserved_usernames.csv</th>
194 /// <td>username</td>
195 /// </tr></table>
196 pub reserved_usernames: Vec<reserved_usernames::Row>,
197
198 /// <table style="width:initial"><tr>
199 /// <th>teams.csv</th>
200 /// <td>id</td>
201 /// <td>login</td>
202 /// <td>github_id</td>
203 /// <td>name</td>
204 /// <td>avatar</td>
205 /// <td>org_id</td>
206 /// </tr></table>
207 pub teams: Vec<teams::Row>,
208
209 /// <table style="width:initial"><tr>
210 /// <th>users.csv</th>
211 /// <td>id</td>
212 /// <td>gh_login</td>
213 /// <td>name</td>
214 /// <td>gh_id</td>
215 /// <td>username</td>
216 /// <td>created_at</td>
217 /// </tr></table>
218 pub users: Vec<users::Row>,
219
220 /// <table style="width:initial"><tr>
221 /// <th>version_downloads.csv</th>
222 /// <td>version_id</td>
223 /// <td>downloads</td>
224 /// <td>date</td>
225 /// </tr></table>
226 pub version_downloads: Vec<version_downloads::Row>,
227
228 /// <table style="width:initial"><tr>
229 /// <th>versions.csv</th>
230 /// <td>id</td>
231 /// <td>crate_id</td>
232 /// <td>num</td>
233 /// <td>updated_at</td>
234 /// <td>created_at</td>
235 /// <td>downloads</td>
236 /// <td>features</td>
237 /// <td>yanked</td>
238 /// <td>license</td>
239 /// <td>crate_size</td>
240 /// <td>published_by</td>
241 /// <td>checksum</td>
242 /// <td>links</td>
243 /// <td>rust_version</td>
244 /// <td>has_lib</td>
245 /// <td>bin_names</td>
246 /// <td>edition</td>
247 /// <td>description</td>
248 /// <td>homepage</td>
249 /// <td>documentation</td>
250 /// <td>repository</td>
251 /// </tr></table>
252 pub versions: Vec<versions::Row>,
253}