Search⌘ K
AI Features

Introduction

Explore how interfaces in Go express abstractions and shared behaviors across data types, enabling dynamic sorting and versatile utilities. Understand type methods and reflection, gaining the ability to work with multiple CSV formats and complex data structures efficiently.

Introduction to reflection and interfaces

Let’s recall the phone book application discussed previously. We might wonder how to deal with a new requirement where we want to sort user-defined data structures, such as phone book records, based on our own criteria, such as a surname or first name. What is the best way to sort different datasets that share some common behavior ...