From 9919c159f272c2d1176669d5e9402bad370ad5bc Mon Sep 17 00:00:00 2001 From: pigwin Date: Tue, 7 Jan 2025 20:39:47 +0000 Subject: [PATCH] gotta fix that valkey shit later --- database/EstimatedCall.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/database/EstimatedCall.go b/database/EstimatedCall.go index f11dda1..2efaf50 100644 --- a/database/EstimatedCall.go +++ b/database/EstimatedCall.go @@ -35,6 +35,14 @@ func InsertOrUpdateEstimatedCall(ctx context.Context, db *sql.DB, values []inter key := fmt.Sprintf("%v.%v", estimatedVehicleJourneyID, orderID) fmt.Printf("Estimated Vehicle Journey ID: %v, Order ID: %v\n", estimatedVehicleJourneyID, orderID) + var err error + + // Set the MD5 hash in Valkey + err = valki.SetValkeyValue(ctx, valkeyClient, key, hashString) + if err != nil { + return 0, "", fmt.Errorf("failed to set value in Valkey: %v", err) + } + // Get the MD5 hash from Valkey retrievedHash, err := valki.GetValkeyValue(ctx, valkeyClient, key) if err != nil { @@ -47,12 +55,6 @@ func InsertOrUpdateEstimatedCall(ctx context.Context, db *sql.DB, values []inter } fmt.Println("Retrieved hash matches the original hash.") - // Set the MD5 hash in Valkey - err = valki.SetValkeyValue(ctx, valkeyClient, key, hashString) - if err != nil { - return 0, "", fmt.Errorf("failed to set value in Valkey: %v", err) - } - query := ` INSERT INTO calls ( estimatedvehiclejourney, "order", stoppointref,