Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultPageSize = 50
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CursorParams ¶
type CursorResult ¶
type CycleRepository ¶
type CycleRepository interface {
Upsert(ctx context.Context, cycle *whoop.Cycle) error
UpsertBatch(ctx context.Context, cycles []whoop.Cycle) error
Get(ctx context.Context, id int64) (*whoop.Cycle, error)
GetByDate(ctx context.Context, date time.Time) (*whoop.Cycle, error)
GetLatest(ctx context.Context, limit int) ([]whoop.Cycle, error)
GetByDateRange(ctx context.Context, start, end time.Time, cursor *CursorParams) (*CursorResult[whoop.Cycle], error)
GetPending(ctx context.Context) ([]whoop.Cycle, error)
}
type RecoveryRepository ¶
type RecoveryRepository interface {
Upsert(ctx context.Context, recovery *whoop.Recovery) error
UpsertBatch(ctx context.Context, recoveries []whoop.Recovery) error
Get(ctx context.Context, cycleID int64) (*whoop.Recovery, error)
GetByCycleIDs(ctx context.Context, cycleIDs []int64) ([]whoop.Recovery, error)
Delete(ctx context.Context, cycleID int64) error
}
type Repository ¶
type Repository struct {
SyncState SyncStateRepository
Cycles CycleRepository
Recoveries RecoveryRepository
Sleeps SleepRepository
Workouts WorkoutRepository
}
func New ¶
func New(q sqlitec.Querier) *Repository
type SleepRepository ¶
type SleepRepository interface {
Upsert(ctx context.Context, sleep *whoop.Sleep) error
UpsertBatch(ctx context.Context, sleeps []whoop.Sleep) error
Get(ctx context.Context, id string) (*whoop.Sleep, error)
GetByCycleID(ctx context.Context, cycleID int64) (*whoop.Sleep, error)
GetByDateRange(ctx context.Context, start, end time.Time, cursor *CursorParams) (*CursorResult[whoop.Sleep], error)
Delete(ctx context.Context, id string) error
}
type SyncStateRepository ¶
type SyncStateRepository interface {
Get(ctx context.Context) (*SyncState, error)
Upsert(ctx context.Context, state *SyncState) error
MarkBackfillComplete(ctx context.Context) error
UpdateBackfillWatermark(ctx context.Context, watermark time.Time) error
UpdateLastFullSync(ctx context.Context, syncTime time.Time) error
GetLastNotificationPoll(ctx context.Context) (*time.Time, error)
UpdateLastNotificationPoll(ctx context.Context, pollTime time.Time) error
}
type WorkoutRepository ¶
type WorkoutRepository interface {
Upsert(ctx context.Context, workout *whoop.Workout) error
UpsertBatch(ctx context.Context, workouts []whoop.Workout) error
Get(ctx context.Context, id string) (*whoop.Workout, error)
GetByDateRange(ctx context.Context, start, end time.Time, cursor *CursorParams) (*CursorResult[whoop.Workout], error)
Delete(ctx context.Context, id string) error
}
Click to show internal directories.
Click to hide internal directories.