worth a shot
This commit is contained in:
@@ -6,25 +6,18 @@ import (
|
||||
)
|
||||
|
||||
func InsertServiceDelivery(db *sql.DB, responseTimestamp string, recordedAtTime string) (int, error) {
|
||||
fmt.Println("Inserting ServiceDelivery...")
|
||||
var id int
|
||||
|
||||
err := db.QueryRow("INSERT INTO public.ServiceDelivery (ResponseTimestamp, RecordedAtTime) VALUES ($1, $2) RETURNING ID", responseTimestamp, recordedAtTime).Scan(&id)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return 0, err
|
||||
return 0, fmt.Errorf("failed to insert service delivery: %w", err)
|
||||
}
|
||||
//fmt.Println("ServiceDelivery inserted successfully! (", id, ")")
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func UpdateServiceDeliveryData(db *sql.DB, id int, data string) error {
|
||||
fmt.Println("Updating ServiceDelivery data...")
|
||||
_, err := db.Exec("UPDATE public.ServiceDelivery SET Data = $1 WHERE ID = $2", data, id)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return err
|
||||
return fmt.Errorf("failed to update service delivery data: %w", err)
|
||||
}
|
||||
fmt.Println("Finished with this ServiceDelivery!")
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user