schedule

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(schedules Store) http.Handler

Create a schedule that will run a job based on a cron expression.

func Delete

func Delete(schedules Store) http.Handler

Delete a schedule.

func GetSchedules

func GetSchedules(schedules Store) http.Handler

GetSchedules returns all schedules outside the ones matching the exclusion list of schedule ids.

func GetSchedulesForProject

func GetSchedulesForProject(schedules Store) http.Handler

GetSchedulesForProject returns a project's schedules.

func Update

func Update(schedules Store) http.Handler

Update a schedule.

Types

type Postgres

type Postgres struct {
	DB *sql.DB
}

Postgres is the postgres schedule `Store` implementation.

func (*Postgres) Create

func (store *Postgres) Create(schedule Schedule) (scheduleID int64, err error)

Create a schedule.

func (*Postgres) Delete

func (store *Postgres) Delete(accountID, projectID, scheduleID int64) error

Delete a schedule.

func (*Postgres) GetAll

func (store *Postgres) GetAll(excludedIDs []int64) ([]Schedule, error)

GetAll all schedules, excluding the ids in the excluded list.

func (*Postgres) GetSchedulesForProject

func (store *Postgres) GetSchedulesForProject(accountID, projectID int64) ([]Schedule, error)

GetSchedulesForProject returns a project's schedules.

func (*Postgres) Update

func (store *Postgres) Update(schedule Schedule) (scheduleID int64, err error)

Update a schedule.

type Schedule

type Schedule struct {
	ID          int64
	ProjectID   int64
	AccountID   int64
	Title       string
	Cron        string
	Repository  string
	Description string
	Ref         string // e.g. refs/heads/master or refs/tags/v1.7.3
}

Schedule - defines how often a job will run against the specified repository and VCS ref e.g. a specific branch

type Store

type Store interface {
	// GetAll all schedules, excluding any ids in the excluded list.
	GetAll(excludedIDs []int64) ([]Schedule, error)

	// GetSchedulesForProject returns a project's schedules.
	GetSchedulesForProject(accountID, projectID int64) ([]Schedule, error)

	// Create a schedule.
	Create(schedule Schedule) (scheduleID int64, err error)

	// Update a schedule.
	Update(schedule Schedule) (scheduleID int64, err error)

	// Delete a schedule.
	Delete(accountID, projectID, scheduleID int64) error
}

Store - schedule store abstraction

Jump to

Keyboard shortcuts

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