Package io.debezium.time
Class NanoDuration
java.lang.Object
io.debezium.time.NanoDuration
A utility representing a duration into a corresponding
INT64
number of nanosecond, and for defining a Kafka Connect Schema
for duration values.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.kafka.connect.data.SchemaBuilder
builder()
Returns aSchemaBuilder
for aNanoDuration
.static long
durationNanos
(int years, int months, int days, int hours, int minutes, long seconds) Converts a number of time units to a duration in nanoseconds.static long
durationNanos
(int years, int months, int days, int hours, int minutes, long seconds, long nanos) Converts a number of time units to a duration in nanoseconds.static org.apache.kafka.connect.data.Schema
schema()
Returns a Schema for aNanoDuration
but with all other default Schema settings.
-
Field Details
-
SCHEMA_NAME
- See Also:
-
-
Constructor Details
-
NanoDuration
private NanoDuration()
-
-
Method Details
-
builder
public static org.apache.kafka.connect.data.SchemaBuilder builder()Returns aSchemaBuilder
for aNanoDuration
. The resulting schema will describe a field with the "io.debezium.time.NanoDuration" as thename
andSchemaBuilder.int64()
()} INT64} for the literal type storing the number of nanoseconds for that duration.You can use the resulting SchemaBuilder to set or override additional schema settings such as required/optional, default value, and documentation.
- Returns:
- the schema builder
-
schema
public static org.apache.kafka.connect.data.Schema schema()Returns a Schema for aNanoDuration
but with all other default Schema settings. The schema describes a field with the "io.debezium.time.NanoDuration" as thename
andSchemaBuilder.int64()
()} INT64} for the literal type storing the number of nanoseconds.- Returns:
- the schema
- See Also:
-
durationNanos
public static long durationNanos(int years, int months, int days, int hours, int minutes, long seconds, long nanos) Converts a number of time units to a duration in nanoseconds.- Parameters:
years
- a number of yearsmonths
- a number of monthsdays
- a number of dayshours
- a number of hoursminutes
- a number of minutesseconds
- a number of secondsnanos
- a number of nanoseconds- Returns:
- Approximate representation of the given interval as a number of nanoseconds
-
durationNanos
public static long durationNanos(int years, int months, int days, int hours, int minutes, long seconds) Converts a number of time units to a duration in nanoseconds.- Parameters:
years
- a number of yearsmonths
- a number of monthsdays
- a number of dayshours
- a number of hoursminutes
- a number of minutesseconds
- a number of seconds- Returns:
- Approximate representation of the given interval as a number of nanoseconds
-