Allow the user to generate a valid iri based on a uuid

This commit is contained in:
Jason Streifling 2024-10-17 16:52:03 +02:00
parent 13e7a16178
commit b496ac3691

View File

@ -1,10 +1,12 @@
package atom
import (
"fmt"
"mime"
"regexp"
"strings"
"github.com/google/uuid"
"golang.org/x/text/language"
)
@ -79,3 +81,8 @@ func isValidLanguageTag(tag LanguageTag) bool {
_, err := language.Parse(string(tag))
return err == nil
}
// NewURN generates an new valid IRI based on a UUID. It returns an IRI.
func NewURN() IRI {
return IRI(fmt.Sprint("urn:uuid:", uuid.New()))
}