-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add update reconciliation for migration job (#45)
* chore: add update reconciliation for migration job * use client update * back to delete+update * make it idempotent * idk * use hash, fix tests * final * oops * missing files * use switch case * add requeue delay
- Loading branch information
1 parent
52de65c
commit 221c6bc
Showing
6 changed files
with
238 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package utils | ||
|
||
import ( | ||
"crypto/sha256" | ||
"encoding/hex" | ||
"encoding/json" | ||
) | ||
|
||
// Hash returns a hashed string based on an input object, | ||
// which is JSON serialized, and the length of the output. | ||
func Hash(obj interface{}, length int) (string, error) { | ||
data, err := json.Marshal(obj) // Serialize the object to JSON | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
hash := sha256.New() | ||
hash.Write(data) | ||
return hex.EncodeToString(hash.Sum(nil))[:length], nil | ||
} |
Oops, something went wrong.