Your Question

Hi, I am new to golang, I have one question about ColumnType.

In my example, I have one column named "position" in a table, type is "text", it contains a pair of latitude and longitude value. In my backend code, it can return both type: "text" and displayType: "geo" to sql.go.

My problem is, ColumnType only has one "databaseType" property as string, what is best way if I want to return both types to my frontend code? The reason is, I might have another example of type: "text", displayType: "email" in the future, and I want some common logic for "text", then special logic for "geo/email". So it would be great of I can have two types.

One alternative way I can think of is to concat type and displayType, then split it later, but it looks hacky.

Thanks in advance!

The document you expected this should be explained

Expected answer