Skip to content

isId

isId(value): value is string

A valid UUID. Note we do not check for a specific UUID version (which may have range limitations on elements). So this is not strict to RFC4122 / RFC9562. The main reason is that these identifiers may be user-supplied and are not fully internal to Alpyne. The user is free to submit any It follows the same rules as the native UUID in PostgreSQL. Note the spec is unclear, but you can demonstrate with:

-- Drop table if it exists
DROP TABLE IF EXISTS test_uuids;
-- Create a table with a UUID column
CREATE TABLE test_uuids (
id UUID PRIMARY KEY
);
-- Insert valid UUIDs
INSERT INTO test_uuids (id) VALUES ('550e8400-e29b-41d4-a716-446655440000'); -- Valid v4
INSERT INTO test_uuids (id) VALUES ('123e4567-e89b-12d3-a456-426614174000'); -- Valid v1
INSERT INTO test_uuids (id) VALUES ('123e4567-e89b-72d3-a456-426614174000'); -- Valid v7
-- Insert non-version-compliant UUIDs (PostgreSQL should still accept them)
INSERT INTO test_uuids (id) VALUES ('00000000-0000-0000-0000-000000000000'); -- No valid version
INSERT INTO test_uuids (id) VALUES ('550e8400-e29b-00d4-a716-446655440000'); -- Version 0 (invalid)
INSERT INTO test_uuids (id) VALUES ('550e8400-e29b-61d4-a716-446655440000'); -- Version 6 (not standard)
INSERT INTO test_uuids (id) VALUES ('550e8400-e29b-f1d4-a716-446655440000'); -- Version f (invalid)
-- Retrieve inserted rows
SELECT * FROM test_uuids;

Our UUIDs are LOWERCASE; similarly as this is the PostgreSQL default.

unknown

value is string

https://www.postgresql.org/docs/current/datatype-uuid.html