MCPcopy
hub / github.com/grafana/tempo / randomSQL

Function randomSQL

pkg/drain/testdata/generate-random-span-names/main.go:92–109  ·  view source on GitHub ↗
(r *rand.Rand)

Source from the content-addressed store, hash-verified

90}
91
92func randomSQL(r *rand.Rand) string {
93 keyword := randomSQLKeyword(r)
94
95 switch keyword {
96 case "SELECT":
97 return "SELECT " + randomWordList(r) + " FROM " + randomWord(r)
98 case "INSERT":
99 return "INSERT INTO " + randomWord(r) + " (" + randomWordList(r) + ") VALUES (" + randomWordList(r) + ")"
100 case "UPDATE":
101 return "UPDATE " + randomWord(r) + " SET " + randomWordList(r) + " = " + randomWordList(r) + " WHERE " + randomWordList(r) + " = " + randomWordList(r)
102 case "DELETE":
103 return "DELETE FROM " + randomWord(r) + " WHERE " + randomWordList(r) + " = " + randomWordList(r)
104 case "CREATE":
105 return "CREATE TABLE " + randomWord(r) + " (" + randomWordList(r) + ")"
106 default:
107 return keyword
108 }
109}
110
111func randomAlphanumeric(r *rand.Rand) string {
112 length := r.Intn(10) + 1

Callers 1

generateFeatureFunction · 0.85

Calls 3

randomSQLKeywordFunction · 0.85
randomWordListFunction · 0.85
randomWordFunction · 0.85

Tested by

no test coverage detected