Documentation
¶
Overview ¶
Package types defines tenant identifiers, tenant metadata, lifecycle statuses, and host/tenant side markers.
包 types 定义租户标识符、租户元数据、生命周期状态和主控端/租户端标记。
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyTenantID reports an empty tenant identifier. ErrEmptyTenantID = errors.New("saas/types: empty tenant id") // ErrInvalidTenantID reports a tenant identifier that does not match the configured strategy. ErrInvalidTenantID = errors.New("saas/types: invalid tenant id") )
Functions ¶
This section is empty.
Types ¶
type DeploymentUnit ¶ added in v0.3.1
type DeploymentUnit struct {
ID DeploymentUnitID
Status DeploymentUnitStatus
Region string
ResidencyTags []string
Metadata map[string]string
}
DeploymentUnit describes a host-managed logical location where tenant data and traffic may be placed. Infrastructure endpoints and credentials remain host-owned.
type DeploymentUnitID ¶ added in v0.3.1
type DeploymentUnitID string
DeploymentUnitID identifies a host-managed logical deployment unit.
func (DeploymentUnitID) String ¶ added in v0.3.1
func (id DeploymentUnitID) String() string
String returns the string form of the deployment unit identifier.
type DeploymentUnitStatus ¶ added in v0.3.1
type DeploymentUnitStatus string
DeploymentUnitStatus describes whether a deployment unit can accept tenant traffic.
const ( // DeploymentUnitStatusActive accepts tenant traffic and new assignments. DeploymentUnitStatusActive DeploymentUnitStatus = "active" // DeploymentUnitStatusDisabled does not accept tenant traffic or new assignments. DeploymentUnitStatusDisabled DeploymentUnitStatus = "disabled" )
type MultiTenancySide ¶
type MultiTenancySide string
MultiTenancySide identifies whether an operation runs as host infrastructure or inside a tenant boundary.
const ( MultiTenancySideHost MultiTenancySide = "host" MultiTenancySideTenant MultiTenancySide = "tenant" )
type Tenant ¶
type Tenant struct {
ID TenantID
Name string
Status TenantStatus
PlanID string
Config map[string]string
}
Tenant is the shared metadata shape used by the core abstractions.
type TenantID ¶
type TenantID string
TenantID is the default public tenant identifier type.
func NewTenantIDFromInt ¶
NewTenantIDFromInt creates a tenant identifier from an int64 value.
func ParseTenantID ¶
func ParseTenantID(raw string, strategy TenantIDStrategy) (TenantID, error)
ParseTenantID validates raw with the configured strategy and returns a TenantID.
type TenantIDStrategy ¶
type TenantIDStrategy string
TenantIDStrategy describes how incoming tenant identifiers should be validated before they are accepted by resolver and store implementations.
const ( // TenantIDStrategyString accepts any non-empty string. TenantIDStrategyString TenantIDStrategy = "string" // TenantIDStrategyInt accepts base-10 integer identifiers. TenantIDStrategyInt TenantIDStrategy = "int" // TenantIDStrategyUUID accepts canonical UUID strings. TenantIDStrategyUUID TenantIDStrategy = "uuid" )
type TenantStatus ¶
type TenantStatus string
TenantStatus describes the lifecycle state of a tenant.
const ( TenantStatusPending TenantStatus = "pending" TenantStatusActive TenantStatus = "active" TenantStatusSuspended TenantStatus = "suspended" TenantStatusSoftDeleted TenantStatus = "soft_deleted" TenantStatusHardDeleted TenantStatus = "hard_deleted" )