Skip to content

Commit

Permalink
demo data updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr committed Mar 4, 2025
1 parent e04882b commit 8af2740
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modes/demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ func GenerateRandomData(jsonFormat bool, numPerSec int, ch chan models.Message,
}

func generateTextRandomData() string {
b := gofakeit.Bool()
bs := "false"
if b {
bs = "true"
}
return strings.Join([]string{
time.Now().Format("15:04:05.0000"),
strconv.Itoa(int(time.Now().UnixMilli())),
Expand All @@ -90,11 +95,12 @@ func generateTextRandomData() string {
gofakeit.UserAgent(),
gofakeit.HTTPMethod(),
utils.PickRandom[string](correlationIds),
bs,
}, " | ")
}

func generateJsonRandomData() string {
val, _ := json.Marshal(map[string]string{
val, _ := json.Marshal(map[string]interface{}{
"ts": time.Now().Format("15:04:05.0000"),
"unix": strconv.Itoa(int(time.Now().UnixMilli())),
"duration": strconv.Itoa(rand.Intn(500-300) + 300),
Expand All @@ -106,6 +112,7 @@ func generateJsonRandomData() string {
"ua": gofakeit.UserAgent(),
"method": gofakeit.HTTPMethod(),
"correlation_id": utils.PickRandom[string](correlationIds),
"active": gofakeit.Bool(),
})

return string(val)
Expand Down

0 comments on commit 8af2740

Please sign in to comment.