Documentation
¶
Overview ¶
Package tenant manages tenant lifecycle transitions and host-only destructive operations.
Index ¶
- Variables
- type Auditor
- type CreateInput
- type Event
- type IDGenerator
- type Manager
- func (manager *Manager) Activate(ctx context.Context, id types.TenantID) (types.Tenant, error)
- func (manager *Manager) Create(ctx context.Context, input CreateInput) (types.Tenant, error)
- func (manager *Manager) Delete(ctx context.Context, id types.TenantID) error
- func (manager *Manager) Get(ctx context.Context, id types.TenantID) (types.Tenant, error)
- func (manager *Manager) HardDelete(ctx context.Context, id types.TenantID) error
- func (manager *Manager) Restore(ctx context.Context, id types.TenantID) (types.Tenant, error)
- func (manager *Manager) SoftDelete(ctx context.Context, id types.TenantID) (types.Tenant, error)
- func (manager *Manager) Suspend(ctx context.Context, id types.TenantID) (types.Tenant, error)
- func (manager *Manager) Update(ctx context.Context, input UpdateInput) (types.Tenant, error)
- type Option
- type Seeder
- type Service
- type UpdateInput
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidState reports an invalid tenant lifecycle transition. ErrInvalidState = gotenancy.ErrInvalidState // ErrHostRequired reports that an operation requires host-side context. ErrHostRequired = gotenancy.ErrHostRequired )
Functions ¶
This section is empty.
Types ¶
type CreateInput ¶
CreateInput describes a tenant to create.
type Event ¶
type Event struct {
TenantID types.TenantID
Action string
From types.TenantStatus
To types.TenantStatus
}
Event describes a tenant lifecycle event.
type IDGenerator ¶
IDGenerator creates tenant identifiers when CreateInput omits ID.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager implements tenant lifecycle operations.
func (*Manager) HardDelete ¶
HardDelete physically removes a tenant and requires host context.
func (*Manager) SoftDelete ¶
SoftDelete transitions an Active or Suspended tenant to SoftDeleted.
type Option ¶
type Option func(*Manager)
Option configures Manager.
func WithIDGenerator ¶
func WithIDGenerator(generator IDGenerator) Option
WithIDGenerator sets the ID generator.
type Service ¶
type Service interface {
Create(ctx context.Context, input CreateInput) (types.Tenant, error)
Get(ctx context.Context, id types.TenantID) (types.Tenant, error)
Update(ctx context.Context, input UpdateInput) (types.Tenant, error)
Delete(ctx context.Context, id types.TenantID) error
Activate(ctx context.Context, id types.TenantID) (types.Tenant, error)
Suspend(ctx context.Context, id types.TenantID) (types.Tenant, error)
Restore(ctx context.Context, id types.TenantID) (types.Tenant, error)
SoftDelete(ctx context.Context, id types.TenantID) (types.Tenant, error)
HardDelete(ctx context.Context, id types.TenantID) error
}
Service manages tenant lifecycle operations.
Click to show internal directories.
Click to hide internal directories.