Added arn to the main repository
This commit is contained in:
38
arn/HasCreator.go
Normal file
38
arn/HasCreator.go
Normal file
@ -0,0 +1,38 @@
|
||||
package arn
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// HasCreator includes user ID and date for the creation of this object.
|
||||
type hasCreator struct {
|
||||
Created string `json:"created"`
|
||||
CreatedBy UserID `json:"createdBy"`
|
||||
}
|
||||
|
||||
// Creator returns the user who created this object.
|
||||
func (obj *hasCreator) Creator() *User {
|
||||
user, _ := GetUser(obj.CreatedBy)
|
||||
return user
|
||||
}
|
||||
|
||||
// CreatorID returns the ID of the user who created this object.
|
||||
func (obj *hasCreator) CreatorID() UserID {
|
||||
return obj.CreatedBy
|
||||
}
|
||||
|
||||
// GetCreated returns the creation time of the object.
|
||||
func (obj *hasCreator) GetCreated() string {
|
||||
return obj.Created
|
||||
}
|
||||
|
||||
// GetCreatedBy returns the ID of the user who created this object.
|
||||
func (obj *hasCreator) GetCreatedBy() UserID {
|
||||
return obj.CreatedBy
|
||||
}
|
||||
|
||||
// GetCreatedTime returns the creation time of the object as a time struct.
|
||||
func (obj *hasCreator) GetCreatedTime() time.Time {
|
||||
t, _ := time.Parse(time.RFC3339, obj.Created)
|
||||
return t
|
||||
}
|
Reference in New Issue
Block a user