From 5d28545680294b853dab9456d3aab796a50a5984 Mon Sep 17 00:00:00 2001 From: Cemre MENGU Date: Tue, 13 Feb 2018 18:22:17 +0300 Subject: [PATCH] Added ColumnTypes support --- sqlx.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sqlx.go b/sqlx.go index e95f23ff..e6494739 100644 --- a/sqlx.go +++ b/sqlx.go @@ -228,6 +228,14 @@ func (r *Row) Columns() ([]string, error) { return r.rows.Columns() } +// ColumnTypes returns the underlying sql.Rows.ColumnTypes(), or the deferred error +func (r *Row) ColumnTypes() ([]*sql.ColumnType, error) { + if r.err != nil { + return []*sql.ColumnType{}, r.err + } + return r.rows.ColumnTypes() +} + // Err returns the error encountered while scanning. func (r *Row) Err() error { return r.err