tenant

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package tenant defines the tenant identifier: the token that selects a settings folder, and with it the tables, policies, and pipes a request or an event belongs to (#583). It imports nothing from the rest of the repository, so every package can name a tenant without a cycle.

Index

Constants

View Source
const (
	// Default is the reserved tenant every request without a tenant header
	// resolves to, and the only tenant of a flat settings directory.
	Default ID = "0"

	// Header carries the tenant id on a request. Absent means Default.
	Header = "X-Tenant-ID"

	// MaxLen caps an id's length in bytes.
	MaxLen = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID string

ID is a validated tenant identifier. It is a string, never a number: ids issued upstream can be 19 digits long, which already round as a float64.

func Parse

func Parse(s string) (ID, error)

Parse validates s against the one grammar an id must satisfy to be safe both as a folder name and as a message-queue subject token: ASCII letters, digits, '_' and '-', at most MaxLen bytes. Dots, slashes, spaces, and wildcards are rejected because each means something to one of the two.

func (ID) String

func (id ID) String() string

Jump to

Keyboard shortcuts

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