// Package fejkdata generates fake data from recursive JSON templates. // // Data lives in JSON, not in Go. A generator starts from the shipped data set and // layers any directories you add; folders and files become a dot-path namespace, // then generate values by path: // // f, _ := fejkdata.New(fejkdata.WithSeed(42)) // f.Fake("sv_SE.address") // "Räfsalsvägen 43\n442 42 Kungälv" // f.Fake("sv_SE.address.locality") // "Umeå": a second call draws afresh // // Several sources merge in order, the last winning a name clash, so custom data // layers over the built-ins. The JSON template format is documented in the [README]. // // [README]: https://github.com/larvit/fejkdata#readme package fejkdata // Vocabulary // // - draw — one pick from a choice, or one row taken from a table: `pick`, // `resolveChoice`, `table.drawRow`. // - expansion — one render of one format: `expand`. // - render — what owns one `renderDraws`, and so what one reference draw spans: // `Generator.Fake`, `FakeRecord`, `Template.Fake` and `RecordTemplate.Fake` // start one each, `FakeStruct` one per record, and `expandAnew` one per // iteration of a `template.repeat`. // - hold — keeping one draw of a field, so every route to it reads that value: // an expansion holds a sibling path's head and an operand's field, its draw // group a reference path's: `formatOps.held` and `heldCheck` an expansion's, // `readReference` a draw group's. // - named pick — the draw a token such as {/person as p} binds to a name, drawn // on its first read and kept while its scope renders: a category, or one // repeat iteration: `nameBinding`, `nameScope`, `namedPick`, `pickFrame`. // - memo — what a hold, a draw group or a named pick keeps its draws in, the // variant drawn at each level and the value each path read: `drawMemo`, // `readMemo`. // - draw group — reference draws kept apart inside one render: // `template.drawGroup` as the data spells it, `templateLink.drawGroupKey` as a // render reads it, `renderDraws`, `groupDraws`, `renderScope`. // - pin — fixing which row of a table the render uses, which the fences replay: // `pinSet`, `pinSet.pin`, `table.drawIn`. // - family — a table and every table reaching it through a chain of // `table.parentT`, named by the root that chain ends at: `table.familyRoot`. // - whole — a read of a table with no selector and no descent, {/city}, landing on // the `table` itself, so it draws a row apart from every pin: `branches.wholePins`. // - fence — a load-time check, run over each category, template or struct as it // loads or compiles, so rendering a compiled tree cannot fail.