mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2024-10-31 21:43:55 +00:00
extend scheduler shortcuts
This commit is contained in:
parent
d1f84ee136
commit
726e68c114
@ -3,12 +3,6 @@ package com.github.insanusmokrassar.krontab
|
|||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
|
||||||
private val anyCronDateTime by lazy {
|
|
||||||
CronDateTime()
|
|
||||||
}
|
|
||||||
|
|
||||||
val AnyTimeScheduler = CronDateTimeScheduler(listOf(anyCronDateTime))
|
|
||||||
|
|
||||||
data class CronDateTimeScheduler internal constructor(
|
data class CronDateTimeScheduler internal constructor(
|
||||||
internal val cronDateTimes: List<CronDateTime>
|
internal val cronDateTimes: List<CronDateTime>
|
||||||
)
|
)
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.github.insanusmokrassar.krontab
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.krontab.builder.buildSchedule
|
||||||
|
|
||||||
|
internal val anyCronDateTime by lazy {
|
||||||
|
CronDateTime()
|
||||||
|
}
|
||||||
|
val AnyTimeScheduler by lazy {
|
||||||
|
CronDateTimeScheduler(listOf(anyCronDateTime))
|
||||||
|
}
|
||||||
|
val EverySecondScheduler
|
||||||
|
get() = AnyTimeScheduler
|
||||||
|
|
||||||
|
val EveryMinuteScheduler by lazy {
|
||||||
|
buildSchedule { minutes { 0 every 1 } }
|
||||||
|
}
|
||||||
|
|
||||||
|
val EveryHourScheduler by lazy {
|
||||||
|
buildSchedule { hours { 0 every 1 } }
|
||||||
|
}
|
||||||
|
|
||||||
|
val EveryDayOfMonthScheduler by lazy {
|
||||||
|
buildSchedule { dayOfMonth { 0 every 1 } }
|
||||||
|
}
|
||||||
|
|
||||||
|
val EveryMonthScheduler by lazy {
|
||||||
|
buildSchedule { months { 0 every 1 } }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user