dynamo-browse/internal/dynamo-browse/services/jobs/models.go
Leon Mika 3f1aec2c87
Made table information available to scripts (#49)
- Added a property with table information to session and result set Script types
- Added the ability to add new key bindings to the script
- Rebuilt the foreground job dispatcher to reduce the occurrence of the progress indicator showing up when no job was running.
- Fixed rebinding of keys. Rebinding a key will no longer clear other keys for the old or new bindings.
2023-02-22 21:53:05 +11:00

33 lines
483 B
Go

package jobs
import "context"
const (
JobStartEvent = "jobs.start"
JobIdleEvent = "jobs.idle"
JobUpdateEvent = "jobs.update"
)
type EventData struct {
Job Job
}
type Job interface {
Execute(ctx context.Context)
}
type JobFunc func(ctx context.Context)
func (jf JobFunc) Execute(ctx context.Context) {
jf(ctx)
}
func WithDescription(description string, job Job) Job {
return DescribableJob{job, description}
}
type DescribableJob struct {
Job
Description string
}