|
ORE Studio 0.0.4
|
Strongly-typed, validated cron expression. More...
#include <cron_expression.hpp>

Public Member Functions | |
| cron_expression () | |
| Default constructor. Creates an expression that runs every minute. | |
| const std::string & | to_string () const noexcept |
| The validated cron string, suitable for pg_cron's cron.schedule(). | |
| std::chrono::system_clock::time_point | next_occurrence (std::chrono::system_clock::time_point after=std::chrono::system_clock::now()) const |
| Compute the next occurrence after the given time point. | |
| bool | operator== (const cron_expression &other) const noexcept=default |
Static Public Member Functions | |
| static std::expected< cron_expression, std::string > | from_string (std::string_view expr) |
| Parse and validate a cron expression string. | |
Strongly-typed, validated cron expression.
Wraps a cron expression string, validating it on construction via croncpp. Provides C++23 chrono-based next-occurrence computation and serialisation to the plain string required by pg_cron's cron.schedule() function.
Use the factory method from_string() to construct:
| cron_expression | ( | ) |
Default constructor. Creates an expression that runs every minute.
Provides a valid default state so that types containing cron_expression (e.g. job_definition) can be default-constructed for UI purposes. Equivalent to "* * * * *".

|
static |
Parse and validate a cron expression string.
Accepts standard 5-field cron syntax (minute hour day month weekday). Returns an error string if the expression is malformed.

| std::chrono::system_clock::time_point next_occurrence | ( | std::chrono::system_clock::time_point | after = std::chrono::system_clock::now() | ) | const |
Compute the next occurrence after the given time point.
Defaults to the current wall-clock time when no argument is supplied.