most metal oxides are ionic and so are most metal hydrides, carbides, halides and lots of other compounds with metals. Very few comparatively are covalent.
A^x+ O^2- is correct for metal oxides because if you look at the structure of an individual metal oxide crystal you will see at the atomic level metal cations and oxide anions(which is what the O^2- is).
If you look at the structure of a metal hydride you will see metal cations and hydride anions(H-).
If you look at the structure of metal carbides, for quite a few you will see metal cations and carbide anions(C^4-).
For metal halides if you look at their crystal structure you will see metal cations and halide anions(you know, F-, Cl-, Br-, I-, As-).