types

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TSValueActive   = "active"
	TSValueInactive = "inactive"
	TSValueAny      = "any"
)
View Source
const (
	TimePeriodWeek = "week"
)

Variables

View Source
var ErrIncorrectTaskStatusProvided = errors.New("incorrect task status provided")
View Source
var ValidTaskStatusValues = []string{TSValueActive, TSValueInactive, TSValueAny}

Functions

func GetShiftedTime

func GetShiftedTime(ts time.Time, direction TimeShiftDirection, duration TimeShiftDuration) time.Time

func HumanizeDuration

func HumanizeDuration(durationInSecs int) string

func IsTaskLogDurationValid added in v0.6.0

func IsTaskLogDurationValid(begin, end time.Time) error

func ParseTaskLogTimes added in v0.6.0

func ParseTaskLogTimes(beginStr, endStr string) (time.Time, time.Time, error)

Types

type ActiveTaskDetails

type ActiveTaskDetails struct {
	TaskID            int
	TaskSummary       string
	CurrentLogBeginTS time.Time
	CurrentLogComment *string
}

type ActiveTaskLogEntry

type ActiveTaskLogEntry struct {
	ID          int
	TaskID      int
	TaskSummary string
	BeginTS     time.Time
	Comment     *string
}

type DateRange added in v0.6.0

type DateRange struct {
	Start   time.Time
	End     time.Time
	NumDays int
}

func GetDateRangeFromPeriod added in v0.6.0

func GetDateRangeFromPeriod(period string, now time.Time, fullWeek bool, maxDaysAllowed *int) (DateRange, error)

type RealTimeProvider added in v0.6.0

type RealTimeProvider struct{}

func (RealTimeProvider) Now added in v0.6.0

func (RealTimeProvider) Now() time.Time

type Task

type Task struct {
	ID             int
	Summary        string
	CreatedAt      time.Time
	UpdatedAt      time.Time
	TrackingActive bool
	SecsSpent      int
	Active         bool
	ListTitle      string
	ListDesc       string
}

func (Task) Description

func (t Task) Description() string

func (Task) FilterValue

func (t Task) FilterValue() string

func (Task) Title

func (t Task) Title() string

func (*Task) UpdateListDesc

func (t *Task) UpdateListDesc(timeProvider TimeProvider)

func (*Task) UpdateListTitle

func (t *Task) UpdateListTitle()

type TaskLogEntry

type TaskLogEntry struct {
	ID          int
	TaskID      int
	TaskSummary string
	BeginTS     time.Time
	EndTS       time.Time
	SecsSpent   int
	Comment     *string
	ListTitle   string
	ListDesc    string
}

func (TaskLogEntry) Description

func (tl TaskLogEntry) Description() string

func (TaskLogEntry) FilterValue

func (tl TaskLogEntry) FilterValue() string

func (*TaskLogEntry) GetComment

func (tl *TaskLogEntry) GetComment() string

func (TaskLogEntry) Title

func (tl TaskLogEntry) Title() string

func (*TaskLogEntry) UpdateListDesc

func (tl *TaskLogEntry) UpdateListDesc(timeProvider TimeProvider)

func (*TaskLogEntry) UpdateListTitle

func (tl *TaskLogEntry) UpdateListTitle()

type TaskReportEntry

type TaskReportEntry struct {
	TaskID      int
	TaskSummary string
	NumEntries  int
	SecsSpent   int
}

type TaskStatus added in v0.6.0

type TaskStatus uint8
const (
	TaskStatusActive TaskStatus = iota
	TaskStatusInactive
	TaskStatusAny
)

func ParseTaskStatus added in v0.6.0

func ParseTaskStatus(value string) (TaskStatus, error)

type TestTimeProvider added in v0.6.0

type TestTimeProvider struct {
	FixedTime time.Time
}

func (TestTimeProvider) Now added in v0.6.0

func (t TestTimeProvider) Now() time.Time

type TimeProvider added in v0.6.0

type TimeProvider interface {
	Now() time.Time
}

type TimeShiftDirection

type TimeShiftDirection uint8
const (
	ShiftForward TimeShiftDirection = iota
	ShiftBackward
)

type TimeShiftDuration

type TimeShiftDuration uint8
const (
	ShiftMinute TimeShiftDuration = iota
	ShiftFiveMinutes
	ShiftHour
	ShiftDay
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL