Documentation
¶
Index ¶
- Constants
- type Engine
- func (e *Engine) CountActiveSchedules(ctx context.Context) (int64, error)
- func (e *Engine) CountSchedules(ctx context.Context) (int64, error)
- func (e *Engine) CountSchedulesForRepo(ctx context.Context, r *api.Repo) (int64, error)
- func (e *Engine) CreateSchedule(ctx context.Context, s *api.Schedule) (*api.Schedule, error)
- func (e *Engine) CreateScheduleIndexes(ctx context.Context) error
- func (e *Engine) CreateScheduleTable(ctx context.Context, driver string) error
- func (e *Engine) DeleteSchedule(ctx context.Context, s *api.Schedule) error
- func (e *Engine) GetSchedule(ctx context.Context, id int64) (*api.Schedule, error)
- func (e *Engine) GetScheduleForRepo(ctx context.Context, r *api.Repo, name string) (*api.Schedule, error)
- func (e *Engine) ListActiveSchedules(ctx context.Context) ([]*api.Schedule, error)
- func (e *Engine) ListSchedules(ctx context.Context) ([]*api.Schedule, error)
- func (e *Engine) ListSchedulesForRepo(ctx context.Context, r *api.Repo, page, perPage int) ([]*api.Schedule, error)
- func (e *Engine) UpdateSchedule(ctx context.Context, s *api.Schedule, fields bool) (*api.Schedule, error)
- type EngineOpt
- type ScheduleInterface
Constants ¶
const ( // CreatePostgresTable represents a query to create the Postgres schedules table. CreatePostgresTable = `` /* 382-byte string literal not displayed */ // CreateSqliteTable represents a query to create the Sqlite schedules table. CreateSqliteTable = `` /* 350-byte string literal not displayed */ )
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 ¶
This section is empty.
Types ¶
type Engine ¶ added in v0.27.0
type Engine struct {
// contains filtered or unexported fields
}
Engine represents the schedule functionality that implements the ScheduleInterface interface.
func (*Engine) CountActiveSchedules ¶ added in v0.27.0
CountActiveSchedules gets the count of all active schedules from the database.
func (*Engine) CountSchedules ¶ added in v0.27.0
CountSchedules gets the count of all schedules from the database.
func (*Engine) CountSchedulesForRepo ¶ added in v0.27.0
CountSchedulesForRepo gets the count of schedules by repo ID from the database.
func (*Engine) CreateSchedule ¶ added in v0.27.0
CreateSchedule creates a new schedule in the database.
func (*Engine) CreateScheduleIndexes ¶ added in v0.27.0
CreateScheduleIndexes creates the indexes for the schedules table in the database.
func (*Engine) CreateScheduleTable ¶ added in v0.27.0
CreateScheduleTable creates the schedules table in the database.
func (*Engine) DeleteSchedule ¶ added in v0.27.0
DeleteSchedule deletes an existing schedule from the database.
func (*Engine) GetSchedule ¶ added in v0.27.0
GetSchedule gets a schedule by ID from the database.
func (*Engine) GetScheduleForRepo ¶ added in v0.27.0
func (e *Engine) GetScheduleForRepo(ctx context.Context, r *api.Repo, name string) (*api.Schedule, error)
GetScheduleForRepo gets a schedule by repo ID and name from the database.
func (*Engine) ListActiveSchedules ¶ added in v0.27.0
ListActiveSchedules gets a list of all active schedules from the database.
func (*Engine) ListSchedules ¶ added in v0.27.0
ListSchedules gets a list of all schedules from the database.
type EngineOpt ¶
EngineOpt represents a configuration option to initialize the database engine for Schedules.
func WithClient ¶
WithClient sets the gorm.io/gorm client in the database engine for Schedules.
func WithContext ¶ added in v0.21.0
WithContext sets the context in the database engine for Schedules.
func WithEncryptionKey ¶ added in v0.24.0
WithEncryptionKey sets the encryption key in the database engine for Schedules.
func WithLogger ¶
WithLogger sets the github.com/sirupsen/logrus logger in the database engine for Schedules.
func WithSkipCreation ¶
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, *api.Repo) (int64, error)
// CreateSchedule defines a function that creates a new schedule.
CreateSchedule(context.Context, *api.Schedule) (*api.Schedule, error)
// DeleteSchedule defines a function that deletes an existing schedule.
DeleteSchedule(context.Context, *api.Schedule) error
// GetSchedule defines a function that gets a schedule by ID.
GetSchedule(context.Context, int64) (*api.Schedule, error)
// GetScheduleForRepo defines a function that gets a schedule by repo ID and name.
GetScheduleForRepo(context.Context, *api.Repo, string) (*api.Schedule, error)
// ListActiveSchedules defines a function that gets a list of all active schedules.
ListActiveSchedules(context.Context) ([]*api.Schedule, error)
// ListSchedules defines a function that gets a list of all schedules.
ListSchedules(context.Context) ([]*api.Schedule, error)
// ListSchedulesForRepo defines a function that gets a list of schedules by repo ID.
ListSchedulesForRepo(context.Context, *api.Repo, int, int) ([]*api.Schedule, error)
// UpdateSchedule defines a function that updates an existing schedule.
UpdateSchedule(context.Context, *api.Schedule, bool) (*api.Schedule, error)
}