Help us shape the future of Go! Take the 2026 Go Developer Survey

tenant

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package tenant carries the request-scoped tenant (organization) identity in a context.Context. It is generic multi-tenancy plumbing with no ORM or domain dependency: a transport interceptor stamps the resolved tenant once per request, and downstream data-access layers read it to scope every operation to that tenant and fail closed when it is absent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TenantFromContext

func TenantFromContext(ctx context.Context) (uuid.UUID, bool)

TenantFromContext extracts the tenant (organization) id from context. The bool is false (and the uuid is uuid.Nil) when the context is nil or no tenant is set — the signal data-access layers use to fail closed.

func WithTenant

func WithTenant(ctx context.Context, tenant uuid.UUID) context.Context

WithTenant returns a context carrying the tenant (organization) id.

Example:

ctx := tenant.WithTenant(ctx, orgID)

Types

This section is empty.

Jump to

Keyboard shortcuts

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