Documentation ¶
Index ¶
- Variables
- type Interval
- type Queryer
- type Sanity
- type SyncerConfig
- type TaggedInterval
- type TimeTracker
- func (tt *TimeTracker) Close() error
- func (tt *TimeTracker) Continue(t time.Time, id string) (ret error)
- func (tt *TimeTracker) Current() (*TaggedInterval, error)
- func (tt *TimeTracker) Delete(id string) (ret error)
- func (tt *TimeTracker) List(since, until time.Time) (retTi []TaggedInterval, retErr error)
- func (tt *TimeTracker) Start(t time.Time, tags []string) (ret error)
- func (tt *TimeTracker) StopAt(t time.Time) error
- func (tt *TimeTracker) StopFor(d time.Duration) error
- func (tt *TimeTracker) Sync(cfg SyncerConfig) (ret error)
- func (tt *TimeTracker) Tag(id string, tags []string) (ret error)
- func (tt *TimeTracker) Untag(id string, tags []string) (ret error)
- func (tt *TimeTracker) Vacuum(before time.Time) (ret error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrDuplicatedIntervalTag = fmt.Errorf("duplicated interval tags") ErrExistingOpenInterval = fmt.Errorf("already existing opened interval") ErrIntervalTagsUnicity = fmt.Errorf("interval_tags unicity failed") ErrInvalidInterval = fmt.Errorf("invalid interval") ErrInvalidParam = fmt.Errorf("invalid parameter") ErrInvalidStartTimestamp = fmt.Errorf("invalid start timestamp") ErrInvalidStopTimestamp = fmt.Errorf("invalid stop timestamp") ErrMultipleOpenInterval = fmt.Errorf("multiple opened interval") ErrNotFound = fmt.Errorf("not found entity") ErrNotImplemented = fmt.Errorf("operation not implemented") )
Functions ¶
This section is empty.
Types ¶
type Sanity ¶
type Sanity struct {
// contains filtered or unexported fields
}
Sanity object gathers all methods which implement the logic to check the data sanity in the database
type SyncerConfig ¶
type SyncerConfig struct { Login string Password string Hostname string Port int DatabaseName string }
func (SyncerConfig) String ¶
func (cfg SyncerConfig) String() string
type TaggedInterval ¶
type TimeTracker ¶
type TimeTracker struct {
// contains filtered or unexported fields
}
func New ¶
func New(databaseName string) (*TimeTracker, error)
func (*TimeTracker) Close ¶
func (tt *TimeTracker) Close() error
Close releases resources associated with the TimeTracker object.
func (*TimeTracker) Continue ¶
func (tt *TimeTracker) Continue(t time.Time, id string) (ret error)
Continue opens a new interval with the same tags as the last closed one. It will return an error if there is already an opened interval.
func (*TimeTracker) Current ¶
func (tt *TimeTracker) Current() (*TaggedInterval, error)
Current returned the currently single opened interval if any.
func (*TimeTracker) Delete ¶
func (tt *TimeTracker) Delete(id string) (ret error)
func (*TimeTracker) List ¶
func (tt *TimeTracker) List(since, until time.Time) (retTi []TaggedInterval, retErr error)
List returns a list of interval whose start timestamp is equal or after the timestamp given as parameter. XXX add unit test
func (*TimeTracker) Start ¶
func (tt *TimeTracker) Start(t time.Time, tags []string) (ret error)
Start registers a new opened interval with a set of tags. This method ensures that no other opened is currently registered in the database and that the wanted start time doesn't already belong to a closed interval.
func (*TimeTracker) Sync ¶
func (tt *TimeTracker) Sync(cfg SyncerConfig) (ret error)
Sync performs a bidirectional synchronisation with the central database.