Skip to content

Instantly share code, notes, and snippets.

@bxcodec
Last active June 22, 2017 16:37
Show Gist options
  • Save bxcodec/e269ccc44424e977e6c1e82621b8a618 to your computer and use it in GitHub Desktop.
Save bxcodec/e269ccc44424e977e6c1e82621b8a618 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"github.com/bxcodec/faker"
)
type SomeStruct struct {
Int int
Int8 int8
Int16 int16
Int32 int32
Int64 int64
String string
Bool bool
SString []string
SInt []int
SInt8 []int8
SInt16 []int16
SInt32 []int32
SInt64 []int64
SFloat32 []float32
SFloat64 []float64
SBool []bool
Struct AStruct
Time time.Time
Stime []time.Time
}
type AStruct struct {
Number int64
Height int64
AnotherStruct BStruct
}
type BStruct struct {
Image string
}
func main() {
a= SomeStruct{}
err:= faker.FakeData(&a)
if err!= nil {
fmt.Println(err)
}
fmt.Printf("%+v", a)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment