I have found two way to get the last insert id
Result, err := s.DB.ExecContext(ctx, query, qp)
if err != nil {
return 0, err
}
ID, err := Result.LastInsertId()
and another way is to use mysql's
select LAST_INSERT_ID();
How different are these two methods and what should i do in-case the first method throws an error, would it mean my insert failed or would it mean just that method failed to return the id ?