Documentation ¶
Index ¶
- Variables
- func Close() error
- func DeleteInterval(i interval.Interval) error
- func FindIntervalByID(id int) (interval.Interval, error)
- func FindIntervalsByCriteria(c interval.Interval) ([]interval.Interval, error)
- func FindLastOpenIntervalForTag(tag string) (interval.Interval, error)
- func FindOpenIntervalsForTag(tag string) ([]interval.Interval, error)
- func FindOverlappingIntervals(i interval.Interval) ([]interval.Interval, error)
- func Init(args ...interface{})
- func SaveInterval(i *interval.Interval) error
- func SetFactory(fn FactoryFunc)
- type Datastore
- type FactoryFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var SqliteFactory = FactoryFunc(func(args ...interface{}) (Datastore, error) { if len(args) == 0 { return nil, errors.New("invalid data source") } switch filename := args[0].(type) { case string: return newSqlite(filename) default: return nil, fmt.Errorf("invalid database source: expected string, got %v", filename) } })
SqliteFactory creates a new sqlite datastore
Functions ¶
func DeleteInterval ¶
DeleteInterval delete interval i
func FindIntervalByID ¶
FindIntervalByID finds the interval with given id
func FindIntervalsByCriteria ¶
FindIntervalsByCriteria finds intervals matching the criteria
func FindLastOpenIntervalForTag ¶
FindLastOpenIntervalForTag finds the last open interval for tag
func FindOpenIntervalsForTag ¶
FindOpenIntervalsForTag finds open intervals for tag
func FindOverlappingIntervals ¶
FindOverlappingIntervals finds intervals that are overlapping with i
func SetFactory ¶
func SetFactory(fn FactoryFunc)
SetFactory sets the factory for creating the datastore
Types ¶
type Datastore ¶
type Datastore interface { // FindIntervalByID finds the interval with given id FindIntervalByID(int) (interval.Interval, error) // DeleteInterval delete interval i DeleteInterval(interval.Interval) error // SaveInterval saves interval i SaveInterval(*interval.Interval) error // FindOverlappingIntervals finds intervals that are overlapping with i FindOverlappingIntervals(interval.Interval) ([]interval.Interval, error) // FindOpenIntervalsForTag finds open intervals for tag FindOpenIntervalsForTag(string) ([]interval.Interval, error) // FindLastOpenIntervalForTag finds the last open interval for tag FindLastOpenIntervalForTag(string) (interval.Interval, error) // FindIntervalsByCriteria finds intervals matching the criteria FindIntervalsByCriteria(interval.Interval) ([]interval.Interval, error) // Close closes the database Close() error }
Datastore defines the interface for a datastore
type FactoryFunc ¶
FactoryFunc defines a function that creates a datastore
Click to show internal directories.
Click to hide internal directories.