hardikmodha / datafiller

A Golang package for filling structs by random data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

datafiller

Build Status GoDoc

A Golang package for filling structs by random data.

Installation

go get github.com/erggo/datafiller

Sample Usage

package main

import (
	"encoding/json"
	"fmt"
	"github.com/erggo/datafiller"
)

type S struct {
	A string
	B struct {
		C string
		D string
		E int
	}
}

func main() {
	i := S{}
	datafiller.Fill(&i)
	b, err := json.Marshal(i)
	if err != nil {
		return
	}
	fmt.Println(string(b))
}

TODO

  • simple types
  • structs
  • slices
  • packages
  • simple tagged structs
  • maps
  • smart tagged struct generation
  • guessing names by names
  • add documentation
  • functions
  • all types
  • add options for filling such as slice length

About

A Golang package for filling structs by random data.

License:MIT License


Languages

Language:Go 100.0%