db

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright © 2025 Eden Phillips

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountByDate

func CountByDate(db *sql.DB, date string) (int, error)

CountByDate returns the number of sessions recorded on a given date (YYYY-MM-DD).

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the platform-appropriate default database path.

Linux/BSD: $XDG_DATA_HOME/altum/altum.db (~/.local/share/altum/altum.db) macOS: ~/Library/Application Support/altum/altum.db Windows: %AppData%\altum\altum.db

func Open

func Open(path string) (*sql.DB, error)

Open opens (or creates) the SQLite database at path and applies the schema.

func Save

func Save(db *sql.DB, s SessionRecord) error

Save inserts a new session into the database.

Types

type SessionRecord

type SessionRecord struct {
	Date            string
	StartTime       string
	EndTime         string
	DurationSeconds int
	Milestone       string
	FocusQuality    int
	Interruptions   string
	Reflection      string
}

SessionRecord holds all fields for a single deep-work session.

func Query

func Query(db *sql.DB, days int) ([]SessionRecord, error)

Query returns sessions whose date falls within the last `days` days (inclusive of today).

Jump to

Keyboard shortcuts

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