Documentation
¶
Index ¶
- func DefaultPath() (string, error)
- type Statistics
- type Store
- func (s *Store) Close() error
- func (s *Store) CreateEntry(projectID string, duration int64, message, commitHash string, invoiced bool, ...) (*models.Entry, error)
- func (s *Store) CreateProject(name, gitRepoPath string) (*models.Project, error)
- func (s *Store) DeleteEntry(id string) error
- func (s *Store) DeleteProject(id string) error
- func (s *Store) GetEntry(id string) (*models.Entry, error)
- func (s *Store) GetLastCommitHash(projectID string) (string, error)
- func (s *Store) GetLastEntry(projectID string) (*models.Entry, error)
- func (s *Store) GetProject(id string) (*models.Project, error)
- func (s *Store) GetStatistics(projectID string, startDate, endDate *time.Time, invoicedFilter *bool) (*Statistics, error)
- func (s *Store) ListEntries(projectID string) ([]*models.Entry, error)
- func (s *Store) ListEntriesFiltered(projectID string, startDate, endDate *time.Time, invoicedFilter *bool) ([]*models.Entry, error)
- func (s *Store) ListProjects() ([]*models.Project, error)
- func (s *Store) UpdateEntry(id string, duration *int64, message, commitHash *string, invoiced *bool, ...) (*models.Entry, error)
- func (s *Store) UpdateProject(id, name, gitRepoPath string) (*models.Project, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶ added in v1.4.0
DefaultPath returns the canonical clockwork database path. Honours the CLOCKWORK_DB env var, otherwise falls back to ~/.local/clockwork/default.db.
Types ¶
type Statistics ¶
type Statistics struct {
TotalMinutes int64 `json:"total_minutes"`
TotalHours float64 `json:"total_hours"`
EntryCount int `json:"entry_count"`
InvoicedMinutes int64 `json:"invoiced_minutes"`
UninvoicedMinutes int64 `json:"uninvoiced_minutes"`
ProjectBreakdown map[string]int64 `json:"project_breakdown"` // projectID -> minutes
EarliestEntry *time.Time `json:"earliest_entry,omitempty"`
LatestEntry *time.Time `json:"latest_entry,omitempty"`
}
Statistics represents aggregated entry statistics
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages database operations for clockwork
func (*Store) CreateEntry ¶
func (s *Store) CreateEntry(projectID string, duration int64, message, commitHash string, invoiced bool, createdAt time.Time) (*models.Entry, error)
CreateEntry creates a new worklog entry
func (*Store) CreateProject ¶
CreateProject creates a new project
func (*Store) DeleteEntry ¶
DeleteEntry deletes an entry
func (*Store) DeleteProject ¶
DeleteProject deletes a project and all its entries (single-pass cascade).
func (*Store) GetLastCommitHash ¶ added in v1.3.3
GetLastCommitHash returns the most recent non-empty commit hash across all entries for a project in a single bucket pass.
func (*Store) GetLastEntry ¶
GetLastEntry returns the most recent entry for a project in a single pass.
func (*Store) GetProject ¶
GetProject retrieves a project by ID
func (*Store) GetStatistics ¶
func (s *Store) GetStatistics(projectID string, startDate, endDate *time.Time, invoicedFilter *bool) (*Statistics, error)
GetStatistics calculates aggregated statistics with optional filtering
func (*Store) ListEntries ¶
ListEntries returns all entries for a project
func (*Store) ListEntriesFiltered ¶
func (s *Store) ListEntriesFiltered(projectID string, startDate, endDate *time.Time, invoicedFilter *bool) ([]*models.Entry, error)
ListEntriesFiltered returns entries with optional filtering
func (*Store) ListProjects ¶
ListProjects returns all projects