Skip to content

Commit de06ddc

Browse files
committed
Initial work on materialized views
1 parent 52a7c91 commit de06ddc

12 files changed

+397
-232
lines changed

internal/database/cost.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ type CostRepo interface {
1212
CostUpsert(ctx context.Context, arg []gensql.CostUpsertParams) *gensql.CostUpsertBatchResults
1313
DailyCostForApp(ctx context.Context, fromDate pgtype.Date, toDate pgtype.Date, environment string, teamSlug slug.Slug, app string) ([]*gensql.Cost, error)
1414
DailyCostForTeam(ctx context.Context, fromDate pgtype.Date, toDate pgtype.Date, teamSlug slug.Slug) ([]*gensql.Cost, error)
15-
DailyEnvCostForTeam(ctx context.Context, fromDate pgtype.Date, toDate pgtype.Date, environment *string, teamSlug slug.Slug) ([]*gensql.DailyEnvCostForTeamRow, error)
15+
DailyEnvCostForTeam(ctx context.Context, fromDate pgtype.Date, toDate pgtype.Date, environment *string, teamSlug slug.Slug) ([]*gensql.CostDailyTeam, error)
1616
LastCostDate(ctx context.Context) (pgtype.Date, error)
17-
MonthlyCostForApp(ctx context.Context, teamSlug slug.Slug, app string, environment string) ([]*gensql.MonthlyCostForAppRow, error)
18-
MonthlyCostForTeam(ctx context.Context, teamSlug slug.Slug) ([]*gensql.MonthlyCostForTeamRow, error)
17+
MonthlyCostForApp(ctx context.Context, teamSlug slug.Slug, app string, environment string) ([]*gensql.CostMonthlyApp, error)
18+
MonthlyCostForTeam(ctx context.Context, teamSlug slug.Slug) ([]*gensql.CostMonthlyTeam, error)
1919
}
2020

2121
var _ CostRepo = (*database)(nil)
@@ -42,7 +42,7 @@ func (d *database) DailyCostForTeam(ctx context.Context, fromDate pgtype.Date, t
4242
})
4343
}
4444

45-
func (d *database) DailyEnvCostForTeam(ctx context.Context, fromDate pgtype.Date, toDate pgtype.Date, environment *string, teamSlug slug.Slug) ([]*gensql.DailyEnvCostForTeamRow, error) {
45+
func (d *database) DailyEnvCostForTeam(ctx context.Context, fromDate pgtype.Date, toDate pgtype.Date, environment *string, teamSlug slug.Slug) ([]*gensql.CostDailyTeam, error) {
4646
return d.querier.DailyEnvCostForTeam(ctx, gensql.DailyEnvCostForTeamParams{
4747
FromDate: fromDate,
4848
ToDate: toDate,
@@ -55,14 +55,14 @@ func (d *database) LastCostDate(ctx context.Context) (pgtype.Date, error) {
5555
return d.querier.LastCostDate(ctx)
5656
}
5757

58-
func (d *database) MonthlyCostForApp(ctx context.Context, teamSlug slug.Slug, app string, environment string) ([]*gensql.MonthlyCostForAppRow, error) {
58+
func (d *database) MonthlyCostForApp(ctx context.Context, teamSlug slug.Slug, app string, environment string) ([]*gensql.CostMonthlyApp, error) {
5959
return d.querier.MonthlyCostForApp(ctx, gensql.MonthlyCostForAppParams{
6060
TeamSlug: teamSlug,
6161
App: app,
6262
Environment: environment,
6363
})
6464
}
6565

66-
func (d *database) MonthlyCostForTeam(ctx context.Context, teamSlug slug.Slug) ([]*gensql.MonthlyCostForTeamRow, error) {
66+
func (d *database) MonthlyCostForTeam(ctx context.Context, teamSlug slug.Slug) ([]*gensql.CostMonthlyTeam, error) {
6767
return d.querier.MonthlyCostForTeam(ctx, teamSlug)
6868
}

internal/database/gensql/cost.sql.go

+101-85
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)