Umstellung auf uuid
All checks were successful
release-tag / release-image (push) Successful in 1m32s

This commit is contained in:
2025-09-27 21:42:32 +02:00
parent 92e222f648
commit baedff9e9d
6 changed files with 108 additions and 88 deletions

View File

@@ -2,13 +2,15 @@ package filesvc
import (
"context"
"crypto/rand"
"errors"
"fmt"
"time"
)
/*** Domain ***/
type ID = int64
type ID = string
type File struct {
ID ID `json:"id"`
@@ -76,3 +78,13 @@ type MeshStore interface {
Replicable
Watchable // optional kann Noop sein
}
func NewUUIDv4() (string, error) {
b := make([]byte, 16)
if _, err := rand.Read(b); err != nil {
return "", err
}
b[6] = (b[6] & 0x0f) | 0x40 // Version 4
b[8] = (b[8] & 0x3f) | 0x80 // Variant RFC4122
return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:16]), nil
}