Ship en_US, sv_SE, misc, geo/SE and geo/US as Go packages exporting FS, listed by data.Modules(), and fail a bare New naming WithDataFS
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
// 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:
|
||||
// Data lives in JSON, not in Go, and comes in modules: a Go package exporting an fs.FS,
|
||||
// or a folder. A generator loads the modules you name, such as every one fejkdata ships
|
||||
// from the package github.com/larvit/fejkdata/data; folders and files become a dot-path
|
||||
// namespace, then generate values by path:
|
||||
//
|
||||
// f, _ := fejkdata.New(fejkdata.WithSeed(42))
|
||||
// f, _ := fejkdata.New(fejkdata.WithDataFS(data.Modules()...), 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
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user