Add UUID v4 and v7 to edge functions #55
Answered
by
jacobprall
fkollmann
asked this question in
Feature request
-
Hi, please add This is the workaround implementation, I am currently using: const uuidv7 = () => { // original source: https://stackoverflow.com/a/77802638
return 'tttttttt-tttt-7xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.trunc(Math.random() * 16);
const v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
}).replace(/^[t]{8}-[t]{4}/, function() {
const unixtimestamp = Date.now().toString(16);
const padded = (new Array(12 - unixtimestamp.length + 1).join('0') + unixtimestamp); // Custom padStart
return padded.slice(0, 8) + '-' + padded.slice(8);
});
}; I thinks this should be provided as an optimized version from the (SQlite Cloud) platform, instead. Best Regards, |
Beta Was this translation helpful? Give feedback.
Answered by
jacobprall
Dec 14, 2024
Replies: 1 comment
-
Hey Felix! Jacob |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jacobprall
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Felix!
Thank you for the suggestion! We will add this to a list of major improvements to Edge functions planned for Q1 of 2025.
Jacob