sqlstruct icon indicating copy to clipboard operation
sqlstruct copied to clipboard

Get alias of specific column

Open madshov opened this issue 7 years ago • 1 comments

Is there any way of getting the aliased column name for a given column? ie:

q := fmt.Sprintf(`
SELECT %s
FROM product p
WHERE reference = ?`, sqlstruct.ColumnsAliased(p, "p"))

if sort["col"] != "" {
        q += fmt.Sprintf(`
ORDER BY %s %s`, sort["col"], sort["order"]) <--- here I would like the alias instead
}

madshov avatar Dec 05 '17 12:12 madshov

Not at the moment, but that's something which could be added.

kisielk avatar Dec 05 '17 16:12 kisielk