Documentation ¶
Index ¶
- type Rule
- type ScheduleTriggerFunc
- type Store
- func (s *Store) Add(ctx context.Context, r *Rule) (*Rule, error)
- func (s *Store) CreateRuleTx(ctx context.Context, tx *sql.Tx, r *Rule) (*Rule, error)
- func (s *Store) DeleteManyTx(ctx context.Context, tx *sql.Tx, ruleIDs []string) error
- func (s *Store) FindAll(ctx context.Context, scheduleID string) ([]Rule, error)
- func (s *Store) FindAllTx(ctx context.Context, tx *sql.Tx, scheduleID string) ([]Rule, error)
- func (s *Store) FindByTargetTx(ctx context.Context, tx *sql.Tx, scheduleID string, target assignment.Target) ([]Rule, error)
- func (s *Store) UpdateTx(ctx context.Context, tx *sql.Tx, r *Rule) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rule ¶
type Rule struct { ID string `json:"id"` ScheduleID string `json:"schedule_id"` timeutil.WeekdayFilter Start timeutil.Clock `json:"start"` End timeutil.Clock `json:"end"` CreatedAt time.Time `json:"created_at"` Target assignment.Target }
func NewAlwaysActive ¶
func NewAlwaysActive(scheduleID string, tgt assignment.Target) *Rule
func (Rule) AlwaysActive ¶
AlwaysActive will return true if the rule will always be active.
func (Rule) EndTime ¶
EndTime will return the next time the rule would be inactive. If the rule is currently inactive, it will return the end of the next shift.
If the rule is always active, or never active, it returns a zero time.
func (Rule) IsActive ¶
IsActive determines if the rule is active in the given moment in time, in the location of t.
func (Rule) NeverActive ¶
NeverActive returns true if the rule will never be active.
func (Rule) StartTime ¶
StartTime will return the next time the rule would be active. If the rule is currently active, it will return the time it became active (in the past).
If the rule is NeverActive or AlwaysActive, zero time is returned.
It may break when processing a timezone where daylight savings repeats or skips ahead at midnight.
type ScheduleTriggerFunc ¶
type ScheduleTriggerFunc func(string)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}