mirror of
https://github.com/mainnika/mongox-go-driver.git
synced 2026-05-22 15:53:36 +00:00
Let the protection key restate itself
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user