Documentation
¶
Index ¶
- type Executor
- type JobDefineOption
- type JobDefineOptions
- type JobExecutionContext
- func (j *JobExecutionContext) ClearLogs()
- func (j *JobExecutionContext) GetLogs() string
- func (j *JobExecutionContext) GetMetadata(key string) map[string]any
- func (j *JobExecutionContext) GetMetadataField(key string) (any, bool)
- func (j *JobExecutionContext) WriteLog(line string) error
- func (j *JobExecutionContext) WriteLogWithLevel(line string, level LogLevel) error
- type LogEntry
- type LogLevel
- type Option
- type Options
- type Schedo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor func(ctx *JobExecutionContext) (string, error)
Executor is a function that takes a JobExecutionContext and returns a string and an error This function must be implemented by the user and is the main entry point for the job The string returned by this function will be stored in the database as the job's output The error returned by this function will be stored in the database as the job's error
type JobDefineOption ¶
type JobDefineOption func(*JobDefineOptions)
func WithBlocking ¶
func WithBlocking(blocking bool) JobDefineOption
func WithMetadata ¶
func WithMetadata(metadata map[string]any) JobDefineOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) JobDefineOption
type JobDefineOptions ¶
func NewJobDefineOptions ¶
func NewJobDefineOptions(opts ...JobDefineOption) *JobDefineOptions
type JobExecutionContext ¶
type JobExecutionContext struct { ExecutionID int64 JobCode string context.Context // contains filtered or unexported fields }
func NewJobExecutionContext ¶
func (*JobExecutionContext) ClearLogs ¶ added in v0.0.25
func (j *JobExecutionContext) ClearLogs()
ClearLogs removes all collected logs
func (*JobExecutionContext) GetLogs ¶ added in v0.0.25
func (j *JobExecutionContext) GetLogs() string
GetLogs returns all collected logs as a single string with each entry on a new line Format: [LEVEL] message
func (*JobExecutionContext) GetMetadata ¶
func (j *JobExecutionContext) GetMetadata(key string) map[string]any
func (*JobExecutionContext) GetMetadataField ¶
func (j *JobExecutionContext) GetMetadataField(key string) (any, bool)
func (*JobExecutionContext) WriteLog ¶
func (j *JobExecutionContext) WriteLog(line string) error
func (*JobExecutionContext) WriteLogWithLevel ¶ added in v0.0.25
func (j *JobExecutionContext) WriteLogWithLevel(line string, level LogLevel) error
WriteLogWithLevel writes a log line with the specified log level
type LogLevel ¶ added in v0.0.25
type LogLevel string
LogLevel represents the severity level of a log entry
type Options ¶
func NewSDKOptions ¶
type Schedo ¶
type Schedo struct {
// contains filtered or unexported fields
}
func (*Schedo) DefineJob ¶
func (s *Schedo) DefineJob(name, schedule string, executor Executor, options ...JobDefineOption) error
DefineJob defines a new job with the given name, schedule, and executor It sends the jobs to the Schedo API and stores the executor in the Schedo instance If the job is successfully defined, DefineJob returns nil In case of schedule change, the job will be updated in the Schedo API and its schedule will be changed