cronsvc

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 4 Imported by: 0

README

cronsvc

This example illustrates how to generate code for Cron jobs.

Generate the code

$ go generate

Test the code

$ go run cmd/main.go
2022/10/09 11:06:12 Sending an email
2022/10/09 11:06:17 Sending an email
2022/10/09 11:06:22 Sending an email

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeEndpointOfSendEmail

func MakeEndpointOfSendEmail(s Service) endpoint.Endpoint

MakeEndpointOfSendEmail creates the endpoint for s.SendEmail.

func NewCronJobs

func NewCronJobs(svc Service) []micron.Job

Types

type Handler

type Handler struct{}

func (*Handler) SendEmail

func (h *Handler) SendEmail(ctx context.Context) error

type SendEmailResponse

type SendEmailResponse struct {
	Err error `json:"-"`
}

func (*SendEmailResponse) Body

func (r *SendEmailResponse) Body() interface{}

func (*SendEmailResponse) Failed

func (r *SendEmailResponse) Failed() error

Failed implements endpoint.Failer.

type Service

type Service interface {
	//kun:cron expr='@every 5s'
	SendEmail(ctx context.Context) error
}

Service is used for handling cron jobs.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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