Documentation
¶
Index ¶
- Constants
- func FormatSeconds(s int) string
- type BranchItem
- type ItemAndBranch
- type Project
- type Report
- type ReportItem
- type ReportProject
- type ReportRepo
- type ReportTimeEntry
- type TimeEntry
- type TimerError
- type TimerRunningElsewhereError
- type Todo
- type TodoDb
- func (tdb *TodoDb) AddTodo(projId int, task string) (int, int)
- func (tdb *TodoDb) AddTodos(projId int, tasks []string) error
- func (tdb *TodoDb) ChangePosition(todoId, from, to int) error
- func (tdb *TodoDb) CheckTimer(projId int) (*TimeEntry, error)
- func (db *TodoDb) Close() error
- func (tdb *TodoDb) CopyProjectItems(projFrom, projTo int) error
- func (tdb *TodoDb) CreateReport(from, to, folderFilter string) (*Report, error)
- func (tdb *TodoDb) Delete(todoId int) error
- func (tdb *TodoDb) DeleteProject(projId int) error
- func (tdb *TodoDb) FetchProjectId(folder, branch string) int
- func (tdb *TodoDb) GetBranches(repo string) ([]BranchItem, error)
- func (tdb *TodoDb) GetItemsAndBranch(ids []int) ([]*ItemAndBranch, error)
- func (tdb *TodoDb) GetLatestTimeEntry() *TimeEntry
- func (tdb *TodoDb) GetProject(projId int) Project
- func (tdb *TodoDb) GetProjectTime(projId int) (int, error)
- func (tdb *TodoDb) MoveTodo(todoId, projId int) error
- func (tdb *TodoDb) SetItemsCommitted(projId int, previous bool) error
- func (tdb *TodoDb) StartTimer(projId int) (*TimeEntry, error)
- func (tdb *TodoDb) StopTimer() (*TimeEntry, *TimeEntry, error)
- func (tdb *TodoDb) TodoCount(projId int) int
- func (tdb *TodoDb) TodoDone(todoId int, done bool) error
- func (tdb *TodoDb) TodoItems(projId int, f func(t Todo)) error
- func (tdb *TodoDb) TodoItemsDone(projId int, f func(t Todo)) error
- func (tdb *TodoDb) TodoItemsForCommit(projId int, previous bool, f func(t Todo)) error
- func (tdb *TodoDb) TodoWhat(projId int) *Todo
- func (tdb *TodoDb) UpdateProjectName(projId int, name string) error
- func (tdb *TodoDb) UpdateTask(todoId int, task string) error
- func (tdb *TodoDb) Vacuum() error
Constants ¶
View Source
const ( TimesheetActionStart int = iota + 1 TimesheetActionStop )
Variables ¶
This section is empty.
Functions ¶
func FormatSeconds ¶
Types ¶
type BranchItem ¶
type ItemAndBranch ¶
type Report ¶
type Report struct {
From string
To string
Repos []*ReportRepo
TotalTimeSeconds int
}
func (*Report) MarshalJSON ¶
type ReportItem ¶
type ReportItem struct {
Id int `db:"todo_id"`
ProjectId int `db:"project_id"`
Task string `db:"task"`
TimeAt string `db:"time_at"`
}
func (ReportItem) MarshalJSON ¶
func (ri ReportItem) MarshalJSON() ([]byte, error)
type ReportProject ¶
type ReportProject struct {
Proj *Project
CompletedItems []ReportItem
CreatedItems []ReportItem
TimeEntries []ReportTimeEntry
TotalTimeSeconds int
LatestUpdate string
TimerRunning bool
}
func (*ReportProject) MarshalJSON ¶
func (rp *ReportProject) MarshalJSON() ([]byte, error)
type ReportRepo ¶
type ReportRepo struct {
Folder string `json:"repo"`
LatestUpdate string `json:"-"`
Projects []*ReportProject `json:"projects"`
TotalTimeSeconds int `json:"total_sec"`
}
type ReportTimeEntry ¶
type ReportTimeEntry struct {
ProjectId int `db:"project_id"`
From string `db:"started_at"`
To string `db:"stopped_at"`
DurationSec int `db:"duration"`
Running bool
}
func (ReportTimeEntry) MarshalJSON ¶
func (rte ReportTimeEntry) MarshalJSON() ([]byte, error)
type TimeEntry ¶
type TimerError ¶
type TimerError struct {
// contains filtered or unexported fields
}
func (*TimerError) Error ¶
func (e *TimerError) Error() string
type TimerRunningElsewhereError ¶
func (*TimerRunningElsewhereError) Error ¶
func (e *TimerRunningElsewhereError) Error() string
type Todo ¶
type Todo struct {
Id int `db:"todo_id"`
ProjectId int `db:"project_id"`
Task string `db:"task"`
Position int `db:"position"`
CreatedAt string `db:"created_at"`
DoneAt sql.NullString `db:"done_at"`
CommittedAt sql.NullString `db:"committed_at"`
}
type TodoDb ¶
type TodoDb struct {
// contains filtered or unexported fields
}
func NewTodoDbSrc ¶
func (*TodoDb) ChangePosition ¶
func (*TodoDb) CheckTimer ¶
CheckTimer gets the latest time entry and checks it against the project id
func (*TodoDb) CopyProjectItems ¶
func (*TodoDb) CreateReport ¶
func (*TodoDb) DeleteProject ¶
func (*TodoDb) FetchProjectId ¶
FetchProjectId gets or creates a project for the given folder and branch and returns the project id
func (*TodoDb) GetBranches ¶
func (tdb *TodoDb) GetBranches(repo string) ([]BranchItem, error)
func (*TodoDb) GetItemsAndBranch ¶
func (tdb *TodoDb) GetItemsAndBranch(ids []int) ([]*ItemAndBranch, error)
func (*TodoDb) GetLatestTimeEntry ¶
GetLatestTimeEntry returns the last recorded time entry if found
func (*TodoDb) GetProject ¶
func (*TodoDb) GetProjectTime ¶
GetProjectTime calculates total amount of seconds recorded for the project, including the ongoing time if the timer is active
func (*TodoDb) SetItemsCommitted ¶
func (*TodoDb) StartTimer ¶
StartTimer creates a new start entry, errors if already started
func (*TodoDb) StopTimer ¶
StopTimer creates a new stop entry and returns both the new and the previous entry. Returns error if the timer is stopped.
func (*TodoDb) TodoItemsForCommit ¶
func (*TodoDb) UpdateProjectName ¶
Click to show internal directories.
Click to hide internal directories.