Documentation
¶
Index ¶
- type AdjustmentRecord
- type BillingPeriod
- type CorrectionDelta
- type DBTX
- type GetPricingModelRow
- type GetStatementParams
- type GetStatementRow
- type LatestRunWithResourceParams
- type ListCorrectionDeltasRow
- type ListPricingModelsRow
- type ListResourceSegmentsParams
- type ListResourceSegmentsRow
- type ListRunTotalsForPeriodRow
- type ListRunsSettlingForRow
- type ListStatementsForProjectRow
- type ListStatementsRow
- type PricingModel
- type ProjectStatement
- type Queries
- func (q *Queries) GetPeriod(ctx context.Context, periodFrom pgtype.Timestamptz) (BillingPeriod, error)
- func (q *Queries) GetPricingModel(ctx context.Context, version string) (GetPricingModelRow, error)
- func (q *Queries) GetRun(ctx context.Context, id pgtype.UUID) (Run, error)
- func (q *Queries) GetStatement(ctx context.Context, arg GetStatementParams) (GetStatementRow, error)
- func (q *Queries) LatestRunWithResource(ctx context.Context, arg LatestRunWithResourceParams) (pgtype.UUID, error)
- func (q *Queries) ListCorrectionDeltas(ctx context.Context, runID pgtype.UUID) ([]ListCorrectionDeltasRow, error)
- func (q *Queries) ListPeriods(ctx context.Context) ([]BillingPeriod, error)
- func (q *Queries) ListPricingModels(ctx context.Context) ([]ListPricingModelsRow, error)
- func (q *Queries) ListResourceSegments(ctx context.Context, arg ListResourceSegmentsParams) ([]ListResourceSegmentsRow, error)
- func (q *Queries) ListRunTotalsForPeriod(ctx context.Context, periodFrom pgtype.Timestamptz) ([]ListRunTotalsForPeriodRow, error)
- func (q *Queries) ListRuns(ctx context.Context, limit int32) ([]Run, error)
- func (q *Queries) ListRunsForPeriod(ctx context.Context, periodFrom pgtype.Timestamptz) ([]Run, error)
- func (q *Queries) ListRunsSettlingFor(ctx context.Context, beneficiary pgtype.Text) ([]ListRunsSettlingForRow, error)
- func (q *Queries) ListStatements(ctx context.Context, runID pgtype.UUID) ([]ListStatementsRow, error)
- func (q *Queries) ListStatementsForProject(ctx context.Context, projectID string) ([]ListStatementsForProjectRow, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RatedRecord
- type Run
- type UsageRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdjustmentRecord ¶
type BillingPeriod ¶
type BillingPeriod struct {
PeriodFrom pgtype.Timestamptz
PeriodTo pgtype.Timestamptz
Status string
FinalizedRunID pgtype.UUID
FinalizedAt pgtype.Timestamptz
}
type CorrectionDelta ¶
type GetPricingModelRow ¶
type GetPricingModelRow struct {
Version string
ValidFrom pgtype.Timestamptz
Currency string
ImportedAt pgtype.Timestamptz
Document []byte
}
type GetStatementParams ¶
type GetStatementRow ¶
type ListCorrectionDeltasRow ¶
type ListPricingModelsRow ¶
type ListPricingModelsRow struct {
Version string
ValidFrom pgtype.Timestamptz
Currency string
ImportedAt pgtype.Timestamptz
}
type ListResourceSegmentsRow ¶
type ListRunsSettlingForRow ¶
type ListStatementsRow ¶
type PricingModel ¶
type PricingModel struct {
Version string
ValidFrom pgtype.Timestamptz
Currency string
Document []byte
ImportedAt pgtype.Timestamptz
}
type ProjectStatement ¶
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) GetPeriod ¶
func (q *Queries) GetPeriod(ctx context.Context, periodFrom pgtype.Timestamptz) (BillingPeriod, error)
The head of a period page: one month, where it stands, and which run closed it.
func (*Queries) GetPricingModel ¶
One pricing version with the catalog document the pricing page renders.
func (*Queries) GetStatement ¶
func (q *Queries) GetStatement(ctx context.Context, arg GetStatementParams) (GetStatementRow, error)
The statement page: the stored document and the total it sums to.
func (*Queries) LatestRunWithResource ¶
func (q *Queries) LatestRunWithResource(ctx context.Context, arg LatestRunWithResourceParams) (pgtype.UUID, error)
The run a resource page defaults to: the newest run that metered that resource at all.
func (*Queries) ListCorrectionDeltas ¶
func (q *Queries) ListCorrectionDeltas(ctx context.Context, runID pgtype.UUID) ([]ListCorrectionDeltasRow, error)
The delta table of a correction run page: what the correction moved, per key.
func (*Queries) ListPeriods ¶
func (q *Queries) ListPeriods(ctx context.Context) ([]BillingPeriod, error)
The period list of the overview page: what months exist, where each one stands, and which run closed the finalized ones.
func (*Queries) ListPricingModels ¶
func (q *Queries) ListPricingModels(ctx context.Context) ([]ListPricingModelsRow, error)
The pricing page's version list, the version in force last first.
func (*Queries) ListResourceSegments ¶
func (q *Queries) ListResourceSegments(ctx context.Context, arg ListResourceSegmentsParams) ([]ListResourceSegmentsRow, error)
The timeline of a resource page: every metered segment of one run with the amounts it was rated at.
func (*Queries) ListRunTotalsForPeriod ¶
func (q *Queries) ListRunTotalsForPeriod(ctx context.Context, periodFrom pgtype.Timestamptz) ([]ListRunTotalsForPeriodRow, error)
The totals of a period page: per run of one month and currency, how many statements the run wrote and what they add up to.
func (*Queries) ListRuns ¶
The run list of the overview page, newest first and bounded by the caller.
func (*Queries) ListRunsForPeriod ¶
func (q *Queries) ListRunsForPeriod(ctx context.Context, periodFrom pgtype.Timestamptz) ([]Run, error)
The run table of a period page: every run of one month in the order the runs started, so a correction stands under the run it corrects.
func (*Queries) ListRunsSettlingFor ¶
func (q *Queries) ListRunsSettlingFor(ctx context.Context, beneficiary pgtype.Text) ([]ListRunsSettlingForRow, error)
The runs a partner's settlement is read from: every run that stands of every period that ever settled a kickback for the partner. A period is read whole, rather than only the runs holding a record for the partner, because a correction that takes a kickback away holds no record of it and is what the settlement of that period then hangs on.
func (*Queries) ListStatements ¶
func (q *Queries) ListStatements(ctx context.Context, runID pgtype.UUID) ([]ListStatementsRow, error)
The statement table of a run page, largest total first. The project key breaks a tie between two equal totals, so the page renders one order.
func (*Queries) ListStatementsForProject ¶
func (q *Queries) ListStatementsForProject(ctx context.Context, projectID string) ([]ListStatementsForProjectRow, error)
The history of one project across runs, oldest month first.
type RatedRecord ¶
type Run ¶
type Run struct {
ID pgtype.UUID
PeriodFrom pgtype.Timestamptz
PeriodTo pgtype.Timestamptz
Kind string
CorrectsRunID pgtype.UUID
PricingVersion pgtype.Text
Status string
Clouds []string
Stats []byte
StartedAt pgtype.Timestamptz
CompletedAt pgtype.Timestamptz
}