A car driver passes you close, and then immediately turns into an intersection or driveway, slamming into you. They never once saw you. (But really, it's a heavy case of short memory, quickly and conveniently forgetting that the cyclist they have just overtaken still exists after the overtake).
You have been right-hooked.

Meh, bad luck. Do the same thing (stick close to the curb side), expect different result
Next time, take the lane, be more assertive and visible.
use the sidewalk