Documentation
¶
Index ¶
- func TruncateDay(timestamp int64) int64
- type Buffer
- type Buffers
- type CodingSession
- type CodingSessions
- func (s CodingSessions) Len() int
- func (s CodingSessions) Less(i, j int) bool
- func (s CodingSessions) MergeByDay() CodingSessions
- func (s CodingSessions) MergeByMonth() CodingSessions
- func (s CodingSessions) MergeByWeek() CodingSessions
- func (s CodingSessions) MergeByYear() CodingSessions
- func (s CodingSessions) Swap(i, j int)
- type Config
- type Event
- type File
- type Files
- type GitFile
- type Period
- type Repositories
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TruncateDay ¶
TruncateDay truncates the timestamp to the start of the day.
Types ¶
type Buffer ¶
type Buffer struct {
OpenedAt time.Time `json:"-"`
ClosedAt time.Time `json:"-"`
Duration time.Duration `json:"duration"`
Filename string `json:"filename"`
Filepath string `json:"filepath"`
Filetype string `json:"filetype"`
Repository string `json:"repository"`
}
Buffer rerpresents a buffer that has been edited during a coding session.
type Buffers ¶
type Buffers []Buffer
Buffers represents a slice of buffers that have been edited during a coding session.
type CodingSession ¶
type CodingSession struct {
ID string `bson:"_id,omitempty"`
Period Period `bson:"period"`
EpochDateMs int64 `bson:"date"`
DateString string `bson:"date_string"`
TotalTimeMs int64 `bson:"total_time_ms"`
Repositories Repositories `bson:"repositories"`
}
CodingSession represents a coding session that has been aggregated for a given time period (day, week, month, year).
func NewCodingSession ¶
func NewCodingSession(buffers Buffers, now time.Time) CodingSession
type CodingSessions ¶
type CodingSessions []CodingSession
CodingSessions represents a slice of coding sessions.
func (CodingSessions) Len ¶ added in v0.2.1
func (s CodingSessions) Len() int
func (CodingSessions) Less ¶ added in v0.2.1
func (s CodingSessions) Less(i, j int) bool
func (CodingSessions) MergeByDay ¶
func (s CodingSessions) MergeByDay() CodingSessions
MergeByDay merges sessions that occurred the same day.
func (CodingSessions) MergeByMonth ¶
func (s CodingSessions) MergeByMonth() CodingSessions
MergeByMonth merges sessions that occurred the same month.
func (CodingSessions) MergeByWeek ¶
func (s CodingSessions) MergeByWeek() CodingSessions
MergeByWeek merges sessions that occurred the same week.
func (CodingSessions) MergeByYear ¶
func (s CodingSessions) MergeByYear() CodingSessions
MergeByYear merges sessions that occurred the same year.
func (CodingSessions) Swap ¶ added in v0.2.1
func (s CodingSessions) Swap(i, j int)
type Config ¶
type Config struct {
Server struct {
Name string
Hostname string
Port string
AggregationInterval time.Duration
SegmentationInterval time.Duration
SegmentSizeKB int
}
Database struct {
Name string
URI string
Collection string
}
}
func ParseConfig ¶
type File ¶
type File struct {
Name string `bson:"name"`
Path string `bson:"path"`
Filetype string `bson:"filetype"`
DurationMs int64 `bson:"duration_ms"`
}
File represents a file that has been aggregated for a given time period (day, week, month, year).
type Files ¶
type Files []File
Files represents a slice of files that has been aggregated for a given time period (day, week, month, year).
type Period ¶
type Period int8
Period represents the time period for which the coding sessions have been aggregated.
type Repositories ¶
type Repositories []Repository
Repositories represents a list of git repositories.
type Repository ¶
type Repository struct {
Name string `bson:"name"`
Files Files `bson:"files"`
DurationMs int64 `bson:"duration_ms"`
}
Repository represents a git repository. A coding session might open files across any number of repos. The files of the coding session are later grouped by repository.

