crates.io
crates.io copied to clipboard
controllers/version: Add traits to help reduce data loading
This PR primarily addresses three things:
- Loading
CrateandVersionin a single query. - Adding helper traits to allow customization of the required columns to load and validation.
- Avoiding loading the entire
Cratewhen onlyVersionis needed.
First, I assume that in most cases, the given inputs are valid, then it would be great to load them in a single query.
Second, since most endpoints do not require all columns from Crate and Version, it would be nice to load only the necessary columns to reduce data loading.
Third, when only Version is required, it would be ideal to load only the ID of Crate to determine its existence.
I hope this doesn't overly complicate things :)
Rebased and conflict resolved!