Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e: fill schema with many namespaces to span ranges
- Loading branch information
Showing
8 changed files
with
243 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package generator | ||
|
||
import "github.com/brianvoe/gofakeit/v6" | ||
|
||
type UniqueGenerator struct { | ||
seen map[string]struct{} | ||
regex string | ||
} | ||
|
||
func NewUniqueGenerator(regex string) *UniqueGenerator { | ||
return &UniqueGenerator{ | ||
seen: make(map[string]struct{}, 0), | ||
regex: regex, | ||
} | ||
} | ||
|
||
func (g *UniqueGenerator) Next() string { | ||
for { | ||
val := gofakeit.Regex(g.regex) | ||
if _, ok := g.seen[val]; !ok { | ||
g.seen[val] = struct{}{} | ||
return val | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.