2025-01-26 23:19:31 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
|
|
|
type Job struct {
|
|
|
|
Do func(ctx context.Context) error
|
|
|
|
}
|
2025-01-27 04:45:53 +00:00
|
|
|
|
|
|
|
func Jobs(jobs ...Job) Job {
|
|
|
|
return Job{Do: func(ctx context.Context) error {
|
|
|
|
for _, job := range jobs {
|
|
|
|
if err := job.Do(ctx); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}}
|
|
|
|
}
|