diff --git a/core/ext/uuid.rs b/core/ext/uuid.rs index 92fdd831..40588466 100644 --- a/core/ext/uuid.rs +++ b/core/ext/uuid.rs @@ -71,6 +71,22 @@ pub fn exec_uuid4() -> crate::Result { ))) } +pub fn exec_uuid4str() -> crate::Result { + Ok(OwnedValue::Text(LimboText::new(Rc::new(Uuid::new_v4().to_string())))) +} + +pub fn exec_uuid7() -> crate::Result { + Ok(OwnedValue::Blob(Rc::new(Uuid::new_v7(Timestamp::now(ContextV7::new())).into_bytes().to_vec()))) +} + +pub fn exec_uuid7_ts(ref seconds) -> crate::Result { + if(*seconds < 0){ + return Ok(OwnedValue::Null); + } + let ctx = ContextV7::new(); + Ok(OwnedValue::Blob(Rc::new(Uuid::new_v7(Timestamp::from_unix(ctx, *seconds as u64, 0)).into_bytes().to_vec()))) +} + pub fn exec_uuidstr(reg: &OwnedValue) -> crate::Result { match reg { OwnedValue::Blob(blob) => {