docs/search/search_index.json

1 line
84 KiB
JSON
Raw Normal View History

{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"index.html","title":"Insanus Mokrassar libraries home","text":"<p>Hello :) It is my libraries docs place and I glad to welcome you here. I hope, this documentation place will help you.</p>"},{"location":"index.html#projects","title":"Projects","text":"<ul> <li>TelegramBotAPI</li> </ul>"},{"location":"krontab/describing/krontabscheduler.html","title":"KrontabScheduler","text":"<p><code>KronScheduler</code> is the simple interface with only one function <code>next</code>. This function optionally get as a parameter <code>DateTime</code> which will be used as start point for the calculation of next trigger time. This function will return the next <code>DateTime</code> when something must happen.</p>"},{"location":"krontab/describing/krontabscheduler.html#default-realisation","title":"Default realisation","text":"<p>Default realisation (<code>CronDateTimeScheduler</code>) can be created using several ways:</p> <ul> <li>Via <code>buildSchedule</code> (or <code>createSimpleScheduler</code>) functions with crontab-like syntax parameter</li> <li>Via <code>buildSchedule</code> (or <code>SchedulerBuilder</code> object), which using lambda to configure scheduler</li> </ul> <p>In the examples below the result of created scheduler will be the same.</p>"},{"location":"krontab/describing/krontabscheduler.html#crontab-like-way","title":"Crontab-like way","text":"<p>Crontab-like syntax</p> <p> See String format for more info about the crontab-line syntax</p> <p>This way will be very useful for cases when you need to configure something via external configuration (from file on startup or via some parameter from requests, for example):</p> <pre><code>val schedule = \"5 * * * *\"\nval scheduler = buildSchedule(schedule)\nscheduler.asFlow().onEach {\n// this block will be called every minute at 5 seconds\n}.launchIn(someCoroutineScope)\n</code></pre>"},{"location":"krontab/describing/krontabscheduler.html#lambda-way","title":"Lambda way","text":"<p>In case of usage builder (lets call it <code>lambda way</code>), you will be able to configure scheduler in more type-safe way:</p> <pre><code>val scheduler = buildSchedule {\nseconds {\nat(5)\n}\n}\nscheduler.asFlow().onEach {\n// this block will be called every minute at 5 seconds\n}.launchIn(someCoroutineScope)\n</code></pre>"},{"location":"krontab/describing/krontabscheduler.html#custom-scheduler","title":"Custom scheduler","text":"<p>You are always able to use your own realisation of scheduler. For example:</p> <pre><code>class RandomScheduler : KronScheduler {\noverride suspend fun next(relatively: DateTime): DateTime {\nreturn relatively + DateTimeSpan(seconds = Random.nextInt() % 60)\n}\n}\n</code></pre> <p>In the example above we have created <code>RandomScheduler</code>, which will return random next time in range <code>0-60</code> seconds since <code>relatively</code> argument.</p>"},{"location":"krontab/describing/string-format.html","title":"String format","text":"<p>As in <code>crontab</code> util, this library have almost the same format of string:</p> Seconds Minutes Hours Days of months Months Years Timezone Offset Week days Milliseconds Range 0..59 0..59 0..23 0..30 0..11 Any <code>Int</code> Any <code>Int</code> 0..6 0..999 Suffix - - - - - - <code>o</code> <code>w</code> <code>ms</code> Optional \u274c \u274c \u274c \u274c \u274c \u2705 \u2705 \u2705 \u2705 Full syntax support \u2705 \u2705 \u2705 \u2705 \u2705 \u2705 \u274c \u2705 \u2705 Position 0 1 2 3 4 Any after months Any after months Any after months Any after months Examples <code>0</code>, <code>*/15</code>, <code>30</code> <code>0</code>, <code>*/15</code>, <code>30</code> <code>0</code>, <code>*/15</code>, <code>22</code> <code>0</code>, <code>*/15</code>, <code>30</code> <code>0</code>, <code>*/5</code>, <code>11</code> <code>0</code>, <code>*/15</code>, <code>30</code> <code>60o</code> (UTC+1) <code>0w</code>, <code>*/2w</code>, <code>4w</code> <code>0ms</code>, <code>*/150ms</code>, <code>300ms</code> <p>Example w