Documentation ¶
Overview ¶
Package repo is a package for the repo layer. It contains the repository interfaces and implementations.
Index ¶
- type CronTempHandler
- type CronTemplate
- func (dao *CronTemplate) BatchHandleRecords(ctx context.Context, t time.Time, batchSize int, f CronTempHandler) error
- func (dao *CronTemplate) FindByID(ctx context.Context, id uint) (*po.CronTriggerTemplate, error)
- func (dao *CronTemplate) Insert(ctx context.Context, p *po.CronTriggerTemplate) error
- func (dao *CronTemplate) PageQuery(ctx context.Context, p *constants.PageQuery, status pb.TriggerStatus) ([]*po.CronTriggerTemplate, int64, error)
- func (dao *CronTemplate) UpdateStatus(ctx context.Context, id uint, status pb.TriggerStatus) (int64, error)
- type CronTemplateDAO
- type WebhookTemplate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CronTempHandler ¶
type CronTempHandler func(results *po.CronTriggerTemplate) error
CronTempHandler is the handler for cron template It will be called when the cron template is ready to be executed
type CronTemplate ¶
type CronTemplate struct{}
CronTemplate is the repository for the CronTemplate entity.
func NewCronTemplate ¶
func NewCronTemplate(db *mysql.Client) *CronTemplate
NewCronTemplate returns a CronTemplate repository
func (*CronTemplate) BatchHandleRecords ¶
func (dao *CronTemplate) BatchHandleRecords(ctx context.Context, t time.Time, batchSize int, f CronTempHandler) error
BatchHandleRecords batch handle the records which need to be executed
func (*CronTemplate) FindByID ¶
func (dao *CronTemplate) FindByID(ctx context.Context, id uint) (*po.CronTriggerTemplate, error)
FindByID find a cron template by id
func (*CronTemplate) Insert ¶
func (dao *CronTemplate) Insert(ctx context.Context, p *po.CronTriggerTemplate) error
Insert create a cron template
func (*CronTemplate) PageQuery ¶
func (dao *CronTemplate) PageQuery(ctx context.Context, p *constants.PageQuery, status pb.TriggerStatus) ( []*po.CronTriggerTemplate, int64, error)
PageQuery query cron templates by page
func (*CronTemplate) UpdateStatus ¶
func (dao *CronTemplate) UpdateStatus(ctx context.Context, id uint, status pb.TriggerStatus) (int64, error)
UpdateStatus update the status of a cron template
type CronTemplateDAO ¶
type CronTemplateDAO interface { // FindByID find a cron template by id FindByID(ctx context.Context, id uint) (*po.CronTriggerTemplate, error) // PageQuery query cron templates by page PageQuery(ctx context.Context, p *constants.PageQuery, status pb.TriggerStatus) (res []*po.CronTriggerTemplate, count int64, err error) // Insert create a cron template Insert(ctx context.Context, e *po.CronTriggerTemplate) error // UpdateStatus update the status of a cron template UpdateStatus(ctx context.Context, id uint, status pb.TriggerStatus) (int64, error) // BatchHandleRecords batch handle the records which need to be executed BatchHandleRecords(ctx context.Context, t time.Time, batchSize int, f CronTempHandler) error }
CronTemplateDAO is the interface for the CronTemplate repository.
type WebhookTemplate ¶
type WebhookTemplate interface { // FindByID find a cron template by id FindByID(ctx context.Context, id uint) (*po.WebhookTriggerTemplate, error) // PageQuery query cron templates by page PageQuery(ctx context.Context, p *constants.PageQuery, status pb.TriggerStatus) (res []*po.WebhookTriggerTemplate, count int64, err error) // Insert create a webhook template Insert(ctx context.Context, p *po.WebhookTriggerTemplate) error // UpdateStatus update the status of a cron template UpdateStatus(ctx context.Context, id uint, status pb.TriggerStatus) (int64, error) }
WebhookTemplate is the interface for the webhook template repository.
func NewWebhookTemplate ¶
func NewWebhookTemplate(db *mysql.Client) WebhookTemplate
NewWebhookTemplate create a new Webhook template repository