fill changelog

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

View File

@ -1,6 +1,6 @@
# Changelog
## 0.5.0
## 0.5.0 Years
**BREAKING CHANGES**
@ -8,6 +8,15 @@
* Old methods `merge` and `plus` related to `CronDateTimeScheduler` has been marked as `deprecated` and changed their
parameters types - it is `KronScheduler` now
* New methods `merge` has been added
* **`KronScheduler#next` method now is nullable. Use `nextOrRelative`/`nextOrNow` to get next time certainly**
* **Years was added as optional part of krontab template and opportunity in `SchedulerBuilder`**
* New builder `YearsBuilder`
* `SchedulerFlow#collectSafely` will be normally (without exceptions) finish when `next` of scheduler will return
null
* `KronScheduler#doOnce` will run code immediately in case when `next` is returning null value
* `KrontabTemplateWrapper` has been added
* New extension `KrontabTemplate#toKronScheduler` (works as `toSchedule`)
* **Fixed issue related to the fact that `toNearDateTime` of `CronDateTime` incorrectly handled months
## 0.4.2

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)