-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use random string instead of incremental suffix, add concurrency…
… testing, adjust transaction isolation level
- Loading branch information
1 parent
8e02d4c
commit 1dc9f60
Showing
9 changed files
with
213 additions
and
71 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
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,31 @@ | ||
package random | ||
|
||
import ( | ||
"crypto/rand" | ||
) | ||
|
||
const ( | ||
// DefaultChars is the default character set used for generating random strings. | ||
DefaultChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | ||
) | ||
|
||
// String generates a random string of length n, using the characters in the charset string | ||
// if provided, or using the default charset if not. | ||
func String(n int, charset ...string) string { | ||
var chars string | ||
if len(charset) == 0 { | ||
chars = DefaultChars | ||
} else { | ||
chars = charset[0] | ||
} | ||
|
||
bytes := make([]byte, n) | ||
_, err := rand.Read(bytes) | ||
if err != nil { | ||
panic(err) | ||
} | ||
for i, b := range bytes { | ||
bytes[i] = chars[b%byte(len(chars))] | ||
} | ||
return string(bytes) | ||
} |
2 changes: 0 additions & 2 deletions
2
master/static/migrations/20240409104254_add-custom-project-key.tx.down.sql
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
master/static/migrations/20240409104254_add-custom-project-key.tx.up.sql
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.