Home > Article > Backend Development > How to Resolve "sql: expected 1 destination arguments in Scan" Error in Golang QueryRow with JSONB Data?
“sql: expected 1 destination arguments in Scan” Error in Golang QueryRow with JSONB Data
The issue arises when attempting to use db.QueryRow to retrieve data from a JSONB column and storing the results in multiple destination arguments. However, the query returns only one field, leading to the "expected 1 destination arguments in Scan" error.
To resolve this issue, there are several approaches:
err := db.QueryRow("SELECT data->>'id', data->>'type', data->>'title' FROM message WHERE data->>'id'="
The above is the detailed content of How to Resolve "sql: expected 1 destination arguments in Scan" Error in Golang QueryRow with JSONB Data?. For more information, please follow other related articles on the PHP Chinese website!