storage

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

func Initialize

func Initialize() (*Database, error)

func (*Database) Close

func (d *Database) Close() error

func (*Database) CreateEntry

func (d *Database) CreateEntry(projectName, description string, hourlyRate *float64, milestoneName *string) (*TimeEntry, error)

func (*Database) CreateManualEntry

func (d *Database) CreateManualEntry(projectName, description string, startTime, endTime time.Time, hourlyRate *float64, milestoneName *string) (*TimeEntry, error)

func (*Database) CreateMilestone added in v0.3.0

func (d *Database) CreateMilestone(projectName, name string) (*Milestone, error)

func (*Database) DeleteTimeEntry

func (d *Database) DeleteTimeEntry(id int64) error

func (*Database) FinishMilestone added in v0.3.0

func (d *Database) FinishMilestone(id int64) error

func (*Database) GetActiveMilestoneForProject added in v0.3.0

func (d *Database) GetActiveMilestoneForProject(projectName string) (*Milestone, error)

func (*Database) GetAllMilestones added in v0.3.0

func (d *Database) GetAllMilestones() ([]*Milestone, error)

func (*Database) GetAllProjects

func (d *Database) GetAllProjects() ([]string, error)

func (*Database) GetCompletedEntriesByProject

func (d *Database) GetCompletedEntriesByProject(projectName string) ([]*TimeEntry, error)

func (*Database) GetEntries

func (d *Database) GetEntries(limit int) ([]*TimeEntry, error)

func (*Database) GetEntriesByDateRange

func (d *Database) GetEntriesByDateRange(start, end time.Time) ([]*TimeEntry, error)

func (*Database) GetEntriesByMilestone added in v0.3.0

func (d *Database) GetEntriesByMilestone(projectName, milestoneName string) ([]*TimeEntry, error)

func (*Database) GetEntriesByProject

func (d *Database) GetEntriesByProject(projectName string) ([]*TimeEntry, error)

func (*Database) GetEntry

func (d *Database) GetEntry(id int64) (*TimeEntry, error)

func (*Database) GetLastStoppedEntry added in v0.1.2

func (d *Database) GetLastStoppedEntry() (*TimeEntry, error)

func (*Database) GetMilestone added in v0.3.0

func (d *Database) GetMilestone(id int64) (*Milestone, error)

func (*Database) GetMilestoneByName added in v0.3.0

func (d *Database) GetMilestoneByName(projectName, milestoneName string) (*Milestone, error)

func (*Database) GetMilestonesByProject added in v0.3.0

func (d *Database) GetMilestonesByProject(projectName string) ([]*Milestone, error)

func (*Database) GetProjectsWithCompletedEntries

func (d *Database) GetProjectsWithCompletedEntries() ([]string, error)

func (*Database) GetRunningEntry

func (d *Database) GetRunningEntry() (*TimeEntry, error)

func (*Database) StopEntry

func (d *Database) StopEntry(id int64) error

func (*Database) UpdateTimeEntry

func (d *Database) UpdateTimeEntry(id int64, entry *TimeEntry) error

type Milestone added in v0.3.0

type Milestone struct {
	ID          int64
	ProjectName string
	Name        string
	StartTime   time.Time
	EndTime     *time.Time
}

func (*Milestone) Duration added in v0.3.0

func (m *Milestone) Duration() time.Duration

func (*Milestone) IsActive added in v0.3.0

func (m *Milestone) IsActive() bool

type TimeEntry

type TimeEntry struct {
	ID            int64
	ProjectName   string
	StartTime     time.Time
	EndTime       *time.Time
	Description   string
	HourlyRate    *float64
	MilestoneName *string
}

func (*TimeEntry) Duration

func (t *TimeEntry) Duration() time.Duration

func (*TimeEntry) IsRunning

func (t *TimeEntry) IsRunning() bool

func (*TimeEntry) RoundedHours added in v0.1.3

func (t *TimeEntry) RoundedHours() float64

RoundedHours returns duration in hours rounded to 2 decimal places for billing. Could be made configurable to support different rounding increments (0.1h, 0.25h, etc).

Jump to

Keyboard shortcuts

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