Documentation ¶
Index ¶
- Variables
- type DB
- func (db *DB) AddParticipant(ctx context.Context, p *Participant) (*Participant, error)
- func (db *DB) AddParticipantTx(ctx context.Context, tx *sql.Tx, p *Participant) (*Participant, error)
- func (db *DB) AddRotationUsersTx(ctx context.Context, tx *sql.Tx, rotationID string, userIDs []string) error
- func (db *DB) CreateRotation(ctx context.Context, r *Rotation) (*Rotation, error)
- func (db *DB) CreateRotationTx(ctx context.Context, tx *sql.Tx, r *Rotation) (*Rotation, error)
- func (db *DB) DeleteManyTx(ctx context.Context, tx *sql.Tx, ids []string) error
- func (db *DB) DeleteRotation(ctx context.Context, id string) error
- func (db *DB) DeleteRotationParticipantsTx(ctx context.Context, tx *sql.Tx, partIDs []string) error
- func (db *DB) DeleteRotationTx(ctx context.Context, tx *sql.Tx, id string) error
- func (db *DB) DeleteStateTx(ctx context.Context, tx *sql.Tx, rotationID string) error
- func (db *DB) FindAllParticipants(ctx context.Context, rotationID string) ([]Participant, error)
- func (db *DB) FindAllParticipantsByScheduleID(ctx context.Context, scheduleID string) ([]Participant, error)
- func (db *DB) FindAllParticipantsTx(ctx context.Context, tx *sql.Tx, rotationID string) ([]Participant, error)
- func (db *DB) FindAllRotations(ctx context.Context) ([]Rotation, error)
- func (db *DB) FindAllRotationsByScheduleID(ctx context.Context, schedID string) ([]Rotation, error)
- func (db *DB) FindAllStateByScheduleID(ctx context.Context, scheduleID string) ([]State, error)
- func (db *DB) FindMany(ctx context.Context, ids []string) ([]Rotation, error)
- func (db *DB) FindParticipant(ctx context.Context, id string) (*Participant, error)
- func (db *DB) FindParticipantCount(ctx context.Context, id string) (int, error)
- func (db *DB) FindRotation(ctx context.Context, id string) (*Rotation, error)
- func (db *DB) FindRotationForUpdateTx(ctx context.Context, tx *sql.Tx, rotationID string) (*Rotation, error)
- func (db *DB) IsParticipantActive(ctx context.Context, partID string) (bool, error)
- func (db *DB) MoveParticipant(ctx context.Context, id string, newPos int) error
- func (db *DB) RemoveParticipant(ctx context.Context, id string) (string, error)
- func (db *DB) RemoveParticipantTx(ctx context.Context, tx *sql.Tx, id string) (string, error)
- func (db *DB) Search(ctx context.Context, opts *SearchOptions) ([]Rotation, error)
- func (db *DB) SetActiveIndexTx(ctx context.Context, tx *sql.Tx, rotID string, position int) error
- func (db *DB) SetActiveParticipant(ctx context.Context, rotID string, partID string) error
- func (db *DB) State(ctx context.Context, id string) (*State, error)
- func (db *DB) StateTx(ctx context.Context, tx *sql.Tx, id string) (*State, error)
- func (db *DB) UpdateParticipantUserIDTx(ctx context.Context, tx *sql.Tx, partID, userID string) error
- func (db *DB) UpdateRotation(ctx context.Context, r *Rotation) error
- func (db *DB) UpdateRotationTx(ctx context.Context, tx *sql.Tx, r *Rotation) error
- type Participant
- type ParticipantReader
- type ReadStateStore
- type ReadStore
- type Rotation
- type SearchCursor
- type SearchOptions
- type State
- type StateReader
- type StateStore
- type Store
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
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 DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) AddParticipant ¶
func (db *DB) AddParticipant(ctx context.Context, p *Participant) (*Participant, error)
func (*DB) AddParticipantTx ¶
func (db *DB) AddParticipantTx(ctx context.Context, tx *sql.Tx, p *Participant) (*Participant, error)
func (*DB) AddRotationUsersTx ¶
func (*DB) CreateRotation ¶
func (*DB) CreateRotationTx ¶
func (*DB) DeleteManyTx ¶
func (*DB) DeleteRotationParticipantsTx ¶
func (*DB) DeleteRotationTx ¶
func (*DB) DeleteStateTx ¶
func (*DB) FindAllParticipants ¶
func (*DB) FindAllParticipantsByScheduleID ¶
func (*DB) FindAllParticipantsTx ¶
func (*DB) FindAllRotations ¶
func (*DB) FindAllRotationsByScheduleID ¶
func (*DB) FindAllStateByScheduleID ¶
func (*DB) FindParticipant ¶
func (*DB) FindParticipantCount ¶
func (*DB) FindRotation ¶
func (*DB) FindRotationForUpdateTx ¶
func (*DB) IsParticipantActive ¶
func (*DB) MoveParticipant ¶
func (*DB) RemoveParticipant ¶
func (*DB) RemoveParticipantTx ¶
func (*DB) SetActiveIndexTx ¶
func (*DB) SetActiveParticipant ¶
func (*DB) UpdateParticipantUserIDTx ¶
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 ParticipantReader ¶
type ParticipantReader interface { FindParticipant(ctx context.Context, id string) (*Participant, error) FindAllParticipants(ctx context.Context, rotationID string) ([]Participant, error) FindAllParticipantsTx(ctx context.Context, tx *sql.Tx, rotationID string) ([]Participant, error) FindAllParticipantsByScheduleID(ctx context.Context, scheduleID string) ([]Participant, error) }
type ReadStateStore ¶
type ReadStateStore interface { StateReader ParticipantReader }
type ReadStore ¶
type ReadStore interface { FindRotation(context.Context, string) (*Rotation, error) FindRotationForUpdateTx(context.Context, *sql.Tx, string) (*Rotation, error) FindAllRotations(context.Context) ([]Rotation, error) FindAllRotationsByScheduleID(context.Context, string) ([]Rotation, error) FindParticipantCount(context.Context, string) (int, 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.
It is guaranteed to occur after t.
func (Rotation) IsUserFavorite ¶ added in v0.23.0
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 StateReader ¶
type StateStore ¶
type StateStore interface { ReadStore StateReader ParticipantReader }
type Store ¶
type Store interface { ReadStore ReadStateStore CreateRotation(context.Context, *Rotation) (*Rotation, error) CreateRotationTx(context.Context, *sql.Tx, *Rotation) (*Rotation, error) UpdateRotation(context.Context, *Rotation) error UpdateRotationTx(context.Context, *sql.Tx, *Rotation) error DeleteRotation(context.Context, string) error DeleteRotationTx(context.Context, *sql.Tx, string) error DeleteManyTx(context.Context, *sql.Tx, []string) error AddParticipant(context.Context, *Participant) (*Participant, error) AddParticipantTx(context.Context, *sql.Tx, *Participant) (*Participant, error) RemoveParticipant(context.Context, string) (rotationID string, err error) RemoveParticipantTx(context.Context, *sql.Tx, string) (rotationID string, err error) MoveParticipant(context.Context, string, int) error IsParticipantActive(context.Context, string) (bool, error) SetActiveParticipant(ctx context.Context, rotationID, participantID string) error SetActiveIndexTx(ctx context.Context, tx *sql.Tx, rotID string, position int) error FindMany(context.Context, []string) ([]Rotation, error) Search(context.Context, *SearchOptions) ([]Rotation, error) AddRotationUsersTx(ctx context.Context, tx *sql.Tx, rotationID string, userIDs []string) error DeleteRotationParticipantsTx(ctx context.Context, tx *sql.Tx, partIDs []string) error UpdateParticipantUserIDTx(ctx context.Context, tx *sql.Tx, partID, userID string) error DeleteStateTx(ctx context.Context, tx *sql.Tx, rotationID string) error }
type Type ¶
type Type string
func (Type) MarshalGQL ¶
MarshalGQL implements the graphql.Marshaler interface
func (*Type) UnmarshalGQL ¶
UnmarshalGQL implements the graphql.Marshaler interface
Click to show internal directories.
Click to hide internal directories.