aboutsummaryrefslogtreecommitdiffstats
path: root/bug/operation.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-23 19:19:16 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-23 19:19:16 +0200
commite7648996c8f278d061fe03a5c4d255049da765e5 (patch)
tree2917891d130853b24a375ef00b68fe14c8228296 /bug/operation.go
parent16f55e3f4d560330a638986130d27fd067300169 (diff)
downloadgit-bug-e7648996c8f278d061fe03a5c4d255049da765e5.tar.gz
bug: add a new BugExerpt that hold a subset of a bug state for efficient sorting and retrieval
Diffstat (limited to 'bug/operation.go')
-rw-r--r--bug/operation.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/bug/operation.go b/bug/operation.go
index cdf87931..7d71e352 100644
--- a/bug/operation.go
+++ b/bug/operation.go
@@ -23,6 +23,8 @@ type Operation interface {
OpType() OperationType
// Time return the time when the operation was added
Time() time.Time
+ // unixTime return the unix timestamp when the operation was added
+ UnixTime() int64
// Apply the operation to a Snapshot to create the final state
Apply(snapshot Snapshot) Snapshot
// Files return the files needed by this operation
@@ -36,7 +38,7 @@ type Operation interface {
type OpBase struct {
OperationType OperationType
Author Person
- UnixTime int64
+ unixTime int64
}
// NewOpBase is the constructor for an OpBase
@@ -44,7 +46,7 @@ func NewOpBase(opType OperationType, author Person) OpBase {
return OpBase{
OperationType: opType,
Author: author,
- UnixTime: time.Now().Unix(),
+ unixTime: time.Now().Unix(),
}
}
@@ -55,7 +57,12 @@ func (op OpBase) OpType() OperationType {
// Time return the time when the operation was added
func (op OpBase) Time() time.Time {
- return time.Unix(op.UnixTime, 0)
+ return time.Unix(op.unixTime, 0)
+}
+
+// unixTime return the unix timestamp when the operation was added
+func (op OpBase) UnixTime() int64 {
+ return op.unixTime
}
// Files return the files needed by this operation