Documentation ¶
Index ¶
- Variables
- func DeletePayload(assID int) bool
- func GetTimer(timerID int) *time.Timer
- func InitializeTimers()
- func NewTask(payload Payload) bool
- func ScheduleTask(payload Payload) bool
- func StopTimer(timerID int)
- func UpdateTimer(newData json.RawMessage, newTime time.Time, payload Payload) bool
- type Payload
- type PeerTask
- type Task
Constants ¶
This section is empty.
Variables ¶
View Source
var Timers = make(map[int]*time.Timer)
Timers slice hold all current timers
Functions ¶
func InitializeTimers ¶
func InitializeTimers()
InitializeTimers fetches timers from database on startup
func ScheduleTask ¶
ScheduleTask schedules a task based on its type
func UpdateTimer ¶
UpdateTimer should update the time of an existing timer (delete and create new timer)
Types ¶
type Payload ¶
type Payload struct { ID int `json:"id"` Authentication string `json:"authentication"` ScheduledTime time.Time `json:"scheduled_time"` Task string `json:"task"` AssignmentID int `json:"assignment_id"` Data json.RawMessage `json:"data"` }
Payload struct https://stackoverflow.com/questions/28254102/how-to-unmarshal-json-into-interface-in-go
func (Payload) GetPeerTask ¶
GetPeerTask withdraws a PeerTask object from the data column of a payload object
func (Payload) UpdatePayload ¶
UpdatePayload updates payload in db
Click to show internal directories.
Click to hide internal directories.