schedule

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreatePostgresTable represents a query to create the Postgres schedules table.
	CreatePostgresTable = `` /* 355-byte string literal not displayed */

	// CreateSqliteTable represents a query to create the Sqlite schedules table.
	CreateSqliteTable = `` /* 330-byte string literal not displayed */

)
View Source
const (
	// CreateRepoIDIndex represents a query to create an
	// index on the schedules table for the repo_id column.
	CreateRepoIDIndex = `
CREATE INDEX
IF NOT EXISTS
schedules_repo_id
ON schedules (repo_id);
`
)

Variables

This section is empty.

Functions

func New

func New(opts ...EngineOpt) (*engine, error)

New creates and returns a Vela service for integrating with schedules in the database.

Types

type EngineOpt

type EngineOpt func(*engine) error

EngineOpt represents a configuration option to initialize the database engine for Schedules.

func WithClient

func WithClient(client *gorm.DB) EngineOpt

WithClient sets the gorm.io/gorm client in the database engine for Schedules.

func WithContext added in v0.21.0

func WithContext(ctx context.Context) EngineOpt

WithContext sets the context in the database engine for Schedules.

func WithLogger

func WithLogger(logger *logrus.Entry) EngineOpt

WithLogger sets the github.com/sirupsen/logrus logger in the database engine for Schedules.

func WithSkipCreation

func WithSkipCreation(skipCreation bool) EngineOpt

WithSkipCreation sets the skip creation logic in the database engine for Schedules.

type ScheduleInterface

type ScheduleInterface interface {

	// CreateScheduleIndexes defines a function that creates the indexes for the schedules table.
	CreateScheduleIndexes(context.Context) error
	// CreateScheduleTable defines a function that creates the schedules table.
	CreateScheduleTable(context.Context, string) error

	// CountSchedules defines a function that gets the count of all schedules.
	CountSchedules(context.Context) (int64, error)
	// CountSchedulesForRepo defines a function that gets the count of schedules by repo ID.
	CountSchedulesForRepo(context.Context, *library.Repo) (int64, error)
	// CreateSchedule defines a function that creates a new schedule.
	CreateSchedule(context.Context, *library.Schedule) (*library.Schedule, error)
	// DeleteSchedule defines a function that deletes an existing schedule.
	DeleteSchedule(context.Context, *library.Schedule) error
	// GetSchedule defines a function that gets a schedule by ID.
	GetSchedule(context.Context, int64) (*library.Schedule, error)
	// GetScheduleForRepo defines a function that gets a schedule by repo ID and name.
	GetScheduleForRepo(context.Context, *library.Repo, string) (*library.Schedule, error)
	// ListActiveSchedules defines a function that gets a list of all active schedules.
	ListActiveSchedules(context.Context) ([]*library.Schedule, error)
	// ListSchedules defines a function that gets a list of all schedules.
	ListSchedules(context.Context) ([]*library.Schedule, error)
	// ListSchedulesForRepo defines a function that gets a list of schedules by repo ID.
	ListSchedulesForRepo(context.Context, *library.Repo, int, int) ([]*library.Schedule, int64, error)
	// UpdateSchedule defines a function that updates an existing schedule.
	UpdateSchedule(context.Context, *library.Schedule, bool) (*library.Schedule, error)
}

ScheduleInterface represents the Vela interface for schedule functions with the supported Database backends.

Jump to

Keyboard shortcuts

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