Skip to main content

classify_extension_version

Function classify_extension_version 

Source
pub fn classify_extension_version(
    version: &str,
) -> Result<(ExtensionStability, &str), ExtensionError>
Expand description

Classifies an extension version into its stability level.

This follows the DuckDB core extension versioning scheme:

  • Unstable: a short git hash (7+ lowercase hex characters)
  • Pre-release: semver 0.y.z
  • Stable: semver x.y.z where x > 0

The semver forms may carry one leading v (v0.1.0, v1.0.0): DuckDB’s versioning page writes the tiers that way, and extension-ci-tools (scripts/configure_helper.py) stamps the git tag at HEAD — usually vX.Y.Z — as the extension version. DuckDB itself treats the version as an opaque string (extension_load.cpp only stores and compares it). The returned &str is the input, unchanged.

§Errors

Returns ExtensionError if the version string is empty or does not match any recognized format.

§Example

use quack_rs::validate::semver::{classify_extension_version, ExtensionStability};

let (stability, _) = classify_extension_version("1.0.0").unwrap();
assert_eq!(stability, ExtensionStability::Stable);

let (stability, _) = classify_extension_version("0.1.0").unwrap();
assert_eq!(stability, ExtensionStability::PreRelease);

let (stability, _) = classify_extension_version("v1.2.0").unwrap();
assert_eq!(stability, ExtensionStability::Stable);

let (stability, _) = classify_extension_version("690bfc5").unwrap();
assert_eq!(stability, ExtensionStability::Unstable);