store

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package store connects to the data store and manages timers and sessions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*bolt.DB
}

Client is a BoltDB database client.

func NewClient

func NewClient(dbFilePath string) (*Client, error)

NewClient returns a wrapper to a BoltDB connection.

func (*Client) DeleteSessions

func (c *Client) DeleteSessions(startTimes []time.Time) error

func (*Client) GetSessions

func (c *Client) GetSessions(
	since, until time.Time,
	tags []string,
) ([]*models.Session, error)

func (*Client) Open

func (c *Client) Open() error

func (*Client) UpdateSessions

func (c *Client) UpdateSessions(sessions map[time.Time]*models.Session) error

type DB

type DB interface {
	// GetSessions returns saved sessions according to the specified time and tag
	// constraints
	GetSessions(
		since, until time.Time,
		tags []string,
	) ([]*models.Session, error)
	// UpdateSessions updates one or more Focus sessions.
	// Each session is created if it doesn't
	// exist already, or overwritten if it does.
	UpdateSessions(map[time.Time]*models.Session) error
	// DeleteSessions deletes one or more saved sessions
	DeleteSessions(startTimes []time.Time) error
	// Close ends the database connection
	Close() error
	// Open initiates a database connection
	Open() error
}

DB is the database storage interface.

Jump to

Keyboard shortcuts

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