You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func (db *DB) updateTableRecord(ctx context.Context, value any, columnsToUpdate []string, primaryKey *desc.Column) (int64, error) {
// build the SQL query and arguments using the table definition and its primary key.
query, args, err := desc.BuildUpdateQuery(value, columnsToUpdate, primaryKey)
if err != nil {
return 0, err
}
// execute the query using db.Exec and pass in the primary key values as a parameter
tag, err := db.Exec(ctx, query, args...)
if err != nil {
return 0, err
}
return tag.RowsAffected(), nil
}
My query have 4 arguments and my args got 3 element only. Look like the id is causing the issue maybe...
UPDATE "events" SET title = $1,description = $2,id = $3 WHERE "id" = $4;
Following your new article:
https://medium.com/@kataras/how-to-use-iris-and-postgresql-for-web-development-e8c46d72f1e6
I was able to use the pg middleware for testing. It seem I cannot do update!
The error I got: transaction: exec: mismatched param and argument count
From Postman I Put:
{
"id": "6c051e51-9c64-49f7-a6ce-977cd7b2030a",
"email": "[email protected]",
"password": "Ironman",
"firstName": "Tony",
"middleName": "",
"lastName": "Stark",
"sex": "M"
},
Same error if I add my CreatedAt and UpdatedAt in my json
I tried to debug further, and it remove my audit dates because there are timestamp and put my id at the end not sure what it try to do.
Any help will be appreciated!
My project is here:
https://github.com/aleblanc70/events/blob/main/web/main.go
Thanks!
The text was updated successfully, but these errors were encountered: