aboutsummaryrefslogtreecommitdiffstats
path: root/bug/operation.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-18 00:16:06 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-18 00:16:06 +0200
commitba3281dc9918fa49f10c2a166b5b631a931d2d51 (patch)
treef6e9d17fa7828634f250c7af0674d5405ba0d224 /bug/operation.go
parent6f83d89274fc796e01149c84b91b8aa2066f0273 (diff)
downloadgit-bug-ba3281dc9918fa49f10c2a166b5b631a931d2d51.tar.gz
all operations now have an author and a timestamp
Diffstat (limited to 'bug/operation.go')
-rw-r--r--bug/operation.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/bug/operation.go b/bug/operation.go
index c9e7a555..15374f08 100644
--- a/bug/operation.go
+++ b/bug/operation.go
@@ -1,5 +1,7 @@
package bug
+import "time"
+
type OperationType int
const (
@@ -12,13 +14,28 @@ const (
type Operation interface {
OpType() OperationType
+ Time() time.Time
Apply(snapshot Snapshot) Snapshot
}
type OpBase struct {
OperationType OperationType
+ Author Person
+ UnixTime int64
+}
+
+func NewOpBase(opType OperationType, author Person) OpBase {
+ return OpBase{
+ OperationType: opType,
+ Author: author,
+ UnixTime: time.Now().Unix(),
+ }
}
func (op OpBase) OpType() OperationType {
return op.OperationType
}
+
+func (op OpBase) Time() time.Time {
+ return time.Unix(op.UnixTime, 0)
+}