O'Reilly logo

Go Standard Library Cookbook by Radomir Sohlich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

The Query and QueryContext methods of the pointer to the DB struct result in the Rows struct pointer. The Rows pointer provides the methods Columns and ColumnTypes, which contain the information about the structure of the returned result set.

The Columns method returns just the slice of strings with column names.

The ColumnTypes method returns the slice of ColumnType pointers, which contains more rich information about the returned result set. The preceding code prints out the detailed information of what information the ColumnType pointer exposes. 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required