Documentation
¶
Index ¶
- type CreateFeatureInputs
- type Feature
- type FeatureConnector
- type FeatureInvalidFiltersError
- type FeatureInvalidMeterAggregationError
- type FeatureNotFoundError
- type FeatureOrderBy
- type FeatureRepo
- type FeatureWithNameAlreadyExistsError
- type IncludeArchivedFeature
- type ListFeaturesParams
- type MeterGroupByFilters
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 MeterGroupByFilters `json:"meterGroupByFilters,omitempty"` // Metadata Additional metadata. Metadata map[string]string `json:"metadata,omitempty"` // Read-only fields ArchivedAt *time.Time `json:"archivedAt,omitempty"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
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, namespace string, idOrKey string, includeArchived IncludeArchivedFeature) (*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 CreateFeatureInputs) (Feature, error) ArchiveFeature(ctx context.Context, featureID models.NamespacedID) error ListFeatures(ctx context.Context, params ListFeaturesParams) ([]Feature, error) GetByIdOrKey(ctx context.Context, namespace string, idOrKey string, includeArchived bool) (*Feature, error) entutils.TxCreator entutils.TxUser[FeatureRepo] }
type FeatureWithNameAlreadyExistsError ¶
func (*FeatureWithNameAlreadyExistsError) Error ¶
func (e *FeatureWithNameAlreadyExistsError) Error() string
type IncludeArchivedFeature ¶
type IncludeArchivedFeature bool
const ( IncludeArchivedFeatureTrue IncludeArchivedFeature = true IncludeArchivedFeatureFalse IncludeArchivedFeature = false )
type ListFeaturesParams ¶
type MeterGroupByFilters ¶
MeterGroupByFilters is a map of filters that can be applied to a meter when querying the usage for a feature.
Click to show internal directories.
Click to hide internal directories.