mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
feat: added hash to models
This commit is contained in:
12
core/utils/hash.go
Normal file
12
core/utils/hash.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package utils
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
func GetObjectHash(obj any) string {
|
||||
data, _ := json.Marshal(obj)
|
||||
if data == nil {
|
||||
// random hash
|
||||
return EncryptMd5(NewUUIDString())
|
||||
}
|
||||
return EncryptMd5(string(data))
|
||||
}
|
||||
Reference in New Issue
Block a user