Let the user define their own iri

This commit is contained in:
Jason Streifling 2024-10-17 16:51:40 +02:00
parent 3734a3eb3d
commit 13e7a16178

6
id.go
View File

@ -3,8 +3,6 @@ package atom
import (
"errors"
"fmt"
"github.com/google/uuid"
)
type ID struct {
@ -13,8 +11,8 @@ type ID struct {
}
// NewID creates a new ID. It returns a *ID.
func NewID() *ID {
return &ID{URI: IRI(fmt.Sprint("urn:uuid:", uuid.New()))}
func NewID(id string) *ID {
return &ID{URI: IRI(id)}
}
// Check checks the ID for incompatibilities with RFC4287. It returns an error.