Documentation
¶
Index ¶
- Constants
- type PostgresSchedulerRepository
- func (r *PostgresSchedulerRepository) Create(tx *sql.Tx, s *Schedule) error
- func (r *PostgresSchedulerRepository) CreateTable(tx *sql.Tx) error
- func (r *PostgresSchedulerRepository) Delete(tx *sql.Tx, pk int) error
- func (r *PostgresSchedulerRepository) DeleteAll(tx *sql.Tx) error
- func (r *PostgresSchedulerRepository) FindAllActive(tx *sql.Tx) ([]*Schedule, error)
- func (r *PostgresSchedulerRepository) FindAllActiveAndUnprocessed(tx *sql.Tx, moment time.Time) ([]*Schedule, error)
- func (r *PostgresSchedulerRepository) FindOne(tx *sql.Tx, pk int) (*Schedule, error)
- func (r *PostgresSchedulerRepository) Save(tx *sql.Tx, s *Schedule) error
- type Schedule
- type ScheduleQueryConfig
- type Scheduler
- type SchedulerConfig
- type SchedulerHandler
- type SchedulerRepository
- type SimpleScheduler
- type SimpleSchedulerConfig
- type SimpleSchedulerRepository
Constants ¶
View Source
const DefaultCronField = "cron"
View Source
const DefaultIdField = "id"
View Source
const DefaultIsActiveField = "is_active"
View Source
const DefaultLastRunAtField = "last_run_at"
View Source
const DefaultMessageField = "message"
View Source
const DefaultNameField = "name"
View Source
const DefaultNextRunAtField = "next_run_at"
View Source
const DefaultTableName = "barn_schedule"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresSchedulerRepository ¶
type PostgresSchedulerRepository struct {
// contains filtered or unexported fields
}
func (*PostgresSchedulerRepository) Create ¶
func (r *PostgresSchedulerRepository) Create(tx *sql.Tx, s *Schedule) error
func (*PostgresSchedulerRepository) CreateTable ¶
func (r *PostgresSchedulerRepository) CreateTable(tx *sql.Tx) error
func (*PostgresSchedulerRepository) Delete ¶
func (r *PostgresSchedulerRepository) Delete(tx *sql.Tx, pk int) error
func (*PostgresSchedulerRepository) DeleteAll ¶
func (r *PostgresSchedulerRepository) DeleteAll(tx *sql.Tx) error
func (*PostgresSchedulerRepository) FindAllActive ¶
func (r *PostgresSchedulerRepository) FindAllActive(tx *sql.Tx) ([]*Schedule, error)
func (*PostgresSchedulerRepository) FindAllActiveAndUnprocessed ¶ added in v0.2.3
type Schedule ¶
type ScheduleQueryConfig ¶
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
func NewScheduler ¶
func NewScheduler(db *sql.DB, config *SchedulerConfig) *Scheduler
func (*Scheduler) StartContext ¶
type SchedulerConfig ¶
type SchedulerConfig struct {
Log *slog.Logger
Repository SchedulerRepository
ReloadCron string
Handler SchedulerHandler
}
type SchedulerRepository ¶
type SchedulerRepository interface {
FindAllActive(tx *sql.Tx) ([]*Schedule, error)
FindOne(tx *sql.Tx, pk int) (*Schedule, error)
Save(tx *sql.Tx, s *Schedule) error
Delete(tx *sql.Tx, pk int) error
}
func NewPostgresSchedulerRepository ¶ added in v0.2.0
func NewPostgresSchedulerRepository(config ...ScheduleQueryConfig) SchedulerRepository
type SimpleScheduler ¶
type SimpleScheduler struct {
// contains filtered or unexported fields
}
func NewSimpleScheduler ¶
func NewSimpleScheduler(db *sql.DB, config *SimpleSchedulerConfig) *SimpleScheduler
func (*SimpleScheduler) Start ¶
func (s *SimpleScheduler) Start()
func (*SimpleScheduler) StartContext ¶
func (s *SimpleScheduler) StartContext(ctx context.Context)
func (*SimpleScheduler) Stop ¶
func (s *SimpleScheduler) Stop()
type SimpleSchedulerConfig ¶
type SimpleSchedulerConfig struct {
Log *slog.Logger
Repository SimpleSchedulerRepository
Cron string
Handler SchedulerHandler
}
type SimpleSchedulerRepository ¶ added in v0.2.3
type SimpleSchedulerRepository interface {
FindAllActiveAndUnprocessed(tx *sql.Tx, moment time.Time) ([]*Schedule, error)
FindOne(tx *sql.Tx, pk int) (*Schedule, error)
Save(tx *sql.Tx, s *Schedule) error
Delete(tx *sql.Tx, pk int) error
}
func NewPostgresSimpleSchedulerRepository ¶ added in v0.2.3
func NewPostgresSimpleSchedulerRepository(config ...ScheduleQueryConfig) SimpleSchedulerRepository
Click to show internal directories.
Click to hide internal directories.