store

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2017 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type    EventType
	Details Eventer
}

Event is an event in the logs

func (*Event) IsStart

func (e *Event) IsStart() bool

IsStart returns true if the event is a start event

func (*Event) IsStop

func (e *Event) IsStop() bool

IsStop returns true if the event is a stop event

func (*Event) MustGetStartDetails

func (e *Event) MustGetStartDetails() *StartEvent

MustGetStartDetails returns the details for a start event. Panics if it is not a start event.

func (*Event) MustGetStopDetails

func (e *Event) MustGetStopDetails() *StopEvent

MustGetStopDetails returns the details for a stop event. Panics if it is not a stop event.

type EventType

type EventType int

EventType is the type of event that is being parsed

const (
	//ETStart is a start event
	ETStart EventType = 1 + iota
	//ETStop is a stop event
	ETStop
)

type Eventer

type Eventer interface{}

Eventer is any type that is an event

type FileStore

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

FileStore does absolutly nothing to store the logs

func NewFileStore

func NewFileStore(vendor, application string, maxFiles int) *FileStore

NewFileStore creates a new file store based on vendor and application name

func (*FileStore) Events

func (s *FileStore) Events(date int64) ([]*Event, error)

Events returns all the events for the given date

func (*FileStore) Start

func (s *FileStore) Start(timestamp int64, tag, description string) error

Start adds a start log to the file

func (*FileStore) Stop

func (s *FileStore) Stop(timestamp int64, reason pb.StopRequest_Reason) error

Stop adds a stop log to the file

func (*FileStore) TimeSheets

func (s *FileStore) TimeSheets() ([]int64, error)

TimeSheets returns all the timesheets the file store is aware of

type NilStore

type NilStore struct{}

NilStore does absolutly nothing to store the logs

func (*NilStore) Events

func (s *NilStore) Events(date int64) ([]*Event, error)

Events does absolutly nothing

func (*NilStore) Start

func (s *NilStore) Start(timestamp int64, tag, description string) error

Start does absolutly nothing

func (*NilStore) Stop

func (s *NilStore) Stop(timestamp int64, reason pb.StopRequest_Reason) error

Stop does absolutly nothing

func (*NilStore) TimeSheets

func (s *NilStore) TimeSheets() ([]int64, error)

TimeSheets does absolutly nothing

type StartEvent

type StartEvent struct {
	StartTime   int64
	Tag         string
	Description string
}

StartEvent details for a start event

type StopEvent

type StopEvent struct {
	StopTime int64
	Reason   pb.StopRequest_Reason
}

StopEvent details for a stop event

type Storer

type Storer interface {
	Start(timestamp int64, tag, description string) error
	Stop(timestamp int64, reason pb.StopRequest_Reason) error
	TimeSheets() ([]int64, error)
	Events(date int64) ([]*Event, error)
}

Storer is any type that can store the event logs and return them

Jump to

Keyboard shortcuts

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