@@ -195,9 +195,11 @@ func (r *dynamoDbResolver) SoftDelete(hash string) (bool, error) {
195
195
input := & dynamodb.UpdateItemInput {
196
196
ExpressionAttributeValues : map [string ]* dynamodb.AttributeValue {
197
197
":dt" : {N : aws .String (strconv .FormatInt (time .Now ().Unix (), 10 ))},
198
+ ":sn" : {N : aws .String ("0" )},
199
+ ":df" : {BOOL : aws .Bool (true )},
198
200
},
199
201
TableName : aws .String (r .TableName ),
200
- UpdateExpression : aws .String ("SET deleted=1 , deleted_at=:dt" ),
202
+ UpdateExpression : aws .String ("SET deleted=:df , deleted_at=:dt, serial=:sn " ),
201
203
Key : map [string ]* dynamodb.AttributeValue {
202
204
"hash" : {S : aws .String (hash )},
203
205
},
@@ -213,12 +215,16 @@ func (r *dynamoDbResolver) SoftDelete(hash string) (bool, error) {
213
215
}
214
216
215
217
func (r * dynamoDbResolver ) SoftUndelete (hash string ) (bool , error ) {
218
+ serial := strconv .FormatUint (uint64 (time .Now ().UnixNano ()), 10 )
219
+
216
220
input := & dynamodb.UpdateItemInput {
217
221
ExpressionAttributeValues : map [string ]* dynamodb.AttributeValue {
218
222
":dt" : {N : aws .String ("" )},
223
+ ":bf" : {BOOL : aws .Bool (false )},
224
+ ":sn" : {N : aws .String (serial )},
219
225
},
220
226
TableName : aws .String (r .TableName ),
221
- UpdateExpression : aws .String ("SET deleted=0 , deleted_at=:dt" ),
227
+ UpdateExpression : aws .String ("SET deleted=:df , deleted_at=:dt, serial=:sn " ),
222
228
Key : map [string ]* dynamodb.AttributeValue {
223
229
"hash" : {S : aws .String (hash )},
224
230
},
0 commit comments