Documentation
¶
Index ¶
- type PostgresRepository
- func (r *PostgresRepository) Close() error
- func (r *PostgresRepository) GetRecentSessions(userID string, since time.Time) ([]SessionRecord, error)
- func (r *PostgresRepository) GetSessionStats(userID string) (*SessionStats, error)
- func (r *PostgresRepository) GetSessionsByUser(userID string) ([]SessionRecord, error)
- func (r *PostgresRepository) SaveSession(record *SessionRecord) error
- type Repository
- type SQLiteRepository
- func (r *SQLiteRepository) Close() error
- func (r *SQLiteRepository) GetRecentSessions(userID string, since time.Time) ([]SessionRecord, error)
- func (r *SQLiteRepository) GetSessionStats(userID string) (*SessionStats, error)
- func (r *SQLiteRepository) GetSessionsByUser(userID string) ([]SessionRecord, error)
- func (r *SQLiteRepository) SaveSession(record *SessionRecord) error
- type SessionRecord
- type SessionStats
- type StepRecord
- type SuccessLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresRepository ¶
type PostgresRepository struct {
// contains filtered or unexported fields
}
func NewPostgresRepository ¶
func NewPostgresRepository(connStr string) (*PostgresRepository, error)
func (*PostgresRepository) Close ¶
func (r *PostgresRepository) Close() error
func (*PostgresRepository) GetRecentSessions ¶
func (r *PostgresRepository) GetRecentSessions(userID string, since time.Time) ([]SessionRecord, error)
func (*PostgresRepository) GetSessionStats ¶
func (r *PostgresRepository) GetSessionStats(userID string) (*SessionStats, error)
func (*PostgresRepository) GetSessionsByUser ¶
func (r *PostgresRepository) GetSessionsByUser(userID string) ([]SessionRecord, error)
func (*PostgresRepository) SaveSession ¶
func (r *PostgresRepository) SaveSession(record *SessionRecord) error
type Repository ¶
type Repository interface {
SaveSession(record *SessionRecord) error
GetSessionsByUser(userID string) ([]SessionRecord, error)
GetRecentSessions(userID string, since time.Time) ([]SessionRecord, error)
GetSessionStats(userID string) (*SessionStats, error)
Close() error
}
type SQLiteRepository ¶
type SQLiteRepository struct {
// contains filtered or unexported fields
}
func NewSQLiteRepository ¶
func NewSQLiteRepository(dbPath string) (*SQLiteRepository, error)
func (*SQLiteRepository) Close ¶
func (r *SQLiteRepository) Close() error
func (*SQLiteRepository) GetRecentSessions ¶
func (r *SQLiteRepository) GetRecentSessions(userID string, since time.Time) ([]SessionRecord, error)
func (*SQLiteRepository) GetSessionStats ¶
func (r *SQLiteRepository) GetSessionStats(userID string) (*SessionStats, error)
func (*SQLiteRepository) GetSessionsByUser ¶
func (r *SQLiteRepository) GetSessionsByUser(userID string) ([]SessionRecord, error)
func (*SQLiteRepository) SaveSession ¶
func (r *SQLiteRepository) SaveSession(record *SessionRecord) error
type SessionRecord ¶
type SessionRecord struct {
ID string
UserID string
TargetSec int
Success SuccessLevel
Comment string
StartedAt time.Time
CompletedAt time.Time
Steps []StepRecord
}
func FromDomainSession ¶
func FromDomainSession(s *domain.Session, success SuccessLevel, comment string) *SessionRecord
FromDomainSession converts a domain.Session to a SessionRecord
type SessionStats ¶
type StepRecord ¶
type SuccessLevel ¶
type SuccessLevel string
const ( SuccessLevelFail SuccessLevel = "fail" SuccessLevelOK SuccessLevel = "ok" SuccessLevelGreat SuccessLevel = "great" )
Click to show internal directories.
Click to hide internal directories.