Documentation
¶
Overview ¶
Package pathctx carries the tenant's Postgres schema on context.Context for schema-per-tenant "consolidation mode": the adapter stamps SET LOCAL search_path from it per transaction, exactly as core/tenant's id is stamped into SET LOCAL app.tenant_id. The value is OPTIONAL — when absent (single/shards/database modes) the adapter stamps nothing new and behaves identically.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustWithSearchPath ¶
MustWithSearchPath is WithSearchPath for wiring code; panics on invalid.
func SchemaForTenant ¶
SchemaForTenant maps a tenant id to its consolidation-mode schema name: "tenant_" + the id with '-' folded to '_' (tenant ids allow '-', which is illegal in a bare Postgres identifier). It fails CLOSED for ids that cannot map to a legal schema — uppercase (Postgres folds unquoted identifiers to lowercase, so "Acme" and "acme" would collide) or too long — rather than silently folding to a colliding name. The mapping is deterministic, so routing derives the schema without a catalog lookup; provisioning persists the same value in Entry.Schema.
func SchemaOrEmpty ¶
SchemaOrEmpty returns the stamped schema, or "" when none is set.
func ValidSchema ¶
ValidSchema reports whether s is a well-formed tenant schema name.
Types ¶
This section is empty.