public class MicroDuration extends Object
FLOAT64
number of microsecond, and for defining a Kafka Connect Schema for duration values.
The duration is amount is stored in floating point as opposed to an integer because certain DBs (e.g. Postgres) will store
this amount internally into more than 8 bytes.| Modifier and Type | Field and Description |
|---|---|
static double |
DAYS_PER_MONTH_AVG
The approximation used by the plugins when converting a duration to micros
|
static String |
SCHEMA_NAME |
| Modifier | Constructor and Description |
|---|---|
private |
MicroDuration() |
| Modifier and Type | Method and Description |
|---|---|
static org.apache.kafka.connect.data.SchemaBuilder |
builder()
Returns a
SchemaBuilder for a MicroDuration. |
static double |
durationMicros(int years,
int months,
int days,
int hours,
int minutes,
double seconds,
Double daysPerMonthAvg)
Converts a number of time units to a duration in microseconds.
|
static double |
durationMicros(int years,
int months,
int days,
int hours,
int minutes,
double seconds,
int micros,
Double daysPerMonthAvg)
Converts a number of time units to a duration in microseconds.
|
static org.apache.kafka.connect.data.Schema |
schema()
Returns a Schema for a
MicroDuration but with all other default Schema settings. |
public static final double DAYS_PER_MONTH_AVG
public static final String SCHEMA_NAME
public static org.apache.kafka.connect.data.SchemaBuilder builder()
SchemaBuilder for a MicroDuration. The resulting schema will describe a field
with the "io.debezium.time.MicroDuration" as the name and SchemaBuilder.float64() FLOAT64} for the literal
type storing the number of microseconds for that duration.
You can use the resulting SchemaBuilder to set or override additional schema settings such as required/optional, default value, and documentation.
public static org.apache.kafka.connect.data.Schema schema()
MicroDuration but with all other default Schema settings. The schema describes a field
with the "io.debezium.time.MicroDuration" as the name and SchemaBuilder.float64() FLOAT64} for the literal
type storing the number of microseconds.builder()public static double durationMicros(int years,
int months,
int days,
int hours,
int minutes,
double seconds,
int micros,
Double daysPerMonthAvg)
years - a number of yearsmonths - a number of monthsdays - a number of dayshours - a number of hoursminutes - a number of minutesseconds - a number of secondsmicros - a number of microsecondsdaysPerMonthAvg - an optional value representing a days per month average; if null, the default duration
from ChronoUnit.MONTHS is used.BigDecimal value which contains the number of microseconds, never nullpublic static double durationMicros(int years,
int months,
int days,
int hours,
int minutes,
double seconds,
Double daysPerMonthAvg)
years - a number of yearsmonths - a number of monthsdays - a number of dayshours - a number of hoursminutes - a number of minutesseconds - a number of secondsdaysPerMonthAvg - an optional value representing a days per month average; if null, the default duration
from ChronoUnit.MONTHS is used.BigDecimal value which contains the number of microseconds, never nullCopyright © 2018 JBoss by Red Hat. All rights reserved.