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