Documentation ¶
Index ¶
- Variables
- type Participant
- type Rotation
- type SearchCursor
- type SearchOptions
- type State
- type Store
- func (s *Store) AddRotationUsersTx(ctx context.Context, tx *sql.Tx, rotationID string, userIDs []string) error
- func (s *Store) CreateRotationTx(ctx context.Context, tx *sql.Tx, r *Rotation) (*Rotation, error)
- func (s *Store) DeleteManyTx(ctx context.Context, tx *sql.Tx, ids []string) error
- func (s *Store) DeleteRotationParticipantsTx(ctx context.Context, tx *sql.Tx, partIDs []string) error
- func (s *Store) DeleteStateTx(ctx context.Context, tx *sql.Tx, rotationID string) error
- func (s *Store) FindAllParticipants(ctx context.Context, rotationID string) ([]Participant, error)
- func (s *Store) FindAllParticipantsTx(ctx context.Context, tx *sql.Tx, rotationID string) ([]Participant, error)
- func (s *Store) FindMany(ctx context.Context, ids []string) ([]Rotation, error)
- func (s *Store) FindParticipant(ctx context.Context, id string) (*Participant, error)
- func (s *Store) FindParticipantCount(ctx context.Context, id string) (int, error)
- func (s *Store) FindRotation(ctx context.Context, id string) (*Rotation, error)
- func (s *Store) FindRotationForUpdateTx(ctx context.Context, tx *sql.Tx, rotationID string) (*Rotation, error)
- func (s *Store) Search(ctx context.Context, opts *SearchOptions) ([]Rotation, error)
- func (s *Store) SetActiveIndexTx(ctx context.Context, tx *sql.Tx, rotID string, position int) error
- func (s *Store) State(ctx context.Context, id string) (*State, error)
- func (s *Store) StateTx(ctx context.Context, tx *sql.Tx, id string) (*State, error)
- func (s *Store) UpdateParticipantUserIDTx(ctx context.Context, tx *sql.Tx, partID, userID string) error
- func (s *Store) UpdateRotationTx(ctx context.Context, tx *sql.Tx, r *Rotation) error
- type Type
Constants ¶
This section is empty.
Variables ¶
var ErrNoState = errors.New("no state available")
ErrNoState is returned when there is no state information available for a rotation.
Functions ¶
This section is empty.
Types ¶
type Participant ¶
type Participant struct { ID string `json:"id"` Position int `json:"position"` RotationID string `json:"rotation_id"` Target assignment.Target }
func (Participant) Normalize ¶
func (p Participant) Normalize() (*Participant, error)
type Rotation ¶
type Rotation struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Type Type `json:"type"` Start time.Time `json:"start"` ShiftLength int `json:"shift_length"` // contains filtered or unexported fields }
func (Rotation) EndTime ¶
EndTime calculates the end of the "shift" that started at (or was active) at t. For monthly rotations, the monthEndTime function is used to recursively handle calculations as the length of months vary.
It is guaranteed to occur after t.
func (Rotation) IsUserFavorite ¶ added in v0.23.0
func (Rotation) StartTime ¶
StartTime calculates the start of the "shift" that started at (or was active) at t. For daily, weekly, and monthly rotations, start time will be the previous handoff time (from start). For monthly rotations, the monthStartTime function is used to recursively handle calculations as the length of months vary.
type SearchCursor ¶
SearchCursor is used to indicate a position in a paginated list.
type SearchOptions ¶
type SearchOptions struct { Search string `json:"s,omitempty"` After SearchCursor `json:"a,omitempty"` // Omit specifies a list of rotation IDs to exclude from the results Omit []string `json:"o,omitempty"` Limit int `json:"-"` // FavoritesOnly controls filtering the results to those marked as favorites by FavoritesUserID. FavoritesOnly bool `json:"b,omitempty"` // FavoritesFirst indicates that rotations marked as favorite (by FavoritesUserID) should be returned first (before any non-favorites). FavoritesFirst bool `json:"f,omitempty"` //FavoritesUserID is the userID associated with the rotation favorite FavoritesUserID string `json:"u,omitempty"` }
SearchOptions allow filtering and paginating the list of rotations.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AddRotationUsersTx ¶
func (*Store) CreateRotationTx ¶
func (*Store) DeleteManyTx ¶
func (*Store) DeleteRotationParticipantsTx ¶
func (*Store) DeleteStateTx ¶
func (*Store) FindAllParticipants ¶ added in v0.30.0
func (*Store) FindAllParticipantsTx ¶ added in v0.30.0
func (*Store) FindParticipant ¶ added in v0.30.0
func (*Store) FindParticipantCount ¶ added in v0.30.0
func (*Store) FindRotation ¶ added in v0.30.0
func (*Store) FindRotationForUpdateTx ¶ added in v0.30.0
func (*Store) SetActiveIndexTx ¶
func (*Store) UpdateParticipantUserIDTx ¶
type Type ¶
type Type string
func (Type) MarshalGQL ¶
MarshalGQL implements the graphql.Marshaler interface
func (*Type) UnmarshalGQL ¶
UnmarshalGQL implements the graphql.Marshaler interface