Documentation
¶
Index ¶
- Variables
- type Feature
- type MemoryService
- func (service *MemoryService) Create(ctx context.Context, plan Plan) error
- func (service *MemoryService) Delete(ctx context.Context, id string) error
- func (service *MemoryService) Get(ctx context.Context, id string) (Plan, error)
- func (service *MemoryService) Update(ctx context.Context, plan Plan) error
- type Plan
- type Quota
- type QuotaPeriod
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrPlanNotFound reports that a plan does not exist. ErrPlanNotFound = errors.New("gotenancy/plan: plan not found") // ErrPlanAlreadyExists reports that a plan already exists. ErrPlanAlreadyExists = errors.New("gotenancy/plan: plan already exists") // ErrInvalidPlan reports invalid plan metadata. ErrInvalidPlan = errors.New("gotenancy/plan: invalid plan") )
Functions ¶
This section is empty.
Types ¶
type MemoryService ¶
type MemoryService struct {
// contains filtered or unexported fields
}
MemoryService is a thread-safe in-memory plan service.
func NewMemoryService ¶
func NewMemoryService() *MemoryService
NewMemoryService creates an empty plan service.
func (*MemoryService) Create ¶
func (service *MemoryService) Create(ctx context.Context, plan Plan) error
Create inserts a plan.
func (*MemoryService) Delete ¶
func (service *MemoryService) Delete(ctx context.Context, id string) error
Delete removes a plan.
type Quota ¶
type Quota struct {
Resource string
Limit int64
Period QuotaPeriod
}
Quota describes a plan resource limit.
type QuotaPeriod ¶
type QuotaPeriod string
QuotaPeriod describes the reset period of a quota.
const ( QuotaPeriodNone QuotaPeriod = "none" QuotaPeriodDay QuotaPeriod = "day" QuotaPeriodMonth QuotaPeriod = "month" )
Click to show internal directories.
Click to hide internal directories.