bouncer/internal/store/id.go

20 lines
300 B
Go

package store
import (
"github.com/google/uuid"
"github.com/pkg/errors"
)
func NewID() string {
return uuid.NewString()
}
func ParseID[T ~string](raw string) (T, error) {
uuid, err := uuid.Parse(raw)
if err != nil {
return *new(T), errors.WithStack(err)
}
return T(uuid.String()), nil
}