hash for valky or reddis or smth else

This commit is contained in:
pigwin
2025-01-06 15:32:04 +00:00
parent 1020dacf79
commit c456bdecdb

View File

@@ -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,