Allow the user to generate a valid iri based on a uuid
This commit is contained in:
parent
13e7a16178
commit
b496ac3691
7
atom.go
7
atom.go
@ -1,10 +1,12 @@
|
|||||||
package atom
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"mime"
|
"mime"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
"golang.org/x/text/language"
|
"golang.org/x/text/language"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -79,3 +81,8 @@ func isValidLanguageTag(tag LanguageTag) bool {
|
|||||||
_, err := language.Parse(string(tag))
|
_, err := language.Parse(string(tag))
|
||||||
return err == nil
|
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()))
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user