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