Documentation
¶
Index ¶
- type Task
- type TaskData
- func (td *TaskData) Clear()
- func (td *TaskData) Clone() *TaskData
- func (td *TaskData) Create() error
- func (td *TaskData) Delete() error
- func (td *TaskData) FindTaskBySynopsis(tasks []TaskData, synopsis string) *TaskData
- func (td *TaskData) Load(withDeleted bool) error
- func (td *TaskData) LoadAll(withDeleted bool) ([]TaskData, error)
- func (td *TaskData) Resolve(arg string) (taskid uint, tasksynopsis string)
- func (td *TaskData) Search(text string) ([]TaskData, error)
- func (td *TaskData) StopRunningTask() (timesheetData *TimesheetData, err error)
- func (td *TaskData) String() string
- func (td *TaskData) TableName() string
- func (td *TaskData) Update(withDeleted bool) error
- type Timesheet
- type TimesheetData
- func (tsd *TimesheetData) Create() error
- func (tsd *TimesheetData) Delete() error
- func (tsd *TimesheetData) Load() error
- func (tsd *TimesheetData) LoadAll(withDeleted bool) ([]TimesheetData, error)
- func (tsd *TimesheetData) SearchDateRange() ([]TimesheetData, error)
- func (tsd *TimesheetData) SearchOpen() ([]TimesheetData, error)
- func (tsd *TimesheetData) String() string
- func (tsd *TimesheetData) TableName() string
- func (tsd *TimesheetData) Update() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Task ¶
type Task interface {
Create() error
Load(withDeleted bool) error
Delete() error
LoadAll(withDeleted bool) ([]TaskData, error)
Search(text string) ([]TaskData, error)
Update(withDeleted bool) error
StopRunningTask() (*TimesheetData, error)
Clear()
String() string
FindTaskBySynopsis(tasks []TaskData, synopsis string) *TaskData
Resolve(arg string) (uint, string)
}
Task is the main interface to task definitions
type TaskData ¶
type TaskData struct {
gorm.Model
// Synopsis is a short title or identifier of the task
Synopsis string `gorm:"uniqueindex"`
// Description is a longer description of the task
Description string
// contains filtered or unexported fields
}
TaskData is the main Task data strucure
func NewTaskData ¶
func NewTaskData() *TaskData
NewTaskData creates a new TaskData structure and returns a pointer to it
func (*TaskData) Clear ¶
func (td *TaskData) Clear()
Clear resets the state of this object to the default, newly-initialized state
func (*TaskData) FindTaskBySynopsis ¶
FindTaskBySynopsis returns a task with a matching synopsis from a slice of tasks
func (*TaskData) LoadAll ¶
LoadAll loads all tasks in the database, optionally including deleted tasks
func (*TaskData) Resolve ¶
Resolve takes a string argument and produces either a taskid (uint) or a synopsis (string)
func (*TaskData) StopRunningTask ¶
func (td *TaskData) StopRunningTask() (timesheetData *TimesheetData, err error)
StopRunningTask stops the currently running task, if any
type Timesheet ¶
type Timesheet interface {
Create() error
Load() error
Delete() error
LoadAll(withDeleted bool) ([]TimesheetData, error)
SearchOpen() ([]TimesheetData, error)
SearchDateRange() ([]TimesheetData, error)
Update() error
String() string
}
Timesheet is the main timesheet function interface
type TimesheetData ¶
type TimesheetData struct {
gorm.Model
// Task is the task object linked to this Timesheet
Task TaskData
// TaskID is the database ID of the linked task object
TaskID uint
// StartTime is the time that the task was started at
StartTime time.Time `gorm:"not null"`
// StopTime is the time that the task was stopped at; if it is NULL, that means the task is still running
StopTime sql.NullTime
}
TimesheetData is the main timesheet data structure
func (*TimesheetData) Create ¶
func (tsd *TimesheetData) Create() error
Create creates a new timesheet record
func (*TimesheetData) Delete ¶
func (tsd *TimesheetData) Delete() error
Delete marks a timesheet as deleted
func (*TimesheetData) Load ¶
func (tsd *TimesheetData) Load() error
Load attempts to load a timesheet by ID
func (*TimesheetData) LoadAll ¶
func (tsd *TimesheetData) LoadAll(withDeleted bool) ([]TimesheetData, error)
LoadAll loads all timesheet records, optionally including deleted timesheets
func (*TimesheetData) SearchDateRange ¶
func (tsd *TimesheetData) SearchDateRange() ([]TimesheetData, error)
SearchDateRange returns the timesheets that start on or after the StartTime and end on or before the StopTime
func (*TimesheetData) SearchOpen ¶
func (tsd *TimesheetData) SearchOpen() ([]TimesheetData, error)
SearchOpen returns all open timesheets; there should be only one
func (*TimesheetData) String ¶
func (tsd *TimesheetData) String() string
String implements fmt.Stringer
func (*TimesheetData) TableName ¶
func (tsd *TimesheetData) TableName() string
TableName implements schema.Tabler
func (*TimesheetData) Update ¶
func (tsd *TimesheetData) Update() error
Update attempts to update the timesheet record in the database