diff options
Diffstat (limited to 'basetypes')
-rw-r--r-- | basetypes/src/main/kotlin/moe/nea/ledger/utils/ULIDWrapper.kt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/basetypes/src/main/kotlin/moe/nea/ledger/utils/ULIDWrapper.kt b/basetypes/src/main/kotlin/moe/nea/ledger/utils/ULIDWrapper.kt index b8c5d3b..29d5e31 100644 --- a/basetypes/src/main/kotlin/moe/nea/ledger/utils/ULIDWrapper.kt +++ b/basetypes/src/main/kotlin/moe/nea/ledger/utils/ULIDWrapper.kt @@ -9,6 +9,14 @@ value class ULIDWrapper( val wrapped: String ) { companion object { + fun lowerBound(timestamp: Instant): ULIDWrapper { + return ULIDWrapper(ULID.generate(timestamp.toEpochMilli(), ByteArray(10))) + } + + fun upperBound(timestamp: Instant): ULIDWrapper { + return ULIDWrapper(ULID.generate(timestamp.toEpochMilli(), ByteArray(10) { -1 })) + } + fun createULIDAt(timestamp: Instant): ULIDWrapper { return ULIDWrapper(ULID.generate( timestamp.toEpochMilli(), |