Skip to content

opendsr-std/seedfaker-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

seedfaker-go

Go binding for seedfaker — deterministic synthetic data with 200+ fields, 68 locales, same seed = same output.

CLI · Node.js · Python · Browser/WASM · Go · PHP · Ruby · MCP

Requirements

  • Go >= 1.22
  • libseedfaker_ffi shared library
  • CGO enabled

Install

go get github.com/opendsr-std/seedfaker-go

Pre-built libseedfaker_ffi binaries are included in bin/ for supported platforms.

Pre-1.0 notice: The API may change between minor versions until 1.0.0 is released. Pin your version and check CHANGELOG.md before upgrading.

For development from source:

make build-ffi
cd examples/go
CGO_LDFLAGS="-L../../rust/target/release -lseedfaker_ffi" go run main.go

Usage

package main

import (
    "fmt"
    seedfaker "github.com/opendsr-std/seedfaker-go"
)

func main() {
    f, _ := seedfaker.New(seedfaker.Options{Seed: "ci", Locale: "en"})
    defer f.Close()

    // Single values
    name, _ := f.Field("name")
    phone, _ := f.Field("phone")
    fmt.Println(name, phone)

    // Single correlated record
    rec, _ := f.Record([]string{"name", "email", "phone"}, "strict", "")
    fmt.Println(rec) // map[name:Zoe Kumar email:zoe.kumar@... phone:+1...]

    // Batch
    records, _ := f.Records(seedfaker.RecordOpts{
        Fields: []string{"name", "email"},
        N:      5,
    })
    fmt.Println(records)

    // Validate without generating
    _ = f.Validate([]string{"name", "email:e164"}, "", "")

    // Fingerprint and field list
    fp, _ := seedfaker.Fingerprint()
    fields, _ := seedfaker.Fields()
    fmt.Println(fp, len(fields))
}

Documentation


Disclaimer

This software generates synthetic data that may resemble real-world identifiers, credentials, or personal information. All output is artificial. See LICENSE for the full legal disclaimer.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors