Let the protection key restate itself

This commit is contained in:
2020-11-18 22:32:00 +01:00
parent fc2a867cbb
commit c1ad7aea7d
4 changed files with 11 additions and 7 deletions
+8
View File
@@ -1,6 +1,8 @@
package protection
import (
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
)
@@ -9,3 +11,9 @@ type Key struct {
X primitive.ObjectID `bson:"_x" json:"_x" index:",hashed"`
V int64 `bson:"_v" json:"_v"`
}
// Restate creates a new protection key
func (k *Key) Restate() {
k.X = primitive.NewObjectID()
k.V = time.Now().Unix()
}