scope

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderTenantID = "X-Tenant-ID"
	QueryTenantID  = "tenant_id"
	HeaderOrgID    = "X-Organization-ID"
	QueryOrgID     = "org_id"
)

Variables

This section is empty.

Functions

func ID

func ID(ctx context.Context) string

ID returns the scope id stored in ctx.

func WithContext

func WithContext(ctx context.Context, level Scope, id string) context.Context

WithContext stores the scope level and id in ctx and returns the new context. If level is non-global and id is empty, ctx is returned unchanged.

Types

type Scope

type Scope int

Scope represents the tenancy level of a request.

const (
	GlobalScope Scope = iota
	OrgScope
	TenantScope
)

func Level

func Level(ctx context.Context) Scope

Level returns the scope level stored in ctx, defaulting to GlobalScope.

Jump to

Keyboard shortcuts

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