Documentation
¶
Index ¶
- type APIClient
- func (a *APIClient) BulkReplaceSetsByDate(date string, sets []models.Set) error
- func (a *APIClient) DeleteEx(id int) error
- func (a *APIClient) DeleteSet(id int) error
- func (a *APIClient) DeleteW(id int) error
- func (a *APIClient) GetConfig() (models.Conf, error)
- func (a *APIClient) GetSet(id int) (models.Set, error)
- func (a *APIClient) InsertEx(ex models.Exercise) error
- func (a *APIClient) InsertSet(set models.Set) (int, error)
- func (a *APIClient) InsertW(w models.BodyWeight) error
- func (a *APIClient) SaveConfig(cfg models.Conf) error
- func (a *APIClient) SelectEx() ([]models.Exercise, error)
- func (a *APIClient) SelectSet() ([]models.Set, error)
- func (a *APIClient) SelectW() ([]models.BodyWeight, error)
- func (a *APIClient) UpdateExColor(id int, color string) error
- func (a *APIClient) UpdateSet(id int, upd models.SetUpdate) error
- type PostgresStore
- func (s *PostgresStore) BulkReplaceSetsByDate(date string, sets []models.Set) error
- func (s *PostgresStore) DeleteEx(id int) error
- func (s *PostgresStore) DeleteSet(id int) error
- func (s *PostgresStore) DeleteW(id int) error
- func (s *PostgresStore) GetSet(id int) (models.Set, error)
- func (s *PostgresStore) InsertEx(ex models.Exercise) error
- func (s *PostgresStore) InsertSet(set models.Set) (int, error)
- func (s *PostgresStore) InsertW(w models.BodyWeight) error
- func (s *PostgresStore) Pool() *pgxpool.Pool
- func (s *PostgresStore) SelectEx() ([]models.Exercise, error)
- func (s *PostgresStore) SelectSet() ([]models.Set, error)
- func (s *PostgresStore) SelectW() ([]models.BodyWeight, error)
- func (s *PostgresStore) UpdateExColor(id int, color string) error
- func (s *PostgresStore) UpdateSet(id int, upd models.SetUpdate) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient implements Store by calling the PUMP JSON API. It adds an optional API key on every request via the X-Api-Key header.
func NewAPIClient ¶
NewAPIClient constructs a client pointed at baseURL (e.g. "http://localhost:8851"). apiKey may be empty when the API server runs without key protection.
func (*APIClient) BulkReplaceSetsByDate ¶
func (*APIClient) SaveConfig ¶
SaveConfig persists non-auth configuration fields via the API.
type PostgresStore ¶
type PostgresStore struct {
// contains filtered or unexported fields
}
PostgresStore implements Store using a PostgreSQL connection pool.
func NewPostgres ¶
func NewPostgres(dsn string) (*PostgresStore, error)
NewPostgres dials the PostgreSQL DSN, pings the server, and returns a ready-to-use store. Call db.MigratePostgres before using the store.
func (*PostgresStore) BulkReplaceSetsByDate ¶
func (s *PostgresStore) BulkReplaceSetsByDate(date string, sets []models.Set) error
func (*PostgresStore) DeleteEx ¶
func (s *PostgresStore) DeleteEx(id int) error
func (*PostgresStore) DeleteSet ¶ added in v0.0.72
func (s *PostgresStore) DeleteSet(id int) error
func (*PostgresStore) DeleteW ¶
func (s *PostgresStore) DeleteW(id int) error
func (*PostgresStore) GetSet ¶ added in v0.0.72
func (s *PostgresStore) GetSet(id int) (models.Set, error)
func (*PostgresStore) InsertSet ¶ added in v0.0.72
func (s *PostgresStore) InsertSet(set models.Set) (int, error)
func (*PostgresStore) InsertW ¶
func (s *PostgresStore) InsertW(w models.BodyWeight) error
func (*PostgresStore) Pool ¶
func (s *PostgresStore) Pool() *pgxpool.Pool
Pool exposes the underlying connection pool (used by the migrate package).
func (*PostgresStore) SelectW ¶
func (s *PostgresStore) SelectW() ([]models.BodyWeight, error)
func (*PostgresStore) UpdateExColor ¶
func (s *PostgresStore) UpdateExColor(id int, color string) error
type Store ¶
type Store interface {
SelectEx() ([]models.Exercise, error)
InsertEx(ex models.Exercise) error
DeleteEx(id int) error
UpdateExColor(id int, color string) error
SelectSet() ([]models.Set, error)
// BulkReplaceSetsByDate atomically replaces all sets for a given date.
// Used by the manual-entry form path. Per-set ops below are used by the
// CV auto-log path and any UI that edits one set at a time.
BulkReplaceSetsByDate(date string, sets []models.Set) error
GetSet(id int) (models.Set, error)
// InsertSet appends a single set and returns its new ID. Empty Source is
// stored as "manual"; zero Confidence is stored as 1.0; Pending defaults
// to false. Other defaults come from the schema.
InsertSet(set models.Set) (int, error)
UpdateSet(id int, upd models.SetUpdate) error
DeleteSet(id int) error
SelectW() ([]models.BodyWeight, error)
InsertW(w models.BodyWeight) error
DeleteW(id int) error
}
Store abstracts data access so both the monolith (SQLite) and the split frontend (HTTP API client) can satisfy the same interface.