Implement more sophisticated updateDateTime function
This commit is contained in:
10
atom.go
10
atom.go
@@ -7,6 +7,7 @@ import (
|
||||
"mime"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"golang.org/x/text/language"
|
||||
@@ -109,6 +110,15 @@ func isValidAttribute(attribute string) bool {
|
||||
return regex.MatchString(attribute)
|
||||
}
|
||||
|
||||
// update updates the Date
|
||||
func updateDateTime(d *Date) {
|
||||
if d == nil {
|
||||
d = NewDate(time.Now())
|
||||
} else {
|
||||
d.DateTime = DateTime(time.Now())
|
||||
}
|
||||
}
|
||||
|
||||
// NewURN generates an new valid IRI based on a UUID. It returns an IRI.
|
||||
func NewURN() string {
|
||||
return fmt.Sprint("urn:uuid:", uuid.New())
|
||||
|
Reference in New Issue
Block a user