repo

package
v0.0.0-...-388d6c9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package repo is a package for the repo layer. It contains the repository interfaces and implementations.

Index

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

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

Directories

Path Synopsis
Package po is the package of persistent object
Package po is the package of persistent object
storage
generate
Package main provides the gorm gen code
Package main provides the gorm gen code
sql

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL