Repository navigation
Releases: larvit/fejkdata
Releases · larvit/fejkdata
Release list
v0.1.2
v0.1.1
Security
- The binaries and image are built with Go 1.27.2.
- The binaries no longer carry Go 1.27.1's known vulnerabilities: GO-2026-6599 (CVE-2026-94448), GO-2026-6600 (CVE-2026-97030), GO-2026-6603 (CVE-2026-78659), GO-2026-6604 (CVE-2026-56857), GO-2026-6605 (CVE-2026-56866), GO-2026-6607 (CVE-2026-97031), GO-2026-6608 (CVE-2026-94440), GO-2026-6609 (CVE-2026-78667), GO-2026-6610 (CVE-2026-78660), GO-2026-6611 (CVE-2026-78669), GO-2026-6612 (CVE-2026-78663), GO-2026-6613 (CVE-2026-94439), GO-2026-6617 (CVE-2026-97032).
v0.1.0
The first release: a Go library and a CLI that render locale-aware fake data from JSON
templates, and the data they ship with. The
README documents each part.
Install the CLI with go install github.com/larvit/fejkdata/cmd/fejkdata@v0.1.0, or the
library with go get github.com/larvit/fejkdata@v0.1.0. Before 1.0.0 a minor may break,
and any release may change what a seed draws, so pin one exact version
(Versioning).
Added
- The CLI,
fejkdata, renders exactly the template on its stdin and adds nothing:
echo '{/sv_SE.person} hihi' | fejkdataprints e.g.Sara Eriksson hihi.--seed
repeats a run's output while the version and data stay the same, and without it each
run takes a new seed;-nrenders the template that many times, and--list
prints the paths the data offers.
--data-pathlayers a directory of your own data over the shipped set, and
--no-shipped-dataloads that directory alone.--format json|ndjson|csv|sqlwrites
a record's columns, one record per row. The CLI exits0on success,1on a runtime
error such as data that fails to load, and2on misuse. - The library,
github.com/larvit/fejkdata, for Go 1.22 or later on a 64-bit target.
Newloads the modulesWithDataFSnames and the foldersWithDataPathnames, drawing
from the seedWithSeedgives. Without a seed,Newfails and namesWithSeed;
without data, it fails and namesWithDataFS. The same seed repeats the draws
while the version and data stay the same.Fakerenders a path, andFakeTemplate
andNewTemplaterender a template.FakeRecord,FakeRecordTemplateand
NewRecordTemplaterender a record, whoseJSON,CSVHeader,CSVLineand
SQLInsertmethods write its columns as the CLI does.FakeStructfills a struct's
fake:"…"tagged fields.Listgives the pathsFakerenders, direct descents only,
andIsTemplatetells an inline template from a path. Data that fails to load gives
an error matchingErrLoad, and a record with no fields gives one matching
ErrNoColumns. - Package
github.com/larvit/fejkdata/cliis thefejkdatacommand:
cli.Main(modules...)runs it over the modules given, so
cli.Main(append(data.Modules(), mydata)...)builds a CLI carrying your own data.
That CLI names itself by the file it runs from, and its--versionprints its own
module's version before fejkdata's. - The template language
(Data format).
Every value in a data file is a string, a choice, a template, a table, a number or a
boolean. A{…}token reads a sibling field, a name, or a reference from the data
root, the file's folder or the folder above ({/sv_SE.person.last},{.x},{..x}),
or it calls a builtin. Every{…}draws afresh, and a name is the one way to keep a
pick:{/sv_SE.person as p}{p.first} {p.last}is one person. The builtins draw check
digits (luhn,mod11,ean), samples (digits,int,float,uuid,ulid,
iban,date,timeand more), a counter (seq), arithmetic (calc) and
transforms (lowercase,uppercase,ascii).Newrefuses data that breaks the
grammar, could mean two things or cannot render a valid value. - Records (Records):
a template seen as columns. A column is a string unless it declares adatatype,
integer,numberorboolean, and anullitem draws it as null. - Tables (Table): a
category naming arowsTSV beside it, with the optionskey,name,weightand
parent. A path selects a row by key or name,misc.territory[SE], descends to a
linked table,geo.SE.locality[Lund].street, and steps up to the parent row,
{/misc.timezone[Europe/Oslo]..territory.name}. - Data sources (Data):
a directory is a namespace, and each JSON file in it a category. A.fejkdata.json
manifest at a source's root may carry anamespace, the dot path the source mounts
under, and anindex, with which each category loads on the first call reaching it. - The shipped data, in Go packages that each export
FSandModules():
github.com/larvit/fejkdata/data/en_US(packageenus),…/sv_SE(svse),
…/misc,…/geo/SE(geose) and…/geo/US(geous).data.Modules(), from
github.com/larvit/fejkdata/data, lists every one, and the CLI carries them all.
DATA-LICENSES.md
names each source.sv_SEanden_US: anaddress, apersonand more per locale.sex,
first-nameandlast-nameare tables weighted by bearers, from SCB, the SSA and
the Census Bureau. A person's first name and sex agree, and so does anen_US
person's title;person.prefixis null where a person has no title.
sv_SE.personnummerandsv_SE.samordningsnummerdraw Skatteverket's test series.
en_US.ssnanden_US.itindraw the ranges the SSA and the IRS assign, with the
columnsarea,groupandserial, anden_US.phonedraws an exchange NANPA may
assign.misc: IANA's registries of HTTP methods, protocols, ports and root-zone TLDs, the
HTTP status codes, ISO 3166-1 territories, ISO 4217 currencies with their CLDR
symbols, ISO 639 languages, the syslog severities, mime-db's media types, tzdb's
zones weighted by the people living in each, user agents and cars, all as tables;
and coordinates, credit card numbers, RFC 3339 instants, emoji, MAC addresses,
ObjectIds and UUIDs.geo.SEandgeo.US: five linked tables per country,region,municipality,
locality,postal-codeandstreet, weighted by population and address counts
and built from SCB, GeoNames, Trafikverket NVDB, the US Census Bureau and Wikidata,
and anaddressrecord that draws a street and a postal code inside one
locality;sv_SE.addressanden_US.addressprint it. Every Swedish postort
(postal town) the import can place ships with all its streets. A US place ships
only if it is incorporated and holds most of some postal code's land. Of those
places, every state capital but Honolulu ships, as does every place of 100,000
people or more and a tenth of all of them drawn by population. Each US place
carries a quarter of its streets, at least ten.