iceberg-cpp
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
iceberg::Uuid Class Reference
Inheritance diagram for iceberg::Uuid:
iceberg::util::Formattable

Public Member Functions

 Uuid (std::array< uint8_t, kLength > data)
 
std::span< const uint8_t > bytes () const
 Get the raw bytes of the UUID.
 
uint8_t operator[] (size_t index) const
 Access individual bytes of the UUID.
 
std::string ToString () const override
 Convert the UUID to a string in standard format.
 
int64_t high_bits () const
 
int64_t low_bits () const
 

Static Public Member Functions

static Uuid GenerateV4 ()
 Generate a random UUID (version 4).
 
static Uuid GenerateV7 ()
 Generate UUID version 7 per RFC 9562, with the current timestamp.
 
static Uuid GenerateV7 (uint64_t unix_ts_ms)
 Generate UUID version 7 per RFC 9562, with the given timestamp.
 
static Result< UuidFromString (std::string_view str)
 Create a UUID from a string in standard format.
 
static Result< UuidFromBytes (std::span< const uint8_t > bytes)
 Create a UUID from a 16-byte array.
 

Static Public Attributes

static constexpr size_t kLength = 16
 

Friends

bool operator== (const Uuid &lhs, const Uuid &rhs)
 

Member Function Documentation

◆ GenerateV7()

Uuid iceberg::Uuid::GenerateV7 ( uint64_t  unix_ts_ms)
static

Generate UUID version 7 per RFC 9562, with the given timestamp.

UUID version 7 consists of a Unix timestamp in milliseconds (48 bits) and 74 random bits, excluding the required version and variant bits.

Parameters
unix_ts_msnumber of milliseconds since start of the UNIX epoch
Note
unix_ts_ms cannot be negative per RFC.

◆ operator[]()

uint8_t iceberg::Uuid::operator[] ( size_t  index) const

Access individual bytes of the UUID.

Parameters
indexThe index of the byte to access (0-15).
Returns
The byte at the specified index.
Exceptions
IcebergErrorif index is out of bounds.

◆ ToString()

std::string iceberg::Uuid::ToString ( ) const
overridevirtual

Convert the UUID to a string in standard format.

Implements iceberg::util::Formattable.


The documentation for this class was generated from the following files: