cost

package
v0.0.0-...-5261409 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UpsertBatchSize = 100000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Updater)

Option is a function that can be used to set custom options for the cost updater

func WithBigQueryTable

func WithBigQueryTable(table string) Option

WithBigQueryTable will set a custom BigQuery table to fetch data from

func WithDaysToFetch

func WithDaysToFetch(daysToFetch int) Option

WithDaysToFetch will set a custom number of days to fetch from BigQuery

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

Updater is the cost updater struct

func NewCostUpdater

func NewCostUpdater(bigQueryClient *bigquery.Client, db database.Database, tenantName string, log logrus.FieldLogger, opts ...Option) *Updater

NewCostUpdater creates a new cost updater

func (*Updater) FetchBigQueryData

func (c *Updater) FetchBigQueryData(ctx context.Context, ch chan<- gensql.CostUpsertParams) error

FetchBigQueryData fetches cost data from BigQuery and sends it to the provided channel

func (*Updater) ShouldUpdateCosts

func (c *Updater) ShouldUpdateCosts(ctx context.Context) (bool, error)

ShouldUpdateCosts returns true if costs should be updated, false otherwise

func (*Updater) UpdateCosts

func (c *Updater) UpdateCosts(ctx context.Context, ch <-chan gensql.CostUpsertParams) error

UpdateCosts will update the cost data in the database based on data from the provided channel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL