util

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2017 License: MIT Imports: 7 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoTimerRunning is an error reported when an action is attempted that requires a timer to
	// be running, but there is no timer running.
	ErrNoTimerRunning = errors.New("tracking: There is no active timer running")
	// ErrTimerRunning is an error reported when an action is attempted that requires that no timer
	// is running, but there is one running.
	ErrTimerRunning = errors.New("tracking: Stop your existing timer before starting a new one")
)

Functions

This section is empty.

Types

type EntryFacade

type EntryFacade struct {
	// contains filtered or unexported fields
}

EntryFacade provides a simpler interface for common Entry-related tasks.

func NewEntryFacade

func NewEntryFacade(sysGateway state.SysGateway, trackingGateway state.TrackingGateway) *EntryFacade

NewEntryFacade creates a new EntryFacade instance.

func (*EntryFacade) Create

func (f *EntryFacade) Create(start time.Time, dur time.Duration, note string) (types.Entry, error)

Create creates and persists a new entry with the given details.

func (*EntryFacade) Delete

func (f *EntryFacade) Delete(hash string) (types.Entry, error)

Delete deletes persisted data for a timesheet entry with the given hash.

func (*EntryFacade) UpdateDuration

func (f *EntryFacade) UpdateDuration(hash string, duration time.Duration) (types.Entry, error)

UpdateDuration updates an entry with the given hash with the given duration.

func (*EntryFacade) UpdateDurationByOffset

func (f *EntryFacade) UpdateDurationByOffset(hash string, offset time.Duration) (types.Entry, error)

UpdateDurationByOffset updates an entry with the given hash, offsetting the duration by the given offset duration.

func (*EntryFacade) UpdateNote

func (f *EntryFacade) UpdateNote(hash string, note string) (types.Entry, error)

UpdateNote updates an entry with the given hash with the given note.

type Factory

type Factory interface {
	// BuildEntryFacade builds an EntryFacade instance.
	BuildEntryFacade() *EntryFacade
	// BuildTimesheetFacade builds an TimesheetFacade instance.
	BuildTimesheetFacade() *TimesheetFacade
	// BuildTrackingFacade builds a TrackingFacade instance.
	BuildTrackingFacade() *TrackingFacade
	// BuildWorkspaceFacade builds a WorkspaceFacade instance.
	BuildWorkspaceFacade() *WorkspaceFacade
	// BuildSysGateway builds a SysGateway instance.
	BuildSysGateway() state.SysGateway
	// BuildTrackingGateway builds a TimesheetGateway instance.
	BuildTrackingGateway() state.TrackingGateway
}

Factory abstracts the creation of services.

func NewStandardFactory

func NewStandardFactory(backend state.Backend) Factory

NewStandardFactory creates a new Factory instance.

type TimesheetFacade

type TimesheetFacade struct {
	// contains filtered or unexported fields
}

TimesheetFacade provides a simpler interface for common Timesheet-related tasks.

func NewTimesheetFacade

func NewTimesheetFacade(trGateway state.TrackingGateway, entryFacade *EntryFacade) *TimesheetFacade

NewTimesheetFacade creates a new TimesheetFacade instance.

func (*TimesheetFacade) Delete

func (f *TimesheetFacade) Delete(date time.Time) (types.Timesheet, error)

Delete attempts to delete a timesheet at the given date.

type TrackingFacade

type TrackingFacade struct {
	// contains filtered or unexported fields
}

TrackingFacade provides a simpler interface for common general tracking-related tasks.

func NewTrackingFacade

func NewTrackingFacade(sysGateway state.SysGateway, trGateway state.TrackingGateway) *TrackingFacade

NewTrackingFacade creates a new TrackingFacade instance.

func (*TrackingFacade) Resume

func (f *TrackingFacade) Resume(hash string) (types.Entry, error)

Resume an entry with the given hash. If an empty hash is given, resume the currently active timer. If no timer is active, error.

func (*TrackingFacade) Start

func (f *TrackingFacade) Start(note string) (types.Entry, error)

Start a new entry, with the given details.

func (*TrackingFacade) Stop

func (f *TrackingFacade) Stop() (types.Entry, error)

Stop the currently active entry.

type WorkspaceFacade

type WorkspaceFacade struct {
	// contains filtered or unexported fields
}

WorkspaceFacade provides a simpler interface for common general workspace-related tasks.

func NewWorkspaceFacade

func NewWorkspaceFacade(backend state.Backend, sysGateway state.SysGateway) *WorkspaceFacade

NewWorkspaceFacade creates a new WorkspaceFacade instance.

func (*WorkspaceFacade) Create

func (f *WorkspaceFacade) Create(name string) error

Create attempts to create a new workspace.

func (*WorkspaceFacade) Delete

func (f *WorkspaceFacade) Delete(name string) error

Delete attempts to delete a workspace.

func (*WorkspaceFacade) Switch

func (f *WorkspaceFacade) Switch(name string) error

Switch attempts to switch to another workspace.

Jump to

Keyboard shortcuts

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