crons

package
v1.35.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateNames = errRange.New(
		"Duplicate Cron Jobs",
		"Multiple cron jobs with the same name were found. Cronjob names must be unique.",
	)

	ErrEndpointNotAnAPI = errRange.New(
		"Invalid call to cron.NewJob",
		"Endpoint does not reference an Encore API",
	)
)
View Source
var JobParser = &resourceparser.Parser{
	Name: "Cron Job",

	InterestingImports: []paths.Pkg{"encore.dev/cron"},
	Run: func(p *resourceparser.Pass) {
		name := pkginfo.QualifiedName{PkgPath: "encore.dev/cron", Name: "NewJob"}

		spec := &parseutil.ReferenceSpec{
			MinTypeArgs: 0,
			MaxTypeArgs: 0,
			Parse:       parseCronJob,
		}

		parseutil.FindPkgNameRefs(p.Pkg, []pkginfo.QualifiedName{name}, func(file *pkginfo.File, name pkginfo.QualifiedName, stack []ast.Node) {
			parseutil.ParseReference(p, spec, parseutil.ReferenceData{
				File:         file,
				Stack:        stack,
				ResourceFunc: name,
			})
		})
	},
}

Functions

This section is empty.

Types

type Job

type Job struct {
	AST      *ast.CallExpr
	File     *pkginfo.File
	Name     string // The unique name of the cron job
	Doc      string // The documentation on the cron job
	Title    string // cron job title
	Schedule string

	Endpoint    pkginfo.QualifiedName // The Endpoint reference
	EndpointAST ast.Expr
}

func (*Job) ASTExpr

func (j *Job) ASTExpr() ast.Expr

func (*Job) End

func (j *Job) End() token.Pos

func (*Job) Kind

func (j *Job) Kind() resource.Kind

func (*Job) Package

func (j *Job) Package() *pkginfo.Package

func (*Job) Pos

func (j *Job) Pos() token.Pos

func (*Job) ResourceName

func (j *Job) ResourceName() string

func (*Job) SortKey added in v1.16.3

func (j *Job) SortKey() string

Jump to

Keyboard shortcuts

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