Documentation
¶
Index ¶
- func AssertGrantsEqual(t *testing.T, expected, actual credit.Grant)
- func CreateFeature(t *testing.T, connector credit.Connector, feature credit.Feature) credit.Feature
- func RemoveTimestampsFromBalance(balance credit.Balance) credit.Balance
- func RemoveTimestampsFromFeatureBalances(featureBalances []credit.FeatureBalance) []credit.FeatureBalance
- func RemoveTimestampsFromGrant(g credit.Grant) credit.Grant
- func RemoveTimestampsFromGrantBalances(grantBalances []credit.GrantBalance) []credit.GrantBalance
- func RemoveTimestampsFromGrants(gs []credit.Grant) []credit.Grant
- type MockStreamingConnector
- func (m *MockStreamingConnector) AddRow(meterSlug string, row models.MeterQueryRow)
- func (m *MockStreamingConnector) AddSimpleEvent(meterSlug string, value float64, at time.Time)
- func (m *MockStreamingConnector) CreateMeter(ctx context.Context, namespace string, meter *models.Meter) error
- func (m *MockStreamingConnector) DeleteMeter(ctx context.Context, namespace string, meterSlug string) error
- func (m *MockStreamingConnector) ListEvents(ctx context.Context, namespace string, params streaming.ListEventsParams) ([]api.IngestedEvent, error)
- func (m *MockStreamingConnector) ListMeterSubjects(ctx context.Context, namespace string, meterSlug string, from *time.Time, ...) ([]string, error)
- func (m *MockStreamingConnector) QueryMeter(ctx context.Context, namespace string, meterSlug string, ...) ([]models.MeterQueryRow, error)
- func (m *MockStreamingConnector) SetSimpleEvents(meterSlug string, fn func(events []SimpleEvent) []SimpleEvent)
- type MockStreamingConnectorParams
- type SimpleEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateFeature ¶
func RemoveTimestampsFromFeatureBalances ¶
func RemoveTimestampsFromFeatureBalances(featureBalances []credit.FeatureBalance) []credit.FeatureBalance
func RemoveTimestampsFromGrantBalances ¶
func RemoveTimestampsFromGrantBalances(grantBalances []credit.GrantBalance) []credit.GrantBalance
Types ¶
type MockStreamingConnector ¶
type MockStreamingConnector struct {
// contains filtered or unexported fields
}
func NewMockStreamingConnector ¶
func NewMockStreamingConnector(t testing.TB, params MockStreamingConnectorParams) *MockStreamingConnector
func (*MockStreamingConnector) AddRow ¶
func (m *MockStreamingConnector) AddRow(meterSlug string, row models.MeterQueryRow)
func (*MockStreamingConnector) AddSimpleEvent ¶
func (m *MockStreamingConnector) AddSimpleEvent(meterSlug string, value float64, at time.Time)
func (*MockStreamingConnector) CreateMeter ¶
func (*MockStreamingConnector) DeleteMeter ¶
func (*MockStreamingConnector) ListEvents ¶
func (m *MockStreamingConnector) ListEvents(ctx context.Context, namespace string, params streaming.ListEventsParams) ([]api.IngestedEvent, error)
func (*MockStreamingConnector) ListMeterSubjects ¶
func (*MockStreamingConnector) QueryMeter ¶
func (m *MockStreamingConnector) QueryMeter(ctx context.Context, namespace string, meterSlug string, params *streaming.QueryParams) ([]models.MeterQueryRow, error)
Returns the result query set for the given params. If the query set is not found, it will try to approximate the result by aggregating the simple events
func (*MockStreamingConnector) SetSimpleEvents ¶
func (m *MockStreamingConnector) SetSimpleEvents(meterSlug string, fn func(events []SimpleEvent) []SimpleEvent)
Click to show internal directories.
Click to hide internal directories.