this problem is somewhat difficult to describe in the title sentence
specifically: the row queried by
can only be obtained using the Scan method.
and the Scan method must fill in the parameters one by one according to the queried column in order to get the value.
more or less will return error
for example, if sql is select col1,col2,col3
, you must first var col1,col2,col3
and then row.Scan (& col1, & col2, & col3)
if I want to make such a simple wheel:
enter a sql statement as a parameter (no matter how many values this sql statement queries), and return an array or key-value pair of results.
here, because I don"t know how many select columns are in sql, and QueryRow (). Scan () must fill in the parameters one by one, in this case, how can I achieve the desired effect?
if there is already a ready-made wheel, I can also look at the source code to learn.