Documentation ¶
Index ¶
- Constants
- type Option
- type OptionType
- type PeriodicTask
- func (pt *PeriodicTask) Active() bool
- func (pt *PeriodicTask) HasOpts() bool
- func (pt *PeriodicTask) Options() []asynq.Option
- func (pt *PeriodicTask) SetEnabled(enabled bool) *PeriodicTask
- func (pt *PeriodicTask) SetOpts(opts []Option) *PeriodicTask
- func (pt *PeriodicTask) SetPayload(payload string) *PeriodicTask
- func (pt *PeriodicTask) Task() *asynq.Task
- type PeriodicTaskStorage
- type Plugin
- func (p *Plugin) Init(log *zap.Logger, db *mongo.Database) error
- func (p *Plugin) Name() string
- func (p *Plugin) PeriodicTaskProvider() asynq.PeriodicTaskConfigProvider
- func (p *Plugin) Provides() []any
- func (p *Plugin) Serve() chan error
- func (p *Plugin) Stop() error
- func (p *Plugin) Storage() PeriodicTaskStorage
Constants ¶
View Source
const PluginName = "scheduler_mongo_provider"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option struct { Type OptionType `json:"type" bson:"type"` Value string `json:"value" bson:"value"` }
type OptionType ¶
type OptionType string
const ( MaxRetryOpt OptionType = "max-retry" QueueOpt OptionType = "queue" TimeoutOpt OptionType = "timeout" DeadlineOpt OptionType = "deadline" UniqueOpt OptionType = "unique" ProcessAtOpt OptionType = "process-at" ProcessInOpt OptionType = "process-in" TaskIdOpt OptionType = "task-id" RetentionOpt OptionType = "retention" GroupOpt OptionType = "group" )
type PeriodicTask ¶
type PeriodicTask struct { Id string `json:"id,omitempty" bson:"_id"` CronExpr string `json:"cron_expr,omitempty" bson:"cron_expr,omitempty"` JobCode string `json:"job_code,omitempty" bson:"job_code,omitempty"` Payload *string `json:"payload,omitempty" bson:"payload,omitempty"` Opts *[]Option `json:"opts,omitempty" bson:"opts,omitempty"` CreatedAt time.Time `json:"created_at,omitempty" bson:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty" bson:"updated_at,omitempty"` Enabled *bool `json:"enabled,omitempty" bson:"enabled,omitempty"` }
func (*PeriodicTask) Active ¶
func (pt *PeriodicTask) Active() bool
func (*PeriodicTask) HasOpts ¶
func (pt *PeriodicTask) HasOpts() bool
func (*PeriodicTask) Options ¶
func (pt *PeriodicTask) Options() []asynq.Option
func (*PeriodicTask) SetEnabled ¶
func (pt *PeriodicTask) SetEnabled(enabled bool) *PeriodicTask
func (*PeriodicTask) SetOpts ¶
func (pt *PeriodicTask) SetOpts(opts []Option) *PeriodicTask
func (*PeriodicTask) SetPayload ¶
func (pt *PeriodicTask) SetPayload(payload string) *PeriodicTask
func (*PeriodicTask) Task ¶
func (pt *PeriodicTask) Task() *asynq.Task
type PeriodicTaskStorage ¶
type PeriodicTaskStorage interface { Find(ctx context.Context, criteria mongoext.Criteria) ([]PeriodicTask, error) Count(ctx context.Context, filter any) (int64, error) FindById(ctx context.Context, id string) (PeriodicTask, error) Save(ctx context.Context, model *PeriodicTask) error Delete(ctx context.Context, id string) error }
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) PeriodicTaskProvider ¶
func (p *Plugin) PeriodicTaskProvider() asynq.PeriodicTaskConfigProvider
func (*Plugin) Storage ¶
func (p *Plugin) Storage() PeriodicTaskStorage
Click to show internal directories.
Click to hide internal directories.