The process by which an electric current passes through an ionic compound, followed by the decomposition of the compound, is known as electrolysis.
Any substance that undergoes electrolysis is known as electrolyte. A substance that doesn't undergo electrolysis ( i.e. the substance does not allow current to pass through it or doesn't get decomposed ) is known as a non-electrolyte. Most ionic compounds are electrolytes, whereas covalent compounds are mostly non-electrolytes.
A good way to understand the process of electrolysis is to understand how an ionic compound dissociates into ions.
Take, for instance, the electrolysis of sodium chloride (NaCl). When a current is passed through the NaCl solution, the charged ions migrate towards the oppositely charged electrodes ( cations move towards cathode and anions move towards anode). By this way, a current flows through the solution. But, there is a wide difference between the flow of current in a conductor and in an electrolyte.