diff --git a/database/EstimatedCall.go b/database/EstimatedCall.go index ac7cf3b..56c797b 100644 --- a/database/EstimatedCall.go +++ b/database/EstimatedCall.go @@ -1,7 +1,9 @@ package database import ( + "crypto/md5" "database/sql" + "encoding/hex" "fmt" ) @@ -13,6 +15,17 @@ func InsertOrUpdateEstimatedCall(db *sql.DB, values []interface{}) (int, string, } } + // Convert values to a single string and hash it using MD5 + var valuesString string + for _, v := range values { + if v != nil { + valuesString += fmt.Sprintf("%v", v) + } + } + hash := md5.Sum([]byte(valuesString)) + hashString := hex.EncodeToString(hash[:]) + println(hashString) + query := ` INSERT INTO calls ( estimatedvehiclejourney, "order", stoppointref,