Documentation ¶
Index ¶
- Constants
- type Data
- type FixedShift
- type OnCallNotificationRule
- type RuleID
- type Schedule
- type SearchCursor
- type SearchOptions
- type Store
- func (store *Store) ClearTemporarySchedules(ctx context.Context, tx *sql.Tx, scheduleID uuid.UUID, start, end time.Time) error
- func (store *Store) Create(ctx context.Context, s *Schedule) (*Schedule, error)
- func (store *Store) CreateScheduleTx(ctx context.Context, tx *sql.Tx, s *Schedule) (*Schedule, error)
- func (store *Store) Delete(ctx context.Context, id string) error
- func (store *Store) DeleteManyTx(ctx context.Context, tx *sql.Tx, ids []string) error
- func (store *Store) DeleteTx(ctx context.Context, tx *sql.Tx, id string) error
- func (store *Store) FindAll(ctx context.Context) ([]Schedule, error)
- func (store *Store) FindMany(ctx context.Context, ids []string) ([]Schedule, error)
- func (store *Store) FindOne(ctx context.Context, id string) (*Schedule, error)
- func (store *Store) FindOneForUpdate(ctx context.Context, tx *sql.Tx, id string) (*Schedule, error)
- func (store *Store) OnCallNotificationRules(ctx context.Context, tx *sql.Tx, scheduleID uuid.UUID) ([]OnCallNotificationRule, error)
- func (store *Store) Search(ctx context.Context, opts *SearchOptions) ([]Schedule, error)
- func (store *Store) SetOnCallNotificationRules(ctx context.Context, tx *sql.Tx, scheduleID uuid.UUID, ...) error
- func (store *Store) SetTemporarySchedule(ctx context.Context, tx *sql.Tx, scheduleID uuid.UUID, temp TemporarySchedule) error
- func (store *Store) TemporarySchedules(ctx context.Context, tx *sql.Tx, scheduleID uuid.UUID) ([]TemporarySchedule, error)
- func (store *Store) Update(ctx context.Context, s *Schedule) error
- func (store *Store) UpdateTx(ctx context.Context, tx *sql.Tx, s *Schedule) error
- type TemporarySchedule
Constants ¶
const FixedShiftsPerTemporaryScheduleLimit = 150
FixedShiftsPerTemporaryScheduleLimit is the maximum number of shifts that can be configured for a single TemporarySchedule at a time.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶ added in v0.27.0
type Data struct { V1 struct { TemporarySchedules []TemporarySchedule OnCallNotificationRules []OnCallNotificationRule } }
Data contains configuration for a single schedule.
type FixedShift ¶ added in v0.27.0
A FixedShift represents an on-call user with a start and end time.
type OnCallNotificationRule ¶ added in v0.28.0
type OnCallNotificationRule struct { // ID is a persistent value for UI or other systems to track rule additions/deletions/edits. ID RuleID // ChannelID is the notification channel ID for notifications. ChannelID uuid.UUID Time *timeutil.Clock WeekdayFilter *timeutil.WeekdayFilter NextNotification *time.Time }
An OnCallNotificationRule defines when notifications for on-call users for a schedule should be sent.
type RuleID ¶ added in v0.28.0
type RuleID struct {
// contains filtered or unexported fields
}
RuleID uniquely identifies an OnCallNotificationRule within the context of a single schedule and is stable across updates.
func (RuleID) MarshalGQL ¶ added in v0.28.0
func (RuleID) MarshalText ¶ added in v0.28.0
func (*RuleID) UnmarshalGQL ¶ added in v0.28.0
func (*RuleID) UnmarshalText ¶ added in v0.28.0
UnmarshalText will parse a rule in string form.
Format is a 36-char UUID string, then colon, followed by a unique int value.
type Schedule ¶
type Schedule struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` TimeZone *time.Location `json:"time_zone"` // contains filtered or unexported fields }
func (Schedule) IsUserFavorite ¶ added in v0.23.0
IsUserFavorite returns a boolean value based on if the schedule is a user favorite
type SearchCursor ¶
SearchCursor is used to indicate a position in a paginated list.
type SearchOptions ¶
type SearchOptions struct { Search string `json:"s,omitempty"` // FavoritesUserID specifies the UserID whose favorite services want to be displayed. FavoritesUserID string `json:"u,omitempty"` // FavoritesOnly controls filtering the results to those marked as favorites by FavoritesUserID. FavoritesOnly bool `json:"g,omitempty"` // FavoritesFirst indicates that services marked as favorite (by FavoritesUserID) should be returned first (before any non-favorites). FavoritesFirst bool `json:"f,omitempty"` After SearchCursor `json:"a,omitempty"` // Omit specifies a list of schedule IDs to exclude from the results. Omit []string `json:"o,omitempty"` Limit int `json:"-"` }
SearchOptions allow filtering and paginating the list of schedules.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) ClearTemporarySchedules ¶ added in v0.27.0
func (store *Store) ClearTemporarySchedules(ctx context.Context, tx *sql.Tx, scheduleID uuid.UUID, start, end time.Time) error
ClearTemporarySchedules will clear out (or split, if needed) any defined TemporarySchedules that exist between the start and end time.
func (*Store) CreateScheduleTx ¶
func (*Store) DeleteManyTx ¶
func (*Store) FindOneForUpdate ¶
func (*Store) OnCallNotificationRules ¶ added in v0.28.0
func (store *Store) OnCallNotificationRules(ctx context.Context, tx *sql.Tx, scheduleID uuid.UUID) ([]OnCallNotificationRule, error)
OnCallNotificationRules returns the current set of OnCallNotificationRules for the provided scheduleID.
func (*Store) SetOnCallNotificationRules ¶ added in v0.28.0
func (store *Store) SetOnCallNotificationRules(ctx context.Context, tx *sql.Tx, scheduleID uuid.UUID, rules []OnCallNotificationRule) error
SetOnCallNotificationRules will set/replace all notification rules for the given schedule ID.
func (*Store) SetTemporarySchedule ¶ added in v0.27.0
func (store *Store) SetTemporarySchedule(ctx context.Context, tx *sql.Tx, scheduleID uuid.UUID, temp TemporarySchedule) error
SetTemporarySchedule will cause the schedule to use only, and exactly, the provided set of shifts between the provided start and end times.
type TemporarySchedule ¶ added in v0.27.0
type TemporarySchedule struct {
Start, End time.Time
Shifts []FixedShift
}
TemporarySchedule represents a timespan containing static pre-defined shifts of on-call users.
func MergeTemporarySchedules ¶ added in v0.27.0
func MergeTemporarySchedules(tempScheds []TemporarySchedule) []TemporarySchedule
MergeTemporarySchedules will sort and merge TemporarySchedules and contained shifts
The output is guaranteed to be in-order and with no overlapping start/end times.
func (TemporarySchedule) TrimEnd ¶ added in v0.27.0
func (temp TemporarySchedule) TrimEnd(t time.Time) TemporarySchedule
TrimEnd will truncate and remove shifts so that the entire TemporarySchedule will end at the latest exactly t.
func (TemporarySchedule) TrimStart ¶ added in v0.27.0
func (temp TemporarySchedule) TrimStart(t time.Time) TemporarySchedule
TrimStart will truncate and remove shifts so that the entire TemporarySchedule will start at the earliest exactly t.