Skip to content

Commit a8c26e0

Browse files
Annotations: add new UUID, update docs for external types #143
1 parent 33049a4 commit a8c26e0

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

objectbox/lib/src/annotations.dart

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,13 @@ enum ExternalPropertyType {
498498
/// Encoding: 1:1 binary representation, little endian (16 bytes)
499499
int128,
500500

501+
/// A UUID (Universally Unique Identifier) as defined by RFC 9562.
502+
///
503+
/// ObjectBox uses the UUIDv7 scheme (timestamp + random) to create new UUIDs.
504+
/// UUIDv7 is a good choice for database keys as it's mostly sequential and
505+
/// encodes a timestamp. However, if keys are used externally, consider
506+
/// [uuidV4] for better privacy by not exposing any time information.
507+
///
501508
/// Representing type: ByteVector
502509
///
503510
/// Encoding: 1:1 binary representation (16 bytes)
@@ -510,6 +517,33 @@ enum ExternalPropertyType {
510517
/// Encoding: 1:1 binary representation (16 bytes)
511518
decimal128,
512519

520+
/// UUID represented as a string of 36 characters, e.g.
521+
/// "019571b4-80e3-7516-a5c1-5f1053d23fff".
522+
///
523+
/// For efficient storage, consider the [uuid] type instead, which occupies
524+
/// only 16 bytes (20 bytes less). This type may still be a convenient
525+
/// alternative as the string type is widely supported and more
526+
/// human-readable. In accordance to standards, new UUIDs generated by
527+
/// ObjectBox use lowercase hexadecimal digits.
528+
///
529+
/// Representing type: String
530+
uuidString,
531+
532+
/// A UUID (Universally Unique Identifier) as defined by RFC 9562.
533+
///
534+
/// ObjectBox uses the UUIDv4 scheme (completely random) to create new UUIDs.
535+
///
536+
/// Representing type: ByteVector
537+
///
538+
/// Encoding: 1:1 binary representation (16 bytes)
539+
uuidV4,
540+
541+
/// Like [uuidString], but using the UUIDv4 scheme (completely random) to
542+
/// create new UUID.
543+
///
544+
/// Representing type: String
545+
uuidV4String,
546+
513547
/// A key/value map; e.g. corresponds to a JSON object or a MongoDB document
514548
/// (although not keeping the key order).
515549
///
@@ -550,7 +584,7 @@ enum ExternalPropertyType {
550584
/// A vector (array) of Int128 values.
551585
int128Vector,
552586

553-
/// A vector (array) of Int128 values
587+
/// A vector (array) of Uuid values
554588
uuidVector,
555589

556590
/// The 12-byte ObjectId type in MongoDB.

0 commit comments

Comments
 (0)