git.iko.soy/rowtype-yoga/purescript-yoga-postgres
on main help sign in
Remove Yoga.Postgres.UUID module, genUUIDv7 lives in purescript-uuid fork
commit260844bbeaa16e4580b8e4a3b27fda9d65f26e1c authorMark <mark.eibes@gmail.com> dateSun 15 Feb 2026, 23:18 (8 months ago) parenta2e3fc1
2 files changed−46
src/Yoga/Postgres/UUID.js−26 src/Yoga/Postgres/UUID.purs−20
src/Yoga/Postgres/UUID.jsdeleted−26
@@ -1,26 +0,0 @@
1−export const genUUIDv7Impl = () => {
2− const now = Date.now()
3− const bytes = new Uint8Array(16)
4− crypto.getRandomValues(bytes)
5− // 48-bit timestamp (ms since epoch) in bytes 0-5
6− bytes[0] = (now / 2 ** 40) & 0xff
7− bytes[1] = (now / 2 ** 32) & 0xff
8− bytes[2] = (now / 2 ** 24) & 0xff
9− bytes[3] = (now / 2 ** 16) & 0xff
10− bytes[4] = (now / 2 ** 8) & 0xff
11− bytes[5] = now & 0xff
12− // version 7
13− bytes[6] = (bytes[6] & 0x0f) | 0x70
14− // variant 10xx
15− bytes[8] = (bytes[8] & 0x3f) | 0x80
16− const hex = Array.from(bytes, b => b.toString(16).padStart(2, '0')).join('')
17− return (
18− hex.slice(0, 8) + '-' +
19− hex.slice(8, 12) + '-' +
20− hex.slice(12, 16) + '-' +
21− hex.slice(16, 20) + '-' +
22− hex.slice(20, 32)
23− )
24−}
25−
26−export const genUUIDv4Impl = () => crypto.randomUUID()
src/Yoga/Postgres/UUID.pursdeleted−20
@@ -1,20 +0,0 @@
1−module Yoga.Postgres.UUID where
2−
3−import Prelude
4−
5−import Effect (Effect)
6−import Yoga.Postgres.Schema (UUID(..))
7−
8−foreign import genUUIDv7Impl :: Effect String
9−
10−genUUIDv7 :: Effect UUID
11−genUUIDv7 = do
12− s <- genUUIDv7Impl
13− pure (UUID s)
14−
15−foreign import genUUIDv4Impl :: Effect String
16−
17−genUUIDv4 :: Effect UUID
18−genUUIDv4 = do
19− s <- genUUIDv4Impl
20− pure (UUID s)