refactor entire backend

This commit is contained in:
Abhinav Raut
2024-07-25 02:03:56 +05:30
parent 8b763fb167
commit 7ac9a2fe67
41 changed files with 800 additions and 752 deletions
+6 -9
View File
@@ -1,3 +1,4 @@
// Package stringutil provides string utility functions.
package stringutil
import (
@@ -6,11 +7,9 @@ import (
// RandomAlNumString generates a random alphanumeric string of length n.
func RandomAlNumString(n int) (string, error) {
const (
dictionary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
)
const dictionary = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
var bytes = make([]byte, n)
bytes := make([]byte, n)
if _, err := rand.Read(bytes); err != nil {
return "", err
@@ -23,13 +22,11 @@ func RandomAlNumString(n int) (string, error) {
return string(bytes), nil
}
// RandomNumericString generates a random digit numeric string of length n.
// RandomNumericString generates a random numeric string of length n.
func RandomNumericString(n int) (string, error) {
const (
dictionary = "0123456789"
)
const dictionary = "0123456789"
var bytes = make([]byte, n)
bytes := make([]byte, n)
if _, err := rand.Read(bytes); err != nil {
return "", err