Skip to content
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

Gen fake data #173

Merged
merged 2 commits into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
require (
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/brianvoe/gofakeit/v6 v6.23.1 // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/brianvoe/gofakeit/v6 v6.23.1 h1:k2gX0hQpJStvixDbbw8oJOvPBg0XmHJWbSOF5JkiUHw=
github.com/brianvoe/gofakeit/v6 v6.23.1/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
Expand Down
96 changes: 96 additions & 0 deletions internal/fakeit/fakeit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package main

import (
"math/rand"

"github.com/apple/foundationdb/bindings/go/src/fdb"
"github.com/apple/foundationdb/bindings/go/src/fdb/directory"
"github.com/brianvoe/gofakeit/v6"

"github.com/janderland/fdbq/engine"
"github.com/janderland/fdbq/engine/facade"
kv "github.com/janderland/fdbq/keyval"
)

func main() {
fdb.MustAPIVersion(620)
eg := engine.New(facade.NewTransactor(fdb.MustOpenDefault(), directory.Root()))

for i := 0; i < 3; i++ {
query := kv.KeyValue{
Key: kv.Key{
Directory: kv.Directory{kv.String("user")},
Tuple: kv.Tuple{
kv.Int(rand.Int63()),
kv.String("Goodwin"),
kv.String(gofakeit.FirstName()),
},
},
Value: kv.Nil{},
}
if err := eg.Set(query); err != nil {
panic(err)
}
}

for i := 0; i < 320; i++ {
query := kv.KeyValue{
Key: kv.Key{
Directory: kv.Directory{kv.String("user")},
Tuple: kv.Tuple{
kv.Int(rand.Int63()),
kv.String(gofakeit.LastName()),
kv.String(gofakeit.FirstName()),
},
},
Value: kv.Nil{},
}
if err := eg.Set(query); err != nil {
panic(err)
}
}

for i := 0; i < 10; i++ {
query := kv.KeyValue{
Key: kv.Key{
Directory: kv.Directory{kv.String("status"), kv.String("service")},
Tuple: kv.Tuple{kv.Int(rand.Int63())},
},
Value: func() kv.Value {
switch rand.Int() % 3 {
case 0:
return kv.String("healthy")
case 1:
return kv.String("warning")
default:
return kv.String("failed")
}
}(),
}
if err := eg.Set(query); err != nil {
panic(err)
}
}

for i := 0; i < 10; i++ {
query := kv.KeyValue{
Key: kv.Key{
Directory: kv.Directory{kv.String("status"), kv.String("queue")},
Tuple: kv.Tuple{kv.Int(rand.Int63())},
},
Value: func() kv.Value {
switch rand.Int() % 3 {
case 0:
return kv.String("healthy")
case 1:
return kv.String("overflow")
default:
return kv.String("empty")
}
}(),
}
if err := eg.Set(query); err != nil {
panic(err)
}
}
}
Binary file modified vhs/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions vhs/demo.tape
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
Set TypingSpeed 200ms
Set FontSize 16
Set FontSize 14
Set Height 600
Set Width 800

Type "./fdbq"
Enter

Sleep 2s

Type "i"
Type "/<>"
Type "/user{...}"

Sleep 1s
Enter

Sleep 2s
Backspace 4
Type '<>,"Goodwin",...}'

Sleep 1s
Enter
Expand Down