common/repository/statistics/statistics.go

45 lines
858 B
Go
Raw Normal View History

2024-03-15 12:31:12 +00:00
package statistics
import (
2024-03-15 13:02:09 +00:00
"context"
2024-03-15 12:31:12 +00:00
"database/sql"
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
)
type Deps struct {
Queries *sqlcgen.Queries
Pool *sql.DB
}
type StatisticsRepository struct {
queries *sqlcgen.Queries
pool *sql.DB
}
func NewStatisticsRepo(deps Deps) *StatisticsRepository {
return &StatisticsRepository{
queries: deps.Queries,
pool: deps.Pool,
}
}
2024-03-15 13:02:09 +00:00
type DeviceStatReq struct {
QuizId string
From uint64
To uint64
}
type DeviceStatResp struct {
Device map[string]float64
OS map[string]float64
Browser map[string]float64
}
func (r *StatisticsRepository) GetDeviceStatistics(ctx context.Context, req DeviceStatReq) DeviceStatResp {
resp := DeviceStatResp{
Device: make(map[string]float64),
OS: make(map[string]float64),
Browser: make(map[string]float64),
}
}