How is sorting done under the hood in DQL?

Thank you! I will try that late tonight. I understand algorithms but not Go syntax so I will try to read it and the comments to understand the logic.