iceberg-cpp
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
iceberg::TransformUtil Class Reference

Static Public Member Functions

static std::string HumanYear (int32_t year)
 Returns a human-readable string for a year.
 
static std::string HumanMonth (int32_t month)
 Returns a human-readable string for a month.
 
static std::string HumanDay (int32_t day_ordinal)
 Returns a human-readable string for the given day ordinal.
 
static std::string HumanHour (int32_t hour_ordinal)
 Returns a human-readable string for the given hour ordinal.
 
static std::string HumanTime (int64_t micros_from_midnight)
 Outputs this time as a String, such as 10:15.
 
static std::string HumanTimestamp (int64_t timestamp_micros)
 Returns a string representation of a timestamp in microseconds.
 
static std::string HumanTimestampWithZone (int64_t timestamp_micros)
 Returns a human-readable string representation of a timestamp with a time zone.
 
static Result< int32_t > ParseDay (std::string_view str)
 Parses a date string in "[+-]yyyy-MM-dd" format into days since epoch.
 
static Result< int64_t > ParseTime (std::string_view str)
 Parses a time string into microseconds from midnight.
 
static Result< int64_t > ParseTimestamp (std::string_view str)
 Parses a timestamp string into microseconds since epoch.
 
static Result< int64_t > ParseTimestampWithZone (std::string_view str)
 Parses a timestamp-with-zone string into microseconds since epoch (UTC).
 
static std::string Base64Encode (std::string_view str_to_encode)
 Base64 encode a string.
 

Member Function Documentation

◆ HumanDay()

std::string iceberg::TransformUtil::HumanDay ( int32_t  day_ordinal)
static

Returns a human-readable string for the given day ordinal.

The string is formatted as: yyyy-MM-dd.

Parameters
day_ordinalThe day ordinal.
Returns
A human-readable string for the given day ordinal.

◆ HumanHour()

std::string iceberg::TransformUtil::HumanHour ( int32_t  hour_ordinal)
static

Returns a human-readable string for the given hour ordinal.

The string is formatted as: yyyy-MM-dd-HH.

Parameters
hour_ordinalThe hour ordinal.
Returns
A human-readable string for the given hour ordinal.

◆ HumanMonth()

std::string iceberg::TransformUtil::HumanMonth ( int32_t  month)
static

Returns a human-readable string for a month.

The string is formatted as "yyyy-MM".

Parameters
monthThe month to format.
Returns
A human-readable string for the month.

◆ HumanTime()

std::string iceberg::TransformUtil::HumanTime ( int64_t  micros_from_midnight)
static

Outputs this time as a String, such as 10:15.

The output will be one of the following ISO-8601 formats: HH:mm HH:mm:ss HH:mm:ss.SSS HH:mm:ss.SSSSSS The format used will be the shortest that outputs the full value of the time where the omitted parts are implied to be zero.

Parameters
microseconds_from_midnightthe time in microseconds from midnight
Returns
a string representation of this time

◆ HumanTimestamp()

std::string iceberg::TransformUtil::HumanTimestamp ( int64_t  timestamp_micros)
static

Returns a string representation of a timestamp in microseconds.

The output will be one of the following forms, according to the precision of the timestamp:

  • yyyy-MM-ddTHH:mm:ss
  • yyyy-MM-ddTHH:mm:ss.SSS
  • yyyy-MM-ddTHH:mm:ss.SSSSSS
Parameters
timestamp_microsthe timestamp in microseconds.
Returns
a string representation of this timestamp.

◆ HumanTimestampWithZone()

std::string iceberg::TransformUtil::HumanTimestampWithZone ( int64_t  timestamp_micros)
static

Returns a human-readable string representation of a timestamp with a time zone.

The output will be one of the following forms, according to the precision of the timestamp:

  • yyyy-MM-ddTHH:mm:ss+00:00
  • yyyy-MM-ddTHH:mm:ss.SSS+00:00
  • yyyy-MM-ddTHH:mm:ss.SSSSSS+00:00
Parameters
timestamp_microsthe timestamp in microseconds.
Returns
a string representation of this timestamp.

◆ HumanYear()

std::string iceberg::TransformUtil::HumanYear ( int32_t  year)
static

Returns a human-readable string for a year.

The string is formatted as "yyyy".

Parameters
yearThe year to format.
Returns
A human-readable string for the year.

◆ ParseDay()

Result< int32_t > iceberg::TransformUtil::ParseDay ( std::string_view  str)
static

Parses a date string in "[+-]yyyy-MM-dd" format into days since epoch.

Supports an optional '+' or '-' prefix for extended years beyond 9999.

Parameters
strThe date string to parse.
Returns
The number of days since 1970-01-01, or an error.

◆ ParseTime()

Result< int64_t > iceberg::TransformUtil::ParseTime ( std::string_view  str)
static

Parses a time string into microseconds from midnight.

Accepts ISO-8601 local time formats: "HH:mm", "HH:mm:ss", or "HH:mm:ss.f" where the fractional part can be 1-9 digits. Digits beyond 6 (microsecond precision) are truncated.

Parameters
strThe time string to parse.
Returns
The number of microseconds from midnight, or an error.

◆ ParseTimestamp()

Result< int64_t > iceberg::TransformUtil::ParseTimestamp ( std::string_view  str)
static

Parses a timestamp string into microseconds since epoch.

Accepts ISO-8601 local date-time formats: "yyyy-MM-ddTHH:mm", "yyyy-MM-ddTHH:mm:ss", or "yyyy-MM-ddTHH:mm:ss.f" where the fractional part can be 1-9 digits (truncated to microseconds).

Parameters
strThe timestamp string to parse.
Returns
The number of microseconds since epoch, or an error.

◆ ParseTimestampWithZone()

Result< int64_t > iceberg::TransformUtil::ParseTimestampWithZone ( std::string_view  str)
static

Parses a timestamp-with-zone string into microseconds since epoch (UTC).

Accepts the same formats as ParseTimestamp, with a timezone suffix: "Z", "+HH:mm", or "-HH:mm". Non-UTC offsets are converted to UTC. The seconds and fractional parts are optional (e.g. "yyyy-MM-ddTHH:mm+00:00").

Parameters
strThe timestamp string to parse.
Returns
The number of microseconds since epoch (UTC), or an error.

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