feature

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package feature provides standalone, reusable feature definitions for the Ledger billing engine. Features can be global (AppID="") or scoped to a specific application, and multiple plans can reference the same catalog feature via plan.Feature.CatalogID.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feature

type Feature struct {
	types.Entity
	ID           id.FeatureID      `json:"id"`
	Key          string            `json:"key"`
	Name         string            `json:"name"`
	Description  string            `json:"description"`
	Type         FeatureType       `json:"type"`
	DefaultLimit int64             `json:"default_limit"`
	Period       Period            `json:"period"`
	SoftLimit    bool              `json:"soft_limit"`
	Status       Status            `json:"status"`
	AppID        string            `json:"app_id"`
	ProviderID   string            `json:"provider_id,omitempty"`
	ProviderName string            `json:"provider_name,omitempty"`
	Metadata     map[string]string `json:"metadata,omitempty"`
}

Feature is a standalone, reusable feature definition in the catalog. Features can be global (AppID="") or scoped to a specific app. Multiple plans can reference the same catalog feature via plan.Feature.CatalogID.

type FeatureType

type FeatureType string

FeatureType identifies how the feature is measured and enforced. Values mirror plan.FeatureType to ensure seamless mapping without circular imports (feature must not import plan).

const (
	FeatureMetered FeatureType = "metered"
	FeatureBoolean FeatureType = "boolean"
	FeatureSeat    FeatureType = "seat"
)

type ListOpts

type ListOpts struct {
	Status Status
	Limit  int
	Offset int
}

ListOpts configures feature listing queries.

type Period

type Period string

Period defines the reset interval for usage tracking. Values mirror plan.Period for the same reason as FeatureType.

const (
	PeriodMonthly Period = "monthly"
	PeriodYearly  Period = "yearly"
	PeriodNone    Period = "none"
)

type Status

type Status string

Status represents the lifecycle state of a catalog feature.

const (
	StatusActive   Status = "active"
	StatusArchived Status = "archived"
	StatusDraft    Status = "draft"
)

Jump to

Keyboard shortcuts

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