Ensure build succeeds without uuid_unstable build flag

Closes #1403
This commit is contained in:
Tobie Morgan Hitchcock 2022-10-27 00:31:20 -07:00
parent b92536b649
commit 790935b2b5
2 changed files with 14 additions and 0 deletions

View file

@ -97,6 +97,13 @@ pub enum Error {
message: String,
},
/// There was a problem running the specified function
#[error("There was a problem running the {name}() function. {message}")]
InvalidFunction {
name: String,
message: String,
},
/// The wrong quantity or magnitude of arguments was given for the specified function
#[error("Incorrect arguments for function {name}(). {message}")]
InvalidArguments {

View file

@ -138,4 +138,11 @@ pub mod uuid {
pub fn v7(_: ()) -> Result<Value, Error> {
Ok(Uuid::new_v7().into())
}
#[cfg(not(uuid_unstable))]
pub fn v7(_: ()) -> Result<Value, Error> {
return Err(Error::InvalidFunction {
name: String::from("rand::uuid::v7"),
message: format!("This function is not enabled in this version of SurrealDB."),
});
}
}