sqldb

package
v0.0.0-...-5bf7dd8 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package sqldb implements the server.DB interface, backed by a sqlite database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func New

func New(dbPath, migrationsPath string, routine *stronk.Routine) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) ComparableLifts

func (db *DB) ComparableLifts(ex stronk.Exercise, weight stronk.Weight) (*stronk.ComparableLifts, error)

func (*DB) CreateExercise

func (db *DB) CreateExercise(ex stronk.Exercise) error

func (*DB) EditLift

func (db *DB) EditLift(id stronk.LiftID, note string, reps int) error

EditLift edits a lift using the new system

func (*DB) GetCurrentRoutine

func (db *DB) GetCurrentRoutine() (*stronk.StoredRoutine, error)

GetCurrentRoutine returns the most recently stored routine.

func (*DB) GetRoutineSet

func (db *DB) GetRoutineSet(id stronk.RoutineSetID) (*stronk.StoredRoutineSet, error)

GetRoutineSet gets a specific routine set by ID

func (*DB) LatestLift

func (db *DB) LatestLift() (*stronk.Lift, error)

func (*DB) LatestLiftPerSetID

func (db *DB) LatestLiftPerSetID(setIDs []stronk.RoutineSetID) (map[stronk.RoutineSetID]*stronk.Lift, error)

func (*DB) Lift

func (db *DB) Lift(id stronk.LiftID) (*stronk.Lift, error)

func (*DB) MigrateLiftsToNewFormat

func (db *DB) MigrateLiftsToNewFormat(storedRoutine *stronk.StoredRoutine) error

MigrateLiftsToNewFormat migrates existing lifts from the old format to the new one This should be called after storing the routine in the database

func (*DB) RecentFailureSets

func (db *DB) RecentFailureSets() ([]*stronk.Lift, error)

func (*DB) RecentLifts

func (db *DB) RecentLifts() ([]*stronk.Lift, error)

func (*DB) RecordLift

func (db *DB) RecordLift(routineSetID stronk.RoutineSetID, reps int, note string, weight stronk.Weight) (stronk.LiftID, error)

RecordLift records a lift using the new routine system

func (*DB) SetSmallestDenom

func (db *DB) SetSmallestDenom(small stronk.Weight) error

func (*DB) SetTrainingMaxes

func (db *DB) SetTrainingMaxes(press, squat, bench, deadlift stronk.Weight) error

func (*DB) SkipWeek

func (db *DB) SkipWeek(note string, week, iter int) error

func (*DB) SkippedWeeks

func (db *DB) SkippedWeeks() ([]stronk.SkippedWeek, error)

func (*DB) SmallestDenom

func (db *DB) SmallestDenom() (stronk.Weight, error)

func (*DB) StoreRoutine

func (db *DB) StoreRoutine(routine *stronk.Routine) (*stronk.StoredRoutine, error)

StoreRoutine stores a new routine in the database

func (*DB) TrainingMaxes

func (db *DB) TrainingMaxes() ([]*stronk.TrainingMax, error)

Jump to

Keyboard shortcuts

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