Package lazyj
Class EpochTimeRange
java.lang.Object
lazyj.EpochTimeRange
public class EpochTimeRange
extends java.lang.Object
Wrap a PostgreSQL int8range column type with some simple operations. DBFunctions is now aware of this and can use it in
DBFunctions.composeInsert(String, java.util.Map)
and DBFunctions.composeUpdate(String, java.util.Map, java.util.Collection)
. If you want to parse a column simply say:
EpochTimeRange range = new EpochTimeRange(db.gets("validity"));
- Since:
- 2020-03-03
- Author:
- costing
-
Field Summary
Fields Modifier and Type Field Description long
endTime
End time of the intervalboolean
includingEnd
Whether or not the end of the interval is included in the rangeboolean
includingStart
Whether or not the start of the interval is included in the rangelong
startTime
Start time of the interval -
Constructor Summary
Constructors Constructor Description EpochTimeRange()
default object is valid from now (inclusive) to infinity (exclusive :) )EpochTimeRange(java.lang.String dbValue)
Initialize the interval endpoints from the database value (PostgreSQL text serialization of it) -
Method Summary
Modifier and Type Method Description java.lang.String
toSQLString()
java.lang.String
toString()
-
Field Details
-
includingStart
public boolean includingStartWhether or not the start of the interval is included in the range -
includingEnd
public boolean includingEndWhether or not the end of the interval is included in the range -
startTime
public long startTimeStart time of the interval -
endTime
public long endTimeEnd time of the interval
-
-
Constructor Details
-
EpochTimeRange
public EpochTimeRange()default object is valid from now (inclusive) to infinity (exclusive :) ) -
EpochTimeRange
public EpochTimeRange(java.lang.String dbValue)Initialize the interval endpoints from the database value (PostgreSQL text serialization of it)- Parameters:
dbValue
- DB column value
-
-
Method Details
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
toSQLString
public java.lang.String toSQLString()- Returns:
- SQL representation of the value for this tuple
-