feat(reports): derive analytics aggregates
This commit is contained in:
@@ -17,6 +17,13 @@ func NewReportingEventRepo(db *gorm.DB) *ReportingEventRepo {
|
||||
return &ReportingEventRepo{db: db}
|
||||
}
|
||||
|
||||
func (r *ReportingEventRepo) DB() *gorm.DB {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
return r.db
|
||||
}
|
||||
|
||||
func (r *ReportingEventRepo) Create(ctx context.Context, event *model.ReportingEvent) error {
|
||||
return r.db.WithContext(ctx).Create(event).Error
|
||||
}
|
||||
@@ -75,4 +82,4 @@ func (r *ReportingEventRepo) FindByAccountIDAndTimeRange(ctx context.Context, ac
|
||||
Where("account_id = ? AND event_start_time >= ? AND event_end_time <= ?", accountID, since, until).
|
||||
Find(&events).Error
|
||||
return events, err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,13 @@ func NewReportingEventsRollupRepo(db *gorm.DB) *ReportingEventsRollupRepo {
|
||||
return &ReportingEventsRollupRepo{db: db}
|
||||
}
|
||||
|
||||
func (r *ReportingEventsRollupRepo) DB() *gorm.DB {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
return r.db
|
||||
}
|
||||
|
||||
func (r *ReportingEventsRollupRepo) Create(ctx context.Context, rollup *model.ReportingEventsRollup) error {
|
||||
return r.db.WithContext(ctx).Create(rollup).Error
|
||||
}
|
||||
@@ -82,4 +89,4 @@ func (r *ReportingEventsRollupRepo) FindByAccountAndDateRangeWithDimension(ctx c
|
||||
}
|
||||
err := query.Find(&rollups).Error
|
||||
return rollups, err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user