worklog

package
v0.0.0-...-d8ab0b6 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Add = Operation(iota)
	Remove
)
View Source
const DateTimeFormat = "2006-01-02 15:04"
View Source
const OrgDateTimeFormat = "2006-01-02 Mon 15:04"
View Source
const TimeFormat = "15:04"

Variables

This section is empty.

Functions

func PrettyPrintActions

func PrettyPrintActions(actions map[time.Time][]Action)

func Sync

func Sync(source Source, sinks []Sink, start, end time.Time, dryRun bool) error

Types

type Action

type Action struct {
	Entry     Entry
	Operation Operation
}

type CSVSink

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

func NewCSVSink

func NewCSVSink(path string) (*CSVSink, error)

func (*CSVSink) FetchEntries

func (s *CSVSink) FetchEntries(start, end time.Time) ([]Entry, error)

func (*CSVSink) IsApplicable

func (s *CSVSink) IsApplicable(e Entry) bool

func (*CSVSink) Name

func (s *CSVSink) Name() string

func (*CSVSink) ProcessActions

func (s *CSVSink) ProcessActions(actions []Action, localEntries []Entry) error

func (CSVSink) ValidIdentifier

func (s CSVSink) ValidIdentifier(identifier string) bool

type ClockifySource

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

func NewClockifySource

func NewClockifySource(configProvider *cli.ConfigProvider) *ClockifySource

func (*ClockifySource) FetchEntries

func (s *ClockifySource) FetchEntries(start, end time.Time) ([]Entry, error)

func (*ClockifySource) Name

func (s *ClockifySource) Name() string

func (ClockifySource) ValidIdentifier

func (s ClockifySource) ValidIdentifier(identifier string) bool

type Entry

type Entry struct {
	Ticket     string
	ExternalID string
	Type       EntryType
	From       time.Time
	To         time.Time
}

func (*Entry) Duration

func (e *Entry) Duration() time.Duration

type EntryType

type EntryType uint
const (
	EntryTypeWork EntryType = iota
	EntryTypeBreak
)

type FileSource

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

func NewFileSource

func NewFileSource(path string) *FileSource

func (*FileSource) FetchEntries

func (s *FileSource) FetchEntries(start, end time.Time) ([]Entry, error)

func (*FileSource) Name

func (s *FileSource) Name() string

func (*FileSource) ValidIdentifier

func (s *FileSource) ValidIdentifier(identifier string) bool

type JiraSink

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

func NewJiraSink

func NewJiraSink(rawHost string, configProvider *cli.ConfigProvider) (*JiraSink, error)

func (*JiraSink) FetchEntries

func (s *JiraSink) FetchEntries(start, end time.Time) ([]Entry, error)

func (*JiraSink) IsApplicable

func (s *JiraSink) IsApplicable(e Entry) bool

func (*JiraSink) Name

func (s *JiraSink) Name() string

func (*JiraSink) ProcessActions

func (s *JiraSink) ProcessActions(actions []Action, localEntries []Entry) error

func (JiraSink) ValidIdentifier

func (s JiraSink) ValidIdentifier(identifier string) bool

type Operation

type Operation uint

func (Operation) String

func (o Operation) String() string

type OrgSource

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

func NewOrgSource

func NewOrgSource(path string) (*OrgSource, error)

func (*OrgSource) FetchEntries

func (s *OrgSource) FetchEntries(start, end time.Time) ([]Entry, error)

func (*OrgSource) Name

func (s *OrgSource) Name() string

func (OrgSource) ValidIdentifier

func (s OrgSource) ValidIdentifier(identifier string) bool

type PersonioSink

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

func NewPersonioSink

func NewPersonioSink(rawHost string, configProvider *cli.ConfigProvider) (*PersonioSink, error)

func (*PersonioSink) FetchEntries

func (s *PersonioSink) FetchEntries(start, end time.Time) ([]Entry, error)

func (*PersonioSink) IsApplicable

func (s *PersonioSink) IsApplicable(e Entry) bool

func (*PersonioSink) Name

func (s *PersonioSink) Name() string

func (*PersonioSink) ProcessActions

func (s *PersonioSink) ProcessActions(actions []Action, localEntries []Entry) error

func (PersonioSink) ValidIdentifier

func (s PersonioSink) ValidIdentifier(identifier string) bool

type Sink

type Sink interface {
	Source
	IsApplicable(e Entry) bool
	ProcessActions(actions []Action, localEntries []Entry) error
}

type Source

type Source interface {
	Name() string
	ValidIdentifier(identifier string) bool
	FetchEntries(start, end time.Time) ([]Entry, error)
}

type StubSink

type StubSink struct{}

func (*StubSink) FetchEntries

func (s *StubSink) FetchEntries(start, end time.Time) ([]Entry, error)

func (*StubSink) IsApplicable

func (s *StubSink) IsApplicable(e Entry) bool

func (*StubSink) Name

func (s *StubSink) Name() string

func (*StubSink) ProcessActions

func (s *StubSink) ProcessActions(actions []Action, localEntries []Entry) error

func (StubSink) ValidIdentifier

func (s StubSink) ValidIdentifier(identifier string) bool

Jump to

Keyboard shortcuts

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