fill changelog

This commit is contained in:
2021-01-02 21:55:06 +06:00
parent 365adb1016
commit bbb4f41723
3 changed files with 27 additions and 2 deletions

View File

@@ -21,4 +21,7 @@ interface KronScheduler {
suspend fun next(relatively: DateTime = DateTime.now()): DateTime?
}
suspend fun KronScheduler.forceNext(relatively: DateTime = DateTime.now()): DateTime = next(relatively) ?: getAnyNext(relatively)
suspend fun KronScheduler.nextOrRelative(relatively: DateTime = DateTime.now()): DateTime = next(relatively) ?: getAnyNext(relatively)
suspend fun KronScheduler.nextOrNow(): DateTime = DateTime.now().let {
next(it) ?: getAnyNext(it)
}

View File

@@ -1,5 +1,18 @@
package dev.inmo.krontab
/**
* This class contains [template] and can be simply serialized/deserialized. In fact that class will work as
* [dev.inmo.krontab.internal.CronDateTimeScheduler] due to the fact that [toKronScheduler] will return it under the
* hood
*/
data class KrontabTemplateWrapper(
val template: KrontabTemplate
) : KronScheduler by template.toKronScheduler()
/**
* Will create [KrontabTemplateWrapper] from [this] [KrontabTemplate]
*
* @see [toKronScheduler]
* @see [KrontabTemplateWrapper]
*/
fun KrontabTemplate.wrapAsKronScheduler() = KrontabTemplateWrapper(this)