Documentation
¶
Overview ¶
Package paramread is the ONE way built-in code reads an operator's `params` object: every runtime decode of a slot's Params blob (or a lookup into an overlay's params map) goes through Decode / DecodeOptional / Get / Read, naming the operator it reads for.
Production behaviour is exactly encoding/json's: Decode is json.Unmarshal. The package exists so the keys an operator READS are observable: while a Recording is active, every call records (category, operator, key) — a struct target contributes every top-level json key it can decode (all of them, whether the blob set them or not), a map lookup the key it looked up. The declared-vs-read gate (TestParamsDeclaredMatchRead, root package) runs the example library under a Recording and holds every recorded key to the operator's manifest Param list, the allowlist strict params decode enforces (internal/descriptor ParamsRefusal) — so a manifest list cannot fall behind what the runtime reads and cause a false refusal. TestParamsReadThroughParamread bans a direct json decode of a slot's `.Params` anywhere else.
Leaf package: stdlib only.
Index ¶
- func Declare(cat Category, op string, v any)
- func Decode(cat Category, op string, raw []byte, v any) error
- func DecodeOptional(cat Category, op string, raw []byte, v any) error
- func DecodeStrict(cat Category, op string, raw []byte, v any) error
- func Get[V any](cat Category, op string, m map[string]V, key string) (V, bool)
- func Probe(raw []byte, v any) error
- func Read(cat Category, op string, keys ...string)
- type Category
- type Key
- type Recording
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Declare ¶
Declare records every top-level key the decode target v (a pointer to a struct) accepts, without decoding — for a site that decodes the blob elsewhere or only conditionally.
func DecodeOptional ¶
DecodeOptional is Decode skipped when raw is empty (an absent params object): v keeps its defaults. The keys are recorded either way.
func DecodeStrict ¶
DecodeStrict is Decode refusing an unknown key (encoding/json's DisallowUnknownFields), for a reader that already judged its own keys before the manifest allowlist did.
Types ¶
type Category ¶
type Category string
Category names an operator family, spelled as the manifest's Operator.Category (and "test" / "matrix" / "overlay" for the non-Operator catalogs).
const ( Aggregator Category = "aggregator" Attribute Category = "attribute" Filterer Category = "filterer" Grouper Category = "grouper" Window Category = "window" Feature Category = "feature" Test Category = "test" PostTest Category = "post_test" Matrix Category = "matrix" Overlay Category = "overlay" )
The operator families whose slots carry a params object.
type Recording ¶
type Recording struct {
// contains filtered or unexported fields
}
Recording collects the keys read while it is active.