created_at to api
This commit is contained in:
27
internal/utils/names.go
Normal file
27
internal/utils/names.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package utils
|
||||
|
||||
import "hash/fnv"
|
||||
|
||||
var names = []string{
|
||||
"Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf", "Hotel", "India", "Juliet",
|
||||
"Kilo", "Lima", "Mike", "November", "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango",
|
||||
"Uniform", "Victor", "Whiskey", "X-ray", "Yankee", "Zulu", "Jellybean", "Cupcake", "Donut", "Eclair", "Froyo",
|
||||
"Gingerbread", "Honeycomb", "IceCreamSandwich", "JellyBean", "KitKat", "Lollipop", "Marshmallow", "Nougat", "Oreo",
|
||||
"Pie", "Quince", "Raspberry", "Strawberry", "Tangerine", "UgliFruit", "Vanilla", "Watermelon", "Xigua",
|
||||
"YellowPassionfruit", "Zucchini", "ApplePie", "BananaBread", "CinnamonRoll", "Doughnut", "Eggnog",
|
||||
"Fruitcake", "Gingerbread", "HotChocolate", "IceCream", "Jelly", "KettleCorn", "Lemonade", "Muffin", "Nectar",
|
||||
"OrangeJuice", "Pancake", "Quiche", "Raspberry", "Smoothie", "Taffy", "UpsideDownCake", "VanillaWafer", "Waffle",
|
||||
"XmasCookies", "Yogurt", "ZebraCake",
|
||||
}
|
||||
|
||||
func hash(s string) uint32 {
|
||||
h := fnv.New32a()
|
||||
h.Write([]byte(s))
|
||||
return h.Sum32()
|
||||
}
|
||||
|
||||
func GenerateName(sessionUUID string) string {
|
||||
h := hash(sessionUUID)
|
||||
index := h % uint32(len(names))
|
||||
return names[index]
|
||||
}
|
||||
Reference in New Issue
Block a user