Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateFeatureInputs ¶
type Feature ¶
type Feature struct {
Namespace string `json:"-"`
ID string `json:"id,omitempty"`
// Name The name of the feature.
Name string `json:"name"`
// Key The unique key of the feature.
Key string `json:"key"`
// MeterSlug The meter that the feature is associated with and decreases grants by usage.
MeterSlug string `json:"meterSlug,omitempty"`
// MeterGroupByFilters Optional meter group by filters. Useful if the meter scope is broader than what feature tracks.
MeterGroupByFilters *map[string]string `json:"meterGroupByFilters,omitempty"`
// Read-only fields
ArchivedAt *time.Time `json:"archivedAt,omitempty"`
CreatedAt time.Time `json:"createdAt,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
}
Feature is a feature or service offered to a customer. For example: CPU-Hours, Tokens, API Calls, etc.
type FeatureConnector ¶
type FeatureConnector interface {
// Feature Management
CreateFeature(ctx context.Context, feature CreateFeatureInputs) (Feature, error)
// Should just use deletedAt, there's no real "archiving"
ArchiveFeature(ctx context.Context, featureID models.NamespacedID) error
ListFeatures(ctx context.Context, params ListFeaturesParams) ([]Feature, error)
GetFeature(ctx context.Context, featureID models.NamespacedID) (Feature, error)
}
func NewFeatureConnector ¶
func NewFeatureConnector( featureRepo FeatureRepo, meterRepo meter.Repository, ) FeatureConnector
type FeatureInvalidFiltersError ¶
type FeatureInvalidFiltersError struct {
RequestedFilters map[string]string
MeterGroupByColumns []string
}
func (*FeatureInvalidFiltersError) Error ¶
func (e *FeatureInvalidFiltersError) Error() string
type FeatureInvalidMeterAggregationError ¶
type FeatureInvalidMeterAggregationError struct {
MeterSlug string
Aggregation models.MeterAggregation
ValidAggregations []models.MeterAggregation
}
func (*FeatureInvalidMeterAggregationError) Error ¶
func (e *FeatureInvalidMeterAggregationError) Error() string
type FeatureNotFoundError ¶
type FeatureNotFoundError struct {
ID string
}
func (*FeatureNotFoundError) Error ¶
func (e *FeatureNotFoundError) Error() string
type FeatureOrderBy ¶
type FeatureOrderBy string
const ( FeatureOrderByCreatedAt FeatureOrderBy = "created_at" FeatureOrderByUpdatedAt FeatureOrderBy = "updated_at" )
type FeatureRepo ¶
type FeatureRepo interface {
CreateFeature(ctx context.Context, feature FeatureRepoCreateFeatureInputs) (Feature, error)
ArchiveFeature(ctx context.Context, featureID models.NamespacedID) error
ListFeatures(ctx context.Context, params ListFeaturesParams) ([]Feature, error)
FindByKey(ctx context.Context, namespace string, key string, includeArchived bool) (*Feature, error)
GetByID(ctx context.Context, featureID models.NamespacedID) (Feature, error)
entutils.TxCreator
entutils.TxUser[FeatureRepo]
}
type FeatureWithNameAlreadyExistsError ¶
func (*FeatureWithNameAlreadyExistsError) Error ¶
func (e *FeatureWithNameAlreadyExistsError) Error() string
type ListFeaturesParams ¶
type ListFeaturesParams struct {
Namespace string
IncludeArchived bool
Offset int
Limit int
OrderBy FeatureOrderBy
}
Click to show internal directories.
Click to hide internal directories.