Documentation
¶
Index ¶
- func FormatSize(sel object.Selector[object.Refrence], field string) error
- func Global(container string, wrapped transform.Transformer[object.Refrence]) transform.Transformer[object.Refrence]
- func IndexById(ct transform.Context[object.Refrence], group, name, id string) error
- func ParseSize(sel object.Selector[object.Refrence], field string) error
- func RenameById(sel object.Selector[object.Refrence], name string) (string, error)
- func RenameByName(sel object.Selector[object.Refrence]) (string, error)
- func ResolveNameToId(ct transform.Context[object.Refrence], group, name string) (string, error)
- func ResolveNamesToId(ct transform.Context[object.Refrence], group string, names []string) ([]string, error)
- func Sub(wrapped transform.Transformer[object.Refrence], child string) transform.Transformer[object.Refrence]
- func ValidateMinMax(sel object.Selector[object.Refrence], minKey, maxKey string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSize ¶
FormatSize converts bytes (int64) back to a human-readable size string. If the field doesn't exist or is nil, the function returns nil (no error). Returns an error if the field exists but is not an int64 or cannot be formatted.
func Global ¶
func Global(container string, wrapped transform.Transformer[object.Refrence]) transform.Transformer[object.Refrence]
Global wraps a transformer so it runs at the project scope and then at each instance of the nested container group (the per-app scope). container is the container group's config key, derived from the schema by the caller — an empty key means the schema has no container, so only the project scope is walked.
func ParseSize ¶
ParseSize parses a size string from the specified field and sets it as bytes (int64). If the field doesn't exist or is nil, the function returns nil (no error). Returns an error if the field exists but is not a string or cannot be parsed.
func RenameById ¶
RenameById extracts the "id" field, sets "name" to the provided name, deletes the "id" field, and renames the selector to use the id value. Returns an error if the id field doesn't exist or is not a string.
func RenameByName ¶
RenameByName reverses RenameById - swaps ID/name back. Extracts the "name" field, sets "id" to the current key, deletes the "name" field, and renames the selector to use the name value. Returns the original name and an error if the name field doesn't exist or is not a string.
func ResolveNameToId ¶
ResolveNameToId resolves a referenced name to its compiled id, honoring optional scope qualifiers on the name. The scoping is generic (every Ref benefits) and filesystem-like — a name is never a bare "/" or ".." (names are variable-names), so the qualifiers can't collide:
- "name" current scope, then fall back to ancestors up to root (default)
- "/name" the root/global scope only (absolute)
- "../name" the parent scope, exact (repeatable: "../../name")
The default arm is byte-for-byte the previous behavior, so existing configs (and the parity oracle) are unaffected; the qualifiers are pure additions.
func ResolveNamesToId ¶
func Sub ¶
func Sub(wrapped transform.Transformer[object.Refrence], child string) transform.Transformer[object.Refrence]
func ValidateMinMax ¶
ValidateMinMax checks that the value at maxKey is >= the value at minKey. If either key is missing or not an int, no error is returned (validation is skipped). Returns an error if both values are present and max < min.
Types ¶
This section is empty.