almost there but tasks dont disappear in UI and click&drag doesnt work
This commit is contained in:
15
server/ajax/form/uuid.go
Normal file
15
server/ajax/form/uuid.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package form
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hash/fnv"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func NewUUID() string {
|
||||
uuid := uuid.New().String()
|
||||
h := fnv.New32a()
|
||||
h.Write([]byte(uuid))
|
||||
return fmt.Sprint(h.Sum32())
|
||||
}
|
||||
20
server/ajax/form/uuid_test.go
Normal file
20
server/ajax/form/uuid_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package form
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUUID(t *testing.T) {
|
||||
seen := map[string]struct{}{}
|
||||
for i := 0; i < 50; i++ {
|
||||
v := NewUUID()
|
||||
if _, ok := seen[v]; ok {
|
||||
t.Error(ok)
|
||||
}
|
||||
if _, err := strconv.Atoi(v); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
seen[v] = struct{}{}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user