Let the user define their own iri
This commit is contained in:
parent
3734a3eb3d
commit
13e7a16178
6
id.go
6
id.go
@ -3,8 +3,6 @@ package atom
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ID struct {
|
type ID struct {
|
||||||
@ -13,8 +11,8 @@ type ID struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewID creates a new ID. It returns a *ID.
|
// NewID creates a new ID. It returns a *ID.
|
||||||
func NewID() *ID {
|
func NewID(id string) *ID {
|
||||||
return &ID{URI: IRI(fmt.Sprint("urn:uuid:", uuid.New()))}
|
return &ID{URI: IRI(id)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check checks the ID for incompatibilities with RFC4287. It returns an error.
|
// Check checks the ID for incompatibilities with RFC4287. It returns an error.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user