Skip to content

Commit

Permalink
Adjust randomize.go so it works with the new version of satori/go.uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
Matjaz Domen Pecan committed Jan 4, 2018
1 parent 6b95e5d commit e49ac20
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions randomize/randomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ func randomizeField(s *Seed, field reflect.Value, fieldType string, canBeNull bo
return nil
}
if fieldType == "uuid" {
value = null.NewString(uuid.NewV4().String(), true)
randomUuid, err := uuid.NewV4()
if err != nil {
return err
}
value = null.NewString(randomUuid.String(), true)
field.Set(reflect.ValueOf(value))
return nil
}
Expand Down Expand Up @@ -268,7 +272,10 @@ func randomizeField(s *Seed, field reflect.Value, fieldType string, canBeNull bo
return nil
}
if fieldType == "uuid" {
value = uuid.NewV4().String()
value, err := uuid.NewV4()
if err != nil {
return err
}
field.Set(reflect.ValueOf(value))
return nil
}
Expand Down Expand Up @@ -390,7 +397,11 @@ func getArrayRandValue(s *Seed, typ reflect.Type, fieldType string) interface{}
return types.StringArray{value, value}
}
if fieldType == "uuid" {
value := uuid.NewV4().String()
randomUuid, err := uuid.NewV4()
if err != nil {
return err
}
value := randomUuid.String()
return types.StringArray{value, value}
}
if fieldType == "box" || fieldType == "line" || fieldType == "lseg" ||
Expand Down

0 comments on commit e49ac20

Please sign in to comment.