Skip to main content

add_multiple_versions

Function add_multiple_versions 

Source
pub async fn add_multiple_versions(
    db: &Database,
    name: &str,
    owner: &str,
    versions: &[&str],
) -> DbResult<Vec<i64>>
Expand description

Add multiple versions of a crate at once.

This is a convenience function for tests that need to set up a crate with multiple versions quickly.

§Arguments

  • db - The database connection
  • name - The crate name
  • owner - The owner username
  • versions - Slice of version strings to add (e.g., ["1.0.0", "2.0.0"])

§Returns

A vector of crate IDs for each version added.

§Example

let ids = add_multiple_versions(test_db, "mycrate", "admin", &["1.0.0", "2.0.0", "3.0.0"])
    .await
    .unwrap();