Skip to content

infra-utils

Compile typed resource parameters into validated JSONB specifications.

infra-utils · Compile typed resource parameters into validated JSONB specifications.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102164infra-utilsinfra-utils0.47.0UTILMITPLpgSQL
Relationships
Requiresplpgsql pgpm-verify errors db-utils

Usage

Sources:

infra-utils compiles infrastructure resource parameters inside PostgreSQL. infra_utils.compile_resource_spec accepts a base specification, parameter declarations, supplied values and a member name. infra_utils.quantity_to_numeric converts supported decimal and binary quantity suffixes.

Core Workflow

CREATE EXTENSION "infra-utils";
SELECT infra_utils.quantity_to_numeric('4Gi');
SELECT infra_utils.compile_resource_spec(
  '{}'::jsonb,
  '[{"key":"replicas","type":"int","min":1,"max":10,"bindings":[{"path":"replicas"}]}]'::jsonb,
  '{"replicas":2}'::jsonb,
  'web'
);

Operational Boundaries

Declarations constrain parameter types, bounds and explicit output paths. infra_utils.validate_params_schema and infra_utils.validate_bundle_params check definitions and bundle inputs. Unknown declared-member parameters raise errors. If no member declares a parameter interface, the compilation path instead merges supplied JSONB; do not treat that mode as an allowlist. Application admission helpers additionally query provisioned infrastructure schemas. Invalid or unsupported quantity strings return NULL. Dependencies are plpgsql, pgpm-verify, errors, db-utils. This SQL-only module needs no library preload or restart; no PostgreSQL-major support matrix is published for this revision. Its fixed schema layout is not relocatable. Install the matching dependency closure before enabling it.

Table reader