20#ifndef ORES_DATABASE_SERVICE_TENANT_CONTEXT_HPP
21#define ORES_DATABASE_SERVICE_TENANT_CONTEXT_HPP
24#include "ores.database/domain/context.hpp"
25#include "ores.utility/uuid/tenant_id.hpp"
46 "ffffffff-ffff-ffff-ffff-ffffffffffff";
65 const std::string& tenant);
87 const std::string& code);
98 const std::string& hostname);
120 static bool is_uuid(
const std::string& str);
Database service layer.
Definition ores.database.service.hpp:28
Context for the operations on a postgres database.
Definition context.hpp:47
Manages tenant context for multi-tenant database operations.
Definition tenant_context.hpp:37
static context with_tenant(const context &ctx, const std::string &tenant)
Creates a new context with the specified tenant.
Definition tenant_context.cpp:173
static utility::uuid::tenant_id lookup_by_hostname(const context &ctx, const std::string &hostname)
Looks up a tenant ID by its hostname.
Definition tenant_context.cpp:74
static constexpr const char * system_tenant_id
The UUID of the system tenant (max UUID per RFC 9562).
Definition tenant_context.hpp:45
static bool is_uuid(const std::string &str)
Checks if a string is a valid UUID format.
Definition tenant_context.cpp:41
static utility::uuid::tenant_id lookup_by_code(const context &ctx, const std::string &code)
Looks up a tenant ID by its code.
Definition tenant_context.cpp:48
static context with_system_tenant(const context &ctx)
Creates a new context with the system tenant.
Definition tenant_context.cpp:190
static std::string lookup_name(const context &ctx, const utility::uuid::tenant_id &tenant_id)
Looks up a tenant name by its ID.
Definition tenant_context.cpp:100
A strongly-typed wrapper around a UUID representing a tenant identifier.
Definition tenant_id.hpp:66