Skip to content

Update randomize.go #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions randomize/randomize.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ func randomizeField(s *Seed, field reflect.Value, fieldType string, canBeNull bo
return nil
}
if fieldType == "uuid" {
randomUuid, err := uuid.NewV4()
if err != nil {
return err
}
randomUuid := uuid.NewV4()
value = null.NewString(randomUuid.String(), true)
field.Set(reflect.ValueOf(value))
return nil
Expand Down Expand Up @@ -272,10 +269,7 @@ func randomizeField(s *Seed, field reflect.Value, fieldType string, canBeNull bo
return nil
}
if fieldType == "uuid" {
value, err := uuid.NewV4()
if err != nil {
return err
}
value := uuid.NewV4()
field.Set(reflect.ValueOf(value.String()))
return nil
}
Expand Down Expand Up @@ -397,10 +391,7 @@ func getArrayRandValue(s *Seed, typ reflect.Type, fieldType string) interface{}
return types.StringArray{value, value}
}
if fieldType == "uuid" {
randomUuid, err := uuid.NewV4()
if err != nil {
return err
}
randomUuid := uuid.NewV4()
value := randomUuid.String()
return types.StringArray{value, value}
}
Expand Down