gensql

package
v0.0.0-...-be2aeb8 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBatchAlreadyClosed = errors.New("batch already closed")
)

Functions

This section is empty.

Types

type AverageResourceUtilizationForTeamParams

type AverageResourceUtilizationForTeamParams struct {
	Team         string
	ResourceType ResourceType
	Timestamp    pgtype.Timestamptz
}

type AverageResourceUtilizationForTeamRow

type AverageResourceUtilizationForTeamRow struct {
	Usage   float64
	Request float64
}

type Cost

type Cost struct {
	ID        int32
	Env       *string
	Team      *string
	App       string
	CostType  string
	Date      pgtype.Date
	DailyCost float32
}

type CostUpsertBatchResults

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

func (*CostUpsertBatchResults) Close

func (b *CostUpsertBatchResults) Close() error

func (*CostUpsertBatchResults) Exec

func (b *CostUpsertBatchResults) Exec(f func(int, error))

type CostUpsertParams

type CostUpsertParams struct {
	Env       *string
	Team      *string
	App       string
	CostType  string
	Date      pgtype.Date
	DailyCost float32
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
	SendBatch(context.Context, *pgx.Batch) pgx.BatchResults
}

type DailyCostForAppParams

type DailyCostForAppParams struct {
	Env      *string
	Team     *string
	App      string
	FromDate pgtype.Date
	ToDate   pgtype.Date
}

type DailyCostForTeamParams

type DailyCostForTeamParams struct {
	Team     *string
	FromDate pgtype.Date
	ToDate   pgtype.Date
}

type DailyEnvCostForTeamParams

type DailyEnvCostForTeamParams struct {
	Env      *string
	Team     *string
	FromDate pgtype.Date
	ToDate   pgtype.Date
}

type DailyEnvCostForTeamRow

type DailyEnvCostForTeamRow struct {
	Team      *string
	App       string
	Date      pgtype.Date
	DailyCost float32
}

type MockQuerier

type MockQuerier struct {
	mock.Mock
}

MockQuerier is an autogenerated mock type for the Querier type

func NewMockQuerier

func NewMockQuerier(t interface {
	mock.TestingT
	Cleanup(func())
},
) *MockQuerier

NewMockQuerier creates a new instance of MockQuerier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockQuerier) AverageResourceUtilizationForTeam

AverageResourceUtilizationForTeam provides a mock function with given fields: ctx, arg

func (*MockQuerier) CostUpsert

CostUpsert provides a mock function with given fields: ctx, arg

func (*MockQuerier) DailyCostForApp

func (_m *MockQuerier) DailyCostForApp(ctx context.Context, arg DailyCostForAppParams) ([]*Cost, error)

DailyCostForApp provides a mock function with given fields: ctx, arg

func (*MockQuerier) DailyCostForTeam

func (_m *MockQuerier) DailyCostForTeam(ctx context.Context, arg DailyCostForTeamParams) ([]*Cost, error)

DailyCostForTeam provides a mock function with given fields: ctx, arg

func (*MockQuerier) DailyEnvCostForTeam

func (_m *MockQuerier) DailyEnvCostForTeam(ctx context.Context, arg DailyEnvCostForTeamParams) ([]*DailyEnvCostForTeamRow, error)

DailyEnvCostForTeam provides a mock function with given fields: ctx, arg

func (*MockQuerier) EXPECT

func (_m *MockQuerier) EXPECT() *MockQuerier_Expecter

func (*MockQuerier) LastCostDate

func (_m *MockQuerier) LastCostDate(ctx context.Context) (pgtype.Date, error)

LastCostDate provides a mock function with given fields: ctx

func (*MockQuerier) MaxResourceUtilizationDate

func (_m *MockQuerier) MaxResourceUtilizationDate(ctx context.Context) (pgtype.Timestamptz, error)

MaxResourceUtilizationDate provides a mock function with given fields: ctx

func (*MockQuerier) MonthlyCostForApp

func (_m *MockQuerier) MonthlyCostForApp(ctx context.Context, arg MonthlyCostForAppParams) ([]*MonthlyCostForAppRow, error)

MonthlyCostForApp provides a mock function with given fields: ctx, arg

func (*MockQuerier) MonthlyCostForTeam

func (_m *MockQuerier) MonthlyCostForTeam(ctx context.Context, team *string) ([]*MonthlyCostForTeamRow, error)

MonthlyCostForTeam provides a mock function with given fields: ctx, team

func (*MockQuerier) ResourceUtilizationForApp

func (_m *MockQuerier) ResourceUtilizationForApp(ctx context.Context, arg ResourceUtilizationForAppParams) ([]*ResourceUtilizationMetric, error)

ResourceUtilizationForApp provides a mock function with given fields: ctx, arg

func (*MockQuerier) ResourceUtilizationForTeam

func (_m *MockQuerier) ResourceUtilizationForTeam(ctx context.Context, arg ResourceUtilizationForTeamParams) ([]*ResourceUtilizationForTeamRow, error)

ResourceUtilizationForTeam provides a mock function with given fields: ctx, arg

func (*MockQuerier) ResourceUtilizationOverageForTeam

ResourceUtilizationOverageForTeam provides a mock function with given fields: ctx, arg

func (*MockQuerier) ResourceUtilizationRangeForApp

ResourceUtilizationRangeForApp provides a mock function with given fields: ctx, arg

func (*MockQuerier) ResourceUtilizationRangeForTeam

func (_m *MockQuerier) ResourceUtilizationRangeForTeam(ctx context.Context, team string) (*ResourceUtilizationRangeForTeamRow, error)

ResourceUtilizationRangeForTeam provides a mock function with given fields: ctx, team

func (*MockQuerier) ResourceUtilizationUpsert

ResourceUtilizationUpsert provides a mock function with given fields: ctx, arg

func (*MockQuerier) SpecificResourceUtilizationForApp

SpecificResourceUtilizationForApp provides a mock function with given fields: ctx, arg

func (*MockQuerier) SpecificResourceUtilizationForTeam

SpecificResourceUtilizationForTeam provides a mock function with given fields: ctx, arg

type MockQuerier_AverageResourceUtilizationForTeam_Call

type MockQuerier_AverageResourceUtilizationForTeam_Call struct {
	*mock.Call
}

MockQuerier_AverageResourceUtilizationForTeam_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AverageResourceUtilizationForTeam'

type MockQuerier_CostUpsert_Call

type MockQuerier_CostUpsert_Call struct {
	*mock.Call
}

MockQuerier_CostUpsert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CostUpsert'

func (*MockQuerier_CostUpsert_Call) Return

func (*MockQuerier_CostUpsert_Call) Run

func (*MockQuerier_CostUpsert_Call) RunAndReturn

type MockQuerier_DailyCostForApp_Call

type MockQuerier_DailyCostForApp_Call struct {
	*mock.Call
}

MockQuerier_DailyCostForApp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DailyCostForApp'

func (*MockQuerier_DailyCostForApp_Call) Return

func (*MockQuerier_DailyCostForApp_Call) Run

func (*MockQuerier_DailyCostForApp_Call) RunAndReturn

type MockQuerier_DailyCostForTeam_Call

type MockQuerier_DailyCostForTeam_Call struct {
	*mock.Call
}

MockQuerier_DailyCostForTeam_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DailyCostForTeam'

func (*MockQuerier_DailyCostForTeam_Call) Return

func (*MockQuerier_DailyCostForTeam_Call) Run

func (*MockQuerier_DailyCostForTeam_Call) RunAndReturn

type MockQuerier_DailyEnvCostForTeam_Call

type MockQuerier_DailyEnvCostForTeam_Call struct {
	*mock.Call
}

MockQuerier_DailyEnvCostForTeam_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DailyEnvCostForTeam'

func (*MockQuerier_DailyEnvCostForTeam_Call) Return

func (*MockQuerier_DailyEnvCostForTeam_Call) Run

type MockQuerier_Expecter

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

func (*MockQuerier_Expecter) AverageResourceUtilizationForTeam

func (_e *MockQuerier_Expecter) AverageResourceUtilizationForTeam(ctx interface{}, arg interface{}) *MockQuerier_AverageResourceUtilizationForTeam_Call

AverageResourceUtilizationForTeam is a helper method to define mock.On call

  • ctx context.Context
  • arg AverageResourceUtilizationForTeamParams

func (*MockQuerier_Expecter) CostUpsert

func (_e *MockQuerier_Expecter) CostUpsert(ctx interface{}, arg interface{}) *MockQuerier_CostUpsert_Call

CostUpsert is a helper method to define mock.On call

  • ctx context.Context
  • arg []CostUpsertParams

func (*MockQuerier_Expecter) DailyCostForApp

func (_e *MockQuerier_Expecter) DailyCostForApp(ctx interface{}, arg interface{}) *MockQuerier_DailyCostForApp_Call

DailyCostForApp is a helper method to define mock.On call

  • ctx context.Context
  • arg DailyCostForAppParams

func (*MockQuerier_Expecter) DailyCostForTeam

func (_e *MockQuerier_Expecter) DailyCostForTeam(ctx interface{}, arg interface{}) *MockQuerier_DailyCostForTeam_Call

DailyCostForTeam is a helper method to define mock.On call

  • ctx context.Context
  • arg DailyCostForTeamParams

func (*MockQuerier_Expecter) DailyEnvCostForTeam

func (_e *MockQuerier_Expecter) DailyEnvCostForTeam(ctx interface{}, arg interface{}) *MockQuerier_DailyEnvCostForTeam_Call

DailyEnvCostForTeam is a helper method to define mock.On call

  • ctx context.Context
  • arg DailyEnvCostForTeamParams

func (*MockQuerier_Expecter) LastCostDate

func (_e *MockQuerier_Expecter) LastCostDate(ctx interface{}) *MockQuerier_LastCostDate_Call

LastCostDate is a helper method to define mock.On call

  • ctx context.Context

func (*MockQuerier_Expecter) MaxResourceUtilizationDate

func (_e *MockQuerier_Expecter) MaxResourceUtilizationDate(ctx interface{}) *MockQuerier_MaxResourceUtilizationDate_Call

MaxResourceUtilizationDate is a helper method to define mock.On call

  • ctx context.Context

func (*MockQuerier_Expecter) MonthlyCostForApp

func (_e *MockQuerier_Expecter) MonthlyCostForApp(ctx interface{}, arg interface{}) *MockQuerier_MonthlyCostForApp_Call

MonthlyCostForApp is a helper method to define mock.On call

  • ctx context.Context
  • arg MonthlyCostForAppParams

func (*MockQuerier_Expecter) MonthlyCostForTeam

func (_e *MockQuerier_Expecter) MonthlyCostForTeam(ctx interface{}, team interface{}) *MockQuerier_MonthlyCostForTeam_Call

MonthlyCostForTeam is a helper method to define mock.On call

  • ctx context.Context
  • team *string

func (*MockQuerier_Expecter) ResourceUtilizationForApp

func (_e *MockQuerier_Expecter) ResourceUtilizationForApp(ctx interface{}, arg interface{}) *MockQuerier_ResourceUtilizationForApp_Call

ResourceUtilizationForApp is a helper method to define mock.On call

  • ctx context.Context
  • arg ResourceUtilizationForAppParams

func (*MockQuerier_Expecter) ResourceUtilizationForTeam

func (_e *MockQuerier_Expecter) ResourceUtilizationForTeam(ctx interface{}, arg interface{}) *MockQuerier_ResourceUtilizationForTeam_Call

ResourceUtilizationForTeam is a helper method to define mock.On call

  • ctx context.Context
  • arg ResourceUtilizationForTeamParams

func (*MockQuerier_Expecter) ResourceUtilizationOverageForTeam

func (_e *MockQuerier_Expecter) ResourceUtilizationOverageForTeam(ctx interface{}, arg interface{}) *MockQuerier_ResourceUtilizationOverageForTeam_Call

ResourceUtilizationOverageForTeam is a helper method to define mock.On call

  • ctx context.Context
  • arg ResourceUtilizationOverageForTeamParams

func (*MockQuerier_Expecter) ResourceUtilizationRangeForApp

func (_e *MockQuerier_Expecter) ResourceUtilizationRangeForApp(ctx interface{}, arg interface{}) *MockQuerier_ResourceUtilizationRangeForApp_Call

ResourceUtilizationRangeForApp is a helper method to define mock.On call

  • ctx context.Context
  • arg ResourceUtilizationRangeForAppParams

func (*MockQuerier_Expecter) ResourceUtilizationRangeForTeam

func (_e *MockQuerier_Expecter) ResourceUtilizationRangeForTeam(ctx interface{}, team interface{}) *MockQuerier_ResourceUtilizationRangeForTeam_Call

ResourceUtilizationRangeForTeam is a helper method to define mock.On call

  • ctx context.Context
  • team string

func (*MockQuerier_Expecter) ResourceUtilizationUpsert

func (_e *MockQuerier_Expecter) ResourceUtilizationUpsert(ctx interface{}, arg interface{}) *MockQuerier_ResourceUtilizationUpsert_Call

ResourceUtilizationUpsert is a helper method to define mock.On call

  • ctx context.Context
  • arg []ResourceUtilizationUpsertParams

func (*MockQuerier_Expecter) SpecificResourceUtilizationForApp

func (_e *MockQuerier_Expecter) SpecificResourceUtilizationForApp(ctx interface{}, arg interface{}) *MockQuerier_SpecificResourceUtilizationForApp_Call

SpecificResourceUtilizationForApp is a helper method to define mock.On call

  • ctx context.Context
  • arg SpecificResourceUtilizationForAppParams

func (*MockQuerier_Expecter) SpecificResourceUtilizationForTeam

func (_e *MockQuerier_Expecter) SpecificResourceUtilizationForTeam(ctx interface{}, arg interface{}) *MockQuerier_SpecificResourceUtilizationForTeam_Call

SpecificResourceUtilizationForTeam is a helper method to define mock.On call

  • ctx context.Context
  • arg SpecificResourceUtilizationForTeamParams

type MockQuerier_LastCostDate_Call

type MockQuerier_LastCostDate_Call struct {
	*mock.Call
}

MockQuerier_LastCostDate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LastCostDate'

func (*MockQuerier_LastCostDate_Call) Return

func (*MockQuerier_LastCostDate_Call) Run

func (*MockQuerier_LastCostDate_Call) RunAndReturn

type MockQuerier_MaxResourceUtilizationDate_Call

type MockQuerier_MaxResourceUtilizationDate_Call struct {
	*mock.Call
}

MockQuerier_MaxResourceUtilizationDate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MaxResourceUtilizationDate'

func (*MockQuerier_MaxResourceUtilizationDate_Call) Return

func (*MockQuerier_MaxResourceUtilizationDate_Call) Run

func (*MockQuerier_MaxResourceUtilizationDate_Call) RunAndReturn

type MockQuerier_MonthlyCostForApp_Call

type MockQuerier_MonthlyCostForApp_Call struct {
	*mock.Call
}

MockQuerier_MonthlyCostForApp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MonthlyCostForApp'

func (*MockQuerier_MonthlyCostForApp_Call) Return

func (*MockQuerier_MonthlyCostForApp_Call) Run

func (*MockQuerier_MonthlyCostForApp_Call) RunAndReturn

type MockQuerier_MonthlyCostForTeam_Call

type MockQuerier_MonthlyCostForTeam_Call struct {
	*mock.Call
}

MockQuerier_MonthlyCostForTeam_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MonthlyCostForTeam'

func (*MockQuerier_MonthlyCostForTeam_Call) Return

func (*MockQuerier_MonthlyCostForTeam_Call) Run

func (*MockQuerier_MonthlyCostForTeam_Call) RunAndReturn

type MockQuerier_ResourceUtilizationForApp_Call

type MockQuerier_ResourceUtilizationForApp_Call struct {
	*mock.Call
}

MockQuerier_ResourceUtilizationForApp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResourceUtilizationForApp'

func (*MockQuerier_ResourceUtilizationForApp_Call) Return

func (*MockQuerier_ResourceUtilizationForApp_Call) Run

type MockQuerier_ResourceUtilizationForTeam_Call

type MockQuerier_ResourceUtilizationForTeam_Call struct {
	*mock.Call
}

MockQuerier_ResourceUtilizationForTeam_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResourceUtilizationForTeam'

func (*MockQuerier_ResourceUtilizationForTeam_Call) Return

func (*MockQuerier_ResourceUtilizationForTeam_Call) Run

type MockQuerier_ResourceUtilizationOverageForTeam_Call

type MockQuerier_ResourceUtilizationOverageForTeam_Call struct {
	*mock.Call
}

MockQuerier_ResourceUtilizationOverageForTeam_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResourceUtilizationOverageForTeam'

type MockQuerier_ResourceUtilizationRangeForApp_Call

type MockQuerier_ResourceUtilizationRangeForApp_Call struct {
	*mock.Call
}

MockQuerier_ResourceUtilizationRangeForApp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResourceUtilizationRangeForApp'

func (*MockQuerier_ResourceUtilizationRangeForApp_Call) Run

type MockQuerier_ResourceUtilizationRangeForTeam_Call

type MockQuerier_ResourceUtilizationRangeForTeam_Call struct {
	*mock.Call
}

MockQuerier_ResourceUtilizationRangeForTeam_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResourceUtilizationRangeForTeam'

func (*MockQuerier_ResourceUtilizationRangeForTeam_Call) Run

type MockQuerier_ResourceUtilizationUpsert_Call

type MockQuerier_ResourceUtilizationUpsert_Call struct {
	*mock.Call
}

MockQuerier_ResourceUtilizationUpsert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResourceUtilizationUpsert'

func (*MockQuerier_ResourceUtilizationUpsert_Call) Run

type MockQuerier_SpecificResourceUtilizationForApp_Call

type MockQuerier_SpecificResourceUtilizationForApp_Call struct {
	*mock.Call
}

MockQuerier_SpecificResourceUtilizationForApp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SpecificResourceUtilizationForApp'

type MockQuerier_SpecificResourceUtilizationForTeam_Call

type MockQuerier_SpecificResourceUtilizationForTeam_Call struct {
	*mock.Call
}

MockQuerier_SpecificResourceUtilizationForTeam_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SpecificResourceUtilizationForTeam'

type MonthlyCostForAppParams

type MonthlyCostForAppParams struct {
	Team *string
	App  string
	Env  *string
}

type MonthlyCostForAppRow

type MonthlyCostForAppRow struct {
	Team             *string
	App              string
	Env              *string
	Month            pgtype.Date
	LastRecordedDate pgtype.Date
	DailyCost        float32
}

type MonthlyCostForTeamRow

type MonthlyCostForTeamRow struct {
	Team             *string
	Month            pgtype.Date
	LastRecordedDate pgtype.Date
	DailyCost        float32
}

type NullResourceType

type NullResourceType struct {
	ResourceType ResourceType
	Valid        bool // Valid is true if ResourceType is not NULL
}

func (*NullResourceType) Scan

func (ns *NullResourceType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullResourceType) Value

func (ns NullResourceType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Querier

type Querier interface {
	// AverageResourceUtilizationForTeam will return the average resource utilization for a team for a week.
	AverageResourceUtilizationForTeam(ctx context.Context, arg AverageResourceUtilizationForTeamParams) (*AverageResourceUtilizationForTeamRow, error)
	// CostUpsert will insert or update a cost record. If there is a conflict on the daily_cost_key constrant, the
	// daily_cost column will be updated.
	CostUpsert(ctx context.Context, arg []CostUpsertParams) *CostUpsertBatchResults
	// DailyCostForApp will fetch the daily cost for a specific team app in a specific environment, across all cost types
	// in a date range.
	DailyCostForApp(ctx context.Context, arg DailyCostForAppParams) ([]*Cost, error)
	// DailyCostForTeam will fetch the daily cost for a specific team across all apps and envs in a date range.
	DailyCostForTeam(ctx context.Context, arg DailyCostForTeamParams) ([]*Cost, error)
	// DailyEnvCostForTeam will fetch the daily cost for a specific team and env across all apps in a date range.
	DailyEnvCostForTeam(ctx context.Context, arg DailyEnvCostForTeamParams) ([]*DailyEnvCostForTeamRow, error)
	// LastCostDate will return the last date that has a cost.
	LastCostDate(ctx context.Context) (pgtype.Date, error)
	// MaxResourceUtilizationDate will return the max date for resource utilization records.
	MaxResourceUtilizationDate(ctx context.Context) (pgtype.Timestamptz, error)
	MonthlyCostForApp(ctx context.Context, arg MonthlyCostForAppParams) ([]*MonthlyCostForAppRow, error)
	MonthlyCostForTeam(ctx context.Context, team *string) ([]*MonthlyCostForTeamRow, error)
	// ResourceUtilizationForApp will return resource utilization records for a given app.
	ResourceUtilizationForApp(ctx context.Context, arg ResourceUtilizationForAppParams) ([]*ResourceUtilizationMetric, error)
	// ResourceUtilizationForTeam will return resource utilization records for a given team.
	ResourceUtilizationForTeam(ctx context.Context, arg ResourceUtilizationForTeamParams) ([]*ResourceUtilizationForTeamRow, error)
	// ResourceUtilizationOverageForTeam will return overage records for a given team, ordered by overage descending.
	ResourceUtilizationOverageForTeam(ctx context.Context, arg ResourceUtilizationOverageForTeamParams) ([]*ResourceUtilizationOverageForTeamRow, error)
	// ResourceUtilizationRangeForApp will return the min and max timestamps for a specific app.
	ResourceUtilizationRangeForApp(ctx context.Context, arg ResourceUtilizationRangeForAppParams) (*ResourceUtilizationRangeForAppRow, error)
	// ResourceUtilizationRangeForTeam will return the min and max timestamps for a specific team.
	ResourceUtilizationRangeForTeam(ctx context.Context, team string) (*ResourceUtilizationRangeForTeamRow, error)
	// ResourceUtilizationUpsert will insert or update resource utilization records.
	ResourceUtilizationUpsert(ctx context.Context, arg []ResourceUtilizationUpsertParams) *ResourceUtilizationUpsertBatchResults
	// SpecificResourceUtilizationForApp will return resource utilization for an app at a specific timestamp.
	SpecificResourceUtilizationForApp(ctx context.Context, arg SpecificResourceUtilizationForAppParams) (*SpecificResourceUtilizationForAppRow, error)
	// SpecificResourceUtilizationForTeam will return resource utilization for a team at a specific timestamp. Applications
	// with a usage greater than request will be ignored.
	SpecificResourceUtilizationForTeam(ctx context.Context, arg SpecificResourceUtilizationForTeamParams) (*SpecificResourceUtilizationForTeamRow, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AverageResourceUtilizationForTeam

AverageResourceUtilizationForTeam will return the average resource utilization for a team for a week.

func (*Queries) CostUpsert

func (q *Queries) CostUpsert(ctx context.Context, arg []CostUpsertParams) *CostUpsertBatchResults

CostUpsert will insert or update a cost record. If there is a conflict on the daily_cost_key constrant, the daily_cost column will be updated.

func (*Queries) DailyCostForApp

func (q *Queries) DailyCostForApp(ctx context.Context, arg DailyCostForAppParams) ([]*Cost, error)

DailyCostForApp will fetch the daily cost for a specific team app in a specific environment, across all cost types in a date range.

func (*Queries) DailyCostForTeam

func (q *Queries) DailyCostForTeam(ctx context.Context, arg DailyCostForTeamParams) ([]*Cost, error)

DailyCostForTeam will fetch the daily cost for a specific team across all apps and envs in a date range.

func (*Queries) DailyEnvCostForTeam

func (q *Queries) DailyEnvCostForTeam(ctx context.Context, arg DailyEnvCostForTeamParams) ([]*DailyEnvCostForTeamRow, error)

DailyEnvCostForTeam will fetch the daily cost for a specific team and env across all apps in a date range.

func (*Queries) LastCostDate

func (q *Queries) LastCostDate(ctx context.Context) (pgtype.Date, error)

LastCostDate will return the last date that has a cost.

func (*Queries) MaxResourceUtilizationDate

func (q *Queries) MaxResourceUtilizationDate(ctx context.Context) (pgtype.Timestamptz, error)

MaxResourceUtilizationDate will return the max date for resource utilization records.

func (*Queries) MonthlyCostForApp

func (q *Queries) MonthlyCostForApp(ctx context.Context, arg MonthlyCostForAppParams) ([]*MonthlyCostForAppRow, error)

func (*Queries) MonthlyCostForTeam

func (q *Queries) MonthlyCostForTeam(ctx context.Context, team *string) ([]*MonthlyCostForTeamRow, error)

func (*Queries) ResourceUtilizationForApp

func (q *Queries) ResourceUtilizationForApp(ctx context.Context, arg ResourceUtilizationForAppParams) ([]*ResourceUtilizationMetric, error)

ResourceUtilizationForApp will return resource utilization records for a given app.

func (*Queries) ResourceUtilizationForTeam

func (q *Queries) ResourceUtilizationForTeam(ctx context.Context, arg ResourceUtilizationForTeamParams) ([]*ResourceUtilizationForTeamRow, error)

ResourceUtilizationForTeam will return resource utilization records for a given team.

func (*Queries) ResourceUtilizationOverageForTeam

ResourceUtilizationOverageForTeam will return overage records for a given team, ordered by overage descending.

func (*Queries) ResourceUtilizationRangeForApp

ResourceUtilizationRangeForApp will return the min and max timestamps for a specific app.

func (*Queries) ResourceUtilizationRangeForTeam

func (q *Queries) ResourceUtilizationRangeForTeam(ctx context.Context, team string) (*ResourceUtilizationRangeForTeamRow, error)

ResourceUtilizationRangeForTeam will return the min and max timestamps for a specific team.

func (*Queries) ResourceUtilizationUpsert

ResourceUtilizationUpsert will insert or update resource utilization records.

func (*Queries) SpecificResourceUtilizationForApp

SpecificResourceUtilizationForApp will return resource utilization for an app at a specific timestamp.

func (*Queries) SpecificResourceUtilizationForTeam

SpecificResourceUtilizationForTeam will return resource utilization for a team at a specific timestamp. Applications with a usage greater than request will be ignored.

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type ResourceType

type ResourceType string
const (
	ResourceTypeCpu    ResourceType = "cpu"
	ResourceTypeMemory ResourceType = "memory"
)

func AllResourceTypeValues

func AllResourceTypeValues() []ResourceType

func (*ResourceType) Scan

func (e *ResourceType) Scan(src interface{}) error

func (ResourceType) Valid

func (e ResourceType) Valid() bool

type ResourceUtilizationForAppParams

type ResourceUtilizationForAppParams struct {
	Env          string
	Team         string
	App          string
	ResourceType ResourceType
	Start        pgtype.Timestamptz
	End          pgtype.Timestamptz
}

type ResourceUtilizationForTeamParams

type ResourceUtilizationForTeamParams struct {
	Env          string
	Team         string
	ResourceType ResourceType
	Start        pgtype.Timestamptz
	End          pgtype.Timestamptz
}

type ResourceUtilizationForTeamRow

type ResourceUtilizationForTeamRow struct {
	Usage     float64
	Request   float64
	Timestamp pgtype.Timestamptz
}

type ResourceUtilizationMetric

type ResourceUtilizationMetric struct {
	ID           int32
	Timestamp    pgtype.Timestamptz
	Env          string
	Team         string
	App          string
	ResourceType ResourceType
	Usage        float64
	Request      float64
}

type ResourceUtilizationOverageForTeamParams

type ResourceUtilizationOverageForTeamParams struct {
	Team         string
	Timestamp    pgtype.Timestamptz
	ResourceType ResourceType
}

type ResourceUtilizationOverageForTeamRow

type ResourceUtilizationOverageForTeamRow struct {
	Usage   float64
	Request float64
	App     string
	Env     string
	Overage float64
}

type ResourceUtilizationRangeForAppParams

type ResourceUtilizationRangeForAppParams struct {
	Env  string
	Team string
	App  string
}

type ResourceUtilizationRangeForAppRow

type ResourceUtilizationRangeForAppRow struct {
	From pgtype.Timestamptz
	To   pgtype.Timestamptz
}

type ResourceUtilizationRangeForTeamRow

type ResourceUtilizationRangeForTeamRow struct {
	From pgtype.Timestamptz
	To   pgtype.Timestamptz
}

type ResourceUtilizationUpsertBatchResults

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

func (*ResourceUtilizationUpsertBatchResults) Close

func (*ResourceUtilizationUpsertBatchResults) Exec

type ResourceUtilizationUpsertParams

type ResourceUtilizationUpsertParams struct {
	Timestamp    pgtype.Timestamptz
	Env          string
	Team         string
	App          string
	ResourceType ResourceType
	Usage        float64
	Request      float64
}

type SpecificResourceUtilizationForAppParams

type SpecificResourceUtilizationForAppParams struct {
	Env          string
	Team         string
	App          string
	ResourceType ResourceType
	Timestamp    pgtype.Timestamptz
}

type SpecificResourceUtilizationForAppRow

type SpecificResourceUtilizationForAppRow struct {
	Usage     float64
	Request   float64
	Timestamp pgtype.Timestamptz
}

type SpecificResourceUtilizationForTeamParams

type SpecificResourceUtilizationForTeamParams struct {
	Team         string
	ResourceType ResourceType
	Timestamp    pgtype.Timestamptz
}

type SpecificResourceUtilizationForTeamRow

type SpecificResourceUtilizationForTeamRow struct {
	Usage     float64
	Request   float64
	Timestamp pgtype.Timestamptz
}

Jump to

Keyboard shortcuts

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