common/repository/statistics/statistics.go
2024-03-15 16:02:09 +03:00

45 lines
858 B
Go

package statistics
import (
"context"
"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,
}
}
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),
}
}