go - How come I get cannot use type *sql.Row as type error when doing err == sql.ErrNoRows -
i trying follow example in answer given here: golang: how check empty array (array of struct)
on how check if database return empty
so have this:
err = db.queryrow("select accounts steamid=?", steamid) switch { case err == sql.errnorows: case err != nil: default: //do stuff }
but error:
cannot use db.queryrow("select accounts steamid=?", steamid) (type *sql.row) type error in assignment: *sql.row not implement error (missing error method)
not sure why worked in example not when try implement it. thanks.
you've missed scan
part of example, returns error:
err := db.queryrow("select ...").scan(&id, &secret, &shortname)
Comments
Post a Comment