NAME
Types::ULID - ULID type constraints
SYNOPSIS
use Types::ULID qw(ULID BinaryULID);
# coercion from undef will generate new ulid
has 'id' => (
is => 'ro',
isa => ULID,
coerce => 1,
default => sub { undef },
);
DESCRIPTION
Types::ULID is Type::Tiny type for Data::ULID. See https://github.com/ulid/spec for ulid specification.
Types
ULID
Type for text (base32-encoded) ulid. Can be coerced from undef
- generates a new ulid.
BinaryULID
Type for binary ulid. Can be coerced from undef
- generates a new ulid.
TODO: this does not currently check whether string contains multibyte characters.
ULID implementation
Coercions provided by this module will use Data::ULID::XS to generate new ULIDs if it is available.
Following functions are compiled into the module from the ULID implementation it found:
Types::ULID::ulid
Types::ULID::binary_ulid
Additionally, a constant can be queried for the current backend:
Types::ULID::ULID_BACKEND
these functions require Types::ULID version 0.004
SEE ALSO
AUTHOR
Bartosz Jarzyna <bbrtj.pro@gmail.com>
COPYRIGHT AND LICENSE
Copyright (C) 2022 by Bartosz Jarzyna
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.