mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2025-10-22 23:20:08 +00:00
fill changelog
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user